|
|
@ -23,6 +23,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
m.F(A::SHOOT_RING_TIMER)=std::max(0.f,m.F(A::SHOOT_RING_TIMER)-fElapsedTime); |
|
|
|
m.F(A::SHOOT_RING_TIMER)=std::max(0.f,m.F(A::SHOOT_RING_TIMER)-fElapsedTime); |
|
|
|
m.F(A::SHOOT_RING_DELAY)=std::max(0.f,m.F(A::SHOOT_RING_DELAY)-fElapsedTime); |
|
|
|
m.F(A::SHOOT_RING_DELAY)=std::max(0.f,m.F(A::SHOOT_RING_DELAY)-fElapsedTime); |
|
|
|
m.F(A::JUMP_LANDING_TIMER)=std::max(0.f,m.F(A::JUMP_LANDING_TIMER)-fElapsedTime); |
|
|
|
m.F(A::JUMP_LANDING_TIMER)=std::max(0.f,m.F(A::JUMP_LANDING_TIMER)-fElapsedTime); |
|
|
|
|
|
|
|
m.F(A::CASTING_TIMER)=std::max(0.f,m.F(A::CASTING_TIMER)-fElapsedTime); |
|
|
|
|
|
|
|
|
|
|
|
const auto ShootBulletRing=[&](float angleOffset){ |
|
|
|
const auto ShootBulletRing=[&](float angleOffset){ |
|
|
|
int bulletCount=ConfigInt("Phase1.RingBulletCount"); |
|
|
|
int bulletCount=ConfigInt("Phase1.RingBulletCount"); |
|
|
@ -47,7 +48,6 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
const auto SpawnMonsterFromConfig=[&](int phase){ |
|
|
|
const auto SpawnMonsterFromConfig=[&](int phase){ |
|
|
|
std::string spawnMonster=ConfigStringArr("Phase"+std::to_string(phase)+".MonsterSpawnOnChange",0); |
|
|
|
std::string spawnMonster=ConfigStringArr("Phase"+std::to_string(phase)+".MonsterSpawnOnChange",0); |
|
|
|
int spawnCount=ConfigIntArr("Phase"+std::to_string(phase)+".MonsterSpawnOnChange",1); |
|
|
|
int spawnCount=ConfigIntArr("Phase"+std::to_string(phase)+".MonsterSpawnOnChange",1); |
|
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<spawnCount;i++){ |
|
|
|
for(int i=0;i<spawnCount;i++){ |
|
|
|
float randomAngle=util::random(2*PI); |
|
|
|
float randomAngle=util::random(2*PI); |
|
|
|
vf2d spawnPos=m.pos+vf2d{cos(randomAngle),sin(randomAngle)}*m.GetSizeMult()*12; |
|
|
|
vf2d spawnPos=m.pos+vf2d{cos(randomAngle),sin(randomAngle)}*m.GetSizeMult()*12; |
|
|
@ -74,23 +74,24 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const auto StartJump=[&](float jumpDuration,vf2d targetPos,float recoveryTime){ |
|
|
|
const auto StartJump=[&](float jumpDuration,vf2d targetPos,float recoveryTime,float jumpMoveSpd){ |
|
|
|
m.V(A::JUMP_ORIGINAL_POS)=m.GetPos(); |
|
|
|
m.V(A::JUMP_ORIGINAL_POS)=m.GetPos(); |
|
|
|
m.F(A::JUMP_ORIGINAL_LANDING_TIMER)=m.F(A::JUMP_LANDING_TIMER)=jumpDuration; |
|
|
|
m.F(A::JUMP_ORIGINAL_LANDING_TIMER)=m.F(A::JUMP_LANDING_TIMER)=jumpDuration; |
|
|
|
m.V(A::JUMP_TARGET_POS)=targetPos; |
|
|
|
m.V(A::JUMP_TARGET_POS)=targetPos; |
|
|
|
m.F(A::RECOVERY_TIME)=recoveryTime; |
|
|
|
m.F(A::RECOVERY_TIME)=recoveryTime; |
|
|
|
m.state=State::JUMP; |
|
|
|
m.F(A::JUMP_MOVE_SPD)=jumpMoveSpd; |
|
|
|
|
|
|
|
m.SetState(State::JUMP); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if(m.state==State::RECOVERY){ |
|
|
|
if(m.GetState()==State::RECOVERY){ |
|
|
|
m.F(A::RECOVERY_TIME)=std::max(0.f,m.F(A::RECOVERY_TIME)-fElapsedTime); |
|
|
|
m.F(A::RECOVERY_TIME)=std::max(0.f,m.F(A::RECOVERY_TIME)-fElapsedTime); |
|
|
|
if(m.F(A::RECOVERY_TIME)==0){ |
|
|
|
if(m.F(A::RECOVERY_TIME)==0){ |
|
|
|
m.state=State::NORMAL; |
|
|
|
m.GetState()==State::NORMAL; |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(m.state==State::JUMP){ |
|
|
|
if(m.GetState()==State::JUMP){ |
|
|
|
float jumpLandingTimerRatio=m.F(A::JUMP_LANDING_TIMER)/m.F(A::JUMP_ORIGINAL_LANDING_TIMER); |
|
|
|
float jumpLandingTimerRatio=m.F(A::JUMP_LANDING_TIMER)/m.F(A::JUMP_ORIGINAL_LANDING_TIMER); |
|
|
|
if(m.GetPos().x>game->GetPlayer()->GetPos().x){ |
|
|
|
if(m.GetPos().x>game->GetPlayer()->GetPos().x){ |
|
|
|
m.SetX(std::max(game->GetPlayer()->GetPos().x,m.GetPos().x-ConfigInt("JumpMoveSpd")*game->GetElapsedTime())); |
|
|
|
m.SetX(std::max(game->GetPlayer()->GetPos().x,m.GetPos().x-ConfigInt("JumpMoveSpd")*game->GetElapsedTime())); |
|
|
@ -139,8 +140,15 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(m.state==State::CASTING){ |
|
|
|
if(m.GetState()==State::CASTING){ |
|
|
|
m.UpdateAnimation("monsters/Slime King - Cast.png"); |
|
|
|
m.UpdateAnimation("monsters/Slime King - Cast.png"); |
|
|
|
|
|
|
|
if(m.F(A::CASTING_TIMER)==0){ |
|
|
|
|
|
|
|
m.SetState(State::NORMAL); |
|
|
|
|
|
|
|
m.I(A::JUMP_COUNT)++; |
|
|
|
|
|
|
|
float jumpTime=ConfigFloatArr("Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",0); |
|
|
|
|
|
|
|
float jumpSpd=ConfigFloatArr("Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",1); |
|
|
|
|
|
|
|
StartJump(jumpTime,game->GetPlayer()->GetPos(),0.2,jumpSpd); |
|
|
|
|
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -161,7 +169,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
} |
|
|
|
} |
|
|
|
if(m.F(A::SHOOT_RING_TIMER)==0){ |
|
|
|
if(m.F(A::SHOOT_RING_TIMER)==0){ |
|
|
|
if(m.I(A::PATTERN_REPEAT_COUNT)>=ConfigInt("Phase1.JumpAfter")){ |
|
|
|
if(m.I(A::PATTERN_REPEAT_COUNT)>=ConfigInt("Phase1.JumpAfter")){ |
|
|
|
StartJump(ConfigFloat("Phase1.AirborneTime"),game->GetPlayer()->GetPos(),ConfigFloat("Phase1.LandingRecoveryTime")); |
|
|
|
StartJump(ConfigFloat("Phase1.AirborneTime"),game->GetPlayer()->GetPos(),ConfigFloat("Phase1.LandingRecoveryTime"),ConfigFloat("JumpMoveSpd")); |
|
|
|
m.I(A::PATTERN_REPEAT_COUNT)=0; |
|
|
|
m.I(A::PATTERN_REPEAT_COUNT)=0; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -204,6 +212,8 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe |
|
|
|
} |
|
|
|
} |
|
|
|
if(m.I(A::PATTERN_REPEAT_COUNT)>ConfigInt("Phase2.ShootCount")){ |
|
|
|
if(m.I(A::PATTERN_REPEAT_COUNT)>ConfigInt("Phase2.ShootCount")){ |
|
|
|
m.I(A::PATTERN_REPEAT_COUNT)=0; |
|
|
|
m.I(A::PATTERN_REPEAT_COUNT)=0; |
|
|
|
|
|
|
|
m.I(A::JUMP_COUNT)=0; |
|
|
|
|
|
|
|
m.F(A::CASTING_TIMER)=5; |
|
|
|
m.SetState(State::CASTING); |
|
|
|
m.SetState(State::CASTING); |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|