From d28c0234566627880e0b5fd92c4a9cb7ffbf146e Mon Sep 17 00:00:00 2001 From: Maru Date: Wed, 4 Oct 2017 22:50:11 -0300 Subject: [PATCH] Fix issue with aggro when mob dies instantly from skill; Align cast interrupt packet with retail; --- src/servers/Server_Zone/Action/ActionCast.cpp | 6 +++++- src/servers/Server_Zone/Actor/Actor.cpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/servers/Server_Zone/Action/ActionCast.cpp b/src/servers/Server_Zone/Action/ActionCast.cpp index df132950..a28125c7 100644 --- a/src/servers/Server_Zone/Action/ActionCast.cpp +++ b/src/servers/Server_Zone/Action/ActionCast.cpp @@ -92,7 +92,11 @@ void Core::Action::ActionCast::onInterrupt() m_pSource->getAsPlayer()->sendStateFlags(); auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, - 0x219, 1, m_id, 1 ); + 0x219, 1, m_id, 0 ); + + // Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example: + // auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 ); + m_pSource->sendToInRangeSet( control, true ); } diff --git a/src/servers/Server_Zone/Actor/Actor.cpp b/src/servers/Server_Zone/Actor/Actor.cpp index 977cdd6e..33f20c6b 100644 --- a/src/servers/Server_Zone/Actor/Actor.cpp +++ b/src/servers/Server_Zone/Actor/Actor.cpp @@ -696,9 +696,13 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint32_t actionId, u if ( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Enemies ) ) break; - pTarget.takeDamage( static_cast< uint32_t >( param1 ) ); - pTarget.onActionHostile( shared_from_this() ); sendToInRangeSet( effectPacket, true ); + + pTarget.takeDamage( static_cast< uint32_t >( param1 ) ); + + if ( pTarget.isAlive() ) + pTarget.onActionHostile( shared_from_this() ); + } else { @@ -711,8 +715,11 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint32_t actionId, u effectPacket.data().effectTarget = pHitActor->getId(); sendToInRangeSet( effectPacket, true ); // todo: send to range of what? ourselves? when mob script hits this is going to be lacking + pHitActor->takeDamage( static_cast< uint32_t >( param1 ) ); - pHitActor->onActionHostile( shared_from_this() ); + + if( pHitActor->isAlive() ) + pHitActor->onActionHostile( shared_from_this() ); // Debug if ( isPlayer() )