From 04e7f1c9cb461e4179bbd311c31fff0a68a47daf Mon Sep 17 00:00:00 2001 From: Mordred Date: Fri, 8 Dec 2017 23:09:34 +0100 Subject: [PATCH] Minor style fixes --- src/servers/Server_Zone/Actor/Actor.cpp | 37 ++++++++++++------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/servers/Server_Zone/Actor/Actor.cpp b/src/servers/Server_Zone/Actor/Actor.cpp index 415fb864..3439fef7 100644 --- a/src/servers/Server_Zone/Actor/Actor.cpp +++ b/src/servers/Server_Zone/Actor/Actor.cpp @@ -664,7 +664,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u uint64_t param2, Entity::Actor& pTarget ) { - if ( isPlayer() ) + if( isPlayer() ) { getAsPlayer()->sendDebug( std::to_string( pTarget.getId() ) ); getAsPlayer()->sendDebug( "Handle script skill type: " + std::to_string( type ) ); @@ -686,7 +686,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u effectPacket.data().effectTarget = pTarget.getId(); // Todo: for each actor, calculate how much damage the calculated value should deal to them - 2-step damage calc. we only have 1-step - switch ( type ) + switch( type ) { case ActionEffectType::Damage: @@ -696,7 +696,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalDamage; effectPacket.data().effects[0].unknown_3 = 7; - if ( !actionInfoPtr->is_aoe ) + if( !actionInfoPtr->is_aoe ) { // If action on this specific target is valid... if ( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Enemies ) ) @@ -716,7 +716,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u auto actorsCollided = ActionCollision::getActorsHitFromAction( pTarget.getPos(), getInRangeActors( true ), actionInfoPtr, TargetFilter::Enemies ); - for ( const auto& pHitActor : actorsCollided ) + for( const auto& pHitActor : actorsCollided ) { effectPacket.data().targetId = pHitActor->getId(); effectPacket.data().effectTarget = pHitActor->getId(); @@ -733,9 +733,8 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u // Debug if ( isPlayer() ) { - if ( pHitActor->isPlayer() ) { + if ( pHitActor->isPlayer() ) getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) + " (" + pHitActor->getName() + ")" ); - } else getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) ); } @@ -753,9 +752,9 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u effectPacket.data().effects[0].effectType = ActionEffectType::Heal; effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalHeal; - if ( !actionInfoPtr->is_aoe ) + if( !actionInfoPtr->is_aoe ) { - if ( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Allies ) ) + if( isPlayer() && !ActionCollision::isActorApplicable( pTarget.shared_from_this(), TargetFilter::Allies ) ) break; sendToInRangeSet( effectPacket, true ); @@ -769,7 +768,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u auto actorsCollided = ActionCollision::getActorsHitFromAction( pTarget.getPos(), getInRangeActors( true ), actionInfoPtr, TargetFilter::Allies ); - for ( auto pHitActor : actorsCollided ) + for( auto pHitActor : actorsCollided ) { effectPacket.data().targetId = pTarget.getId(); effectPacket.data().effectTarget = pHitActor->getId(); @@ -778,11 +777,10 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint16_t actionId, u pHitActor->heal( calculatedHeal ); // Debug - if ( isPlayer() ) + if( isPlayer() ) { - if ( pHitActor->isPlayer() ) { + if( pHitActor->isPlayer() ) getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) + " (" + pHitActor->getName() + ")" ); - } else getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) ); } @@ -837,13 +835,14 @@ void Core::Entity::Actor::addStatusEffectById( uint32_t id, int32_t duration, En /*! \param StatusEffectPtr to be applied to the actor */ void Core::Entity::Actor::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Actor& pSource, uint16_t param ) { - if( !hasStatusEffect( id ) ) - { - StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, pSource.shared_from_this(), - shared_from_this(), duration, 3000 ) ); - effect->setParam( param ); - addStatusEffect( effect ); - } + if( hasStatusEffect( id ) ) + return; + + StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, pSource.shared_from_this(), + shared_from_this(), duration, 3000 ) ); + effect->setParam( param ); + addStatusEffect( effect ); + } float Core::Entity::Actor::getRotation() const