diff --git a/src/scripts/instances/questbattles/ChasingShadows.cpp b/src/scripts/instances/questbattles/ChasingShadows.cpp index 0c11887e..336cd0d6 100644 --- a/src/scripts/instances/questbattles/ChasingShadows.cpp +++ b/src/scripts/instances/questbattles/ChasingShadows.cpp @@ -61,16 +61,20 @@ public: auto papa = instance.getActiveBNpcByLevelId( INIT_P_POP_PAPARIMO ); auto pPlayer = instance.getPlayerPtr(); + uint32_t bossHpPercent = 0; + if( boss ) + bossHpPercent = boss->getHpPercent(); + if( pPlayer && !pPlayer->isAlive() ) { instance.fail(); return; } - if( !boss || !ida || !papa ) + if( !ida || !papa ) return; - if( pair1Spawnd == 0 && boss->getHpPercent() <= 75 ) + if( pair1Spawnd == 0 && bossHpPercent <= 75 ) { instance.setCustomVar( SET_1_SPAWNED, 1 ); auto a2 = instance.createBNpcFromLevelEntry( INIT_POP_ENEMY_B_03, 10, 0, 1440, 938, @@ -98,7 +102,7 @@ public: a5->hateListAdd( pPlayer, 1 ); } - if( pair2Spawnd == 0 && boss->getHpPercent() <= 50 ) + if( pair2Spawnd == 0 && bossHpPercent <= 50 ) { instance.setCustomVar( SET_2_SPAWNED, 1 ); auto a2 = instance.createBNpcFromLevelEntry( INIT_POP_ENEMY_B_05, 10, 0, 1440, 938, @@ -126,7 +130,7 @@ public: } - if( pair3Spawnd == 0 && boss->getHpPercent() <= 25 ) + if( pair3Spawnd == 0 && bossHpPercent <= 25 ) { instance.setCustomVar( SET_3_SPAWNED, 1 ); @@ -148,7 +152,6 @@ public: instance.success(); return; } - } void onEnterTerritory( QuestBattle& instance, Entity::Player& player, uint32_t eventId, uint16_t param1, diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index c7c7790f..7f04a63f 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -491,7 +491,7 @@ bool Sapphire::Action::Action::consumeResources() bool Sapphire::Action::Action::snapshotAffectedActors( std::vector< Entity::CharaPtr >& actors ) { - for( const auto& actor : m_pSource->getInRangeActors() ) + for( const auto& actor : m_pSource->getInRangeActors( true ) ) { // check for initial target validity based on flags in action exd (pc/enemy/etc.) if( !preFilterActor( *actor ) ) @@ -515,9 +515,8 @@ bool Sapphire::Action::Action::snapshotAffectedActors( std::vector< Entity::Char player->sendDebug( "hit actor#{}", actor->getId() ); } } - if( actors.empty() ) - return false; - return true; + + return !actors.empty(); } void Sapphire::Action::Action::addActorFilter( World::Util::ActorFilterPtr filter ) diff --git a/src/world/Territory/QuestBattle.cpp b/src/world/Territory/QuestBattle.cpp index 39d0f821..0227bbcd 100644 --- a/src/world/Territory/QuestBattle.cpp +++ b/src/world/Territory/QuestBattle.cpp @@ -385,7 +385,7 @@ uint32_t Sapphire::QuestBattle::getQuestId() const uint32_t Sapphire::QuestBattle::getCountEnemyBNpc() { uint32_t count = 0; - for( auto bnpcIt : m_bNpcMap ) + for( const auto& bnpcIt : m_bNpcMap ) { if( bnpcIt.second->getEnemyType() == 4 && bnpcIt.second->isAlive() ) count++;