1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-30 16:17:46 +00:00

Merge pull request #561 from NotAdam/develop

fix self target actions not targeting correctly, fix chasing shadows being uncompletable
This commit is contained in:
Mordred 2019-05-28 14:37:06 +02:00 committed by GitHub
commit ff34636777
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View file

@ -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,

View file

@ -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 )

View file

@ -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++;