Fix Stage Plates 2-6,2-7,2-8, and 2-B to point to their respective stages. Move the additional pillar spawning code outside of the regular boss' phase cycle since it's supposed to happen while the boss does other things according to the original spec. When new pillars appear/disappear, recalculate the safe areas dynamically. Release Build 9974.
This commit is contained in:
@@ -62,12 +62,15 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
|
||||
STONE_THROW_CAST,
|
||||
STONE_THROW_FINISH_ANIMATION,
|
||||
SHOCKWAVE,
|
||||
FIX_SAFE_AREAS,
|
||||
};
|
||||
|
||||
const auto PrepareSafeAreas=[&](){
|
||||
m.VEC(A::STAGE_POLYGONS).clear();
|
||||
std::for_each(MONSTER_LIST.begin(),MONSTER_LIST.end(),[&](const std::unique_ptr<Monster>&monsterPtr){
|
||||
if(monsterPtr->GetName()!="Stone Golem Pillar")return;
|
||||
if(monsterPtr->GetName()!="Stone Golem Pillar"&&monsterPtr->GetName()!="Breaking Stone Golem Pillar"){
|
||||
return;
|
||||
}
|
||||
const Monster&pillar=*monsterPtr;
|
||||
if(geom2d::overlaps(geom2d::circle<float>{m.GetPos(),m.GetCollisionRadius()},geom2d::circle<float>{pillar.GetPos(),pillar.GetCollisionRadius()}))return;
|
||||
|
||||
@@ -111,6 +114,45 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
|
||||
});
|
||||
};
|
||||
|
||||
#pragma region Respawn Pillar Actions
|
||||
switch(m.I(A::RESPAWN_PHASE)){
|
||||
case RESPAWN_PILLAR_PREPARE:{
|
||||
m.F(A::RESPAWN_RECOVERY_TIME)-=fElapsedTime;
|
||||
if(m.F(A::RESPAWN_RECOVERY_TIME)<=0.f){
|
||||
m.V(A::RESPAWN_LOCKON_POS)=game->GetPlayer()->GetPos();
|
||||
m.SIZET(A::RESPAWN_LOOPING_SOUND_ID)=SoundEffect::PlayLoopingSFX("Rock Toss Cast",m.GetPos());
|
||||
game->AddEffect(std::make_unique<SpellCircle>(m.V(A::RESPAWN_LOCKON_POS),ConfigFloat("Pillar Respawns.Cast Time"),"range_indicator.png","spell_insignia.png",m.OnUpperLevel(),vf2d{1.f,1.f}*(MONSTER_DATA.at("Stone Golem Pillar").GetCollisionRadius()*MONSTER_DATA.at("Stone Golem Pillar").GetSizeMult()/12.f)*1.25f,0.3f,vf2d{},ConfigPixel("Pillar Respawns.Spell Circle Color"),util::random(2*PI),util::degToRad(ConfigFloat("Pillar Respawns.Spell Circle Rotation Spd")),false,vf2d{1.f,1.f}*(MONSTER_DATA.at("Stone Golem Pillar").GetCollisionRadius()*MONSTER_DATA.at("Stone Golem Pillar").GetSizeMult()/12.f)*0.9f,0.3f,vf2d{},ConfigPixel("Pillar Respawns.Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Pillar Respawns.Spell Insignia Rotation Spd"))),true);
|
||||
m.F(A::RESPAWN_CASTING_TIMER)=ConfigFloat("Pillar Respawns.Cast Time");
|
||||
m.I(A::RESPAWN_PHASE)=RESPAWN_PILLAR_CAST;
|
||||
}
|
||||
}break;
|
||||
case RESPAWN_PILLAR_CAST:{
|
||||
m.F(A::RESPAWN_CASTING_TIMER)-=fElapsedTime;
|
||||
if(m.F(A::RESPAWN_CASTING_TIMER)<=0.f){
|
||||
SoundEffect::StopLoopingSFX(m.SIZET(A::RESPAWN_LOOPING_SOUND_ID));
|
||||
SoundEffect::PlaySFX("Pillar Rise",m.V(A::RESPAWN_LOCKON_POS));
|
||||
if(m.I(A::BAD_PILLAR_SPAWN_COUNT)>0&&
|
||||
(util::random_range(0,1)<0.5f||m.I(A::RESPAWN_PATTERN_REPEAT_COUNT)<=m.I(A::BAD_PILLAR_SPAWN_COUNT))){
|
||||
Monster&badPillar{game->SpawnMonster(m.V(A::RESPAWN_LOCKON_POS),MONSTER_DATA.at("Breaking Stone Golem Pillar"),m.OnUpperLevel())};
|
||||
game->Hurt(m.V(A::RESPAWN_LOCKON_POS),MONSTER_DATA.at("Breaking Stone Golem Pillar").GetCollisionRadius()*MONSTER_DATA.at("Breaking Stone Golem Pillar").GetSizeMult(),MONSTER_DATA.at("Breaking Stone Golem Pillar").GetAttack(),m.OnUpperLevel(),0.f,HurtType::PLAYER);
|
||||
badPillar._DealTrueDamage(badPillar.GetMaxHealth()-1U); //Force the health to be 1.
|
||||
m.I(A::BAD_PILLAR_SPAWN_COUNT)--;
|
||||
}else{
|
||||
game->Hurt(m.V(A::RESPAWN_LOCKON_POS),MONSTER_DATA.at("Stone Golem Pillar").GetCollisionRadius()*MONSTER_DATA.at("Stone Golem Pillar").GetSizeMult(),MONSTER_DATA.at("Stone Golem Pillar").GetAttack(),m.OnUpperLevel(),0.f,HurtType::PLAYER);
|
||||
game->SpawnMonster(m.V(A::RESPAWN_LOCKON_POS),MONSTER_DATA.at("Stone Golem Pillar"),m.OnUpperLevel());
|
||||
}
|
||||
m.I(A::RESPAWN_PATTERN_REPEAT_COUNT)--;
|
||||
if(m.I(A::RESPAWN_PATTERN_REPEAT_COUNT)<=0){
|
||||
m.I(A::RESPAWN_PHASE)=STANDARD;
|
||||
}else{
|
||||
m.F(A::RESPAWN_RECOVERY_TIME)=ConfigFloat("Pillar Respawns.Cast Delay Time");
|
||||
m.I(A::RESPAWN_PHASE)=RESPAWN_PILLAR_PREPARE;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
switch(m.phase){
|
||||
case INITIALIZE:{
|
||||
m.F(A::RECOVERY_TIME)=ConfigFloat("Beginning Phase.Pillar Cast Delay Time");
|
||||
@@ -132,17 +174,6 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
|
||||
m.phase=SPAWN_PILLAR_CAST;
|
||||
}
|
||||
}break;
|
||||
case RESPAWN_PILLAR_PREPARE:{
|
||||
m.F(A::RECOVERY_TIME)-=fElapsedTime;
|
||||
if(m.F(A::RECOVERY_TIME)<=0.f){
|
||||
m.V(A::LOCKON_POS)=game->GetPlayer()->GetPos();
|
||||
m.SIZET(A::LOOPING_SOUND_ID)=SoundEffect::PlayLoopingSFX("Rock Toss Cast",m.GetPos());
|
||||
m.PerformAnimation("CAST",m.GetFacingDirectionToTarget(m.V(A::LOCKON_POS)));
|
||||
game->AddEffect(std::make_unique<SpellCircle>(m.V(A::LOCKON_POS),ConfigFloat("Pillar Respawns.Cast Time"),"range_indicator.png","spell_insignia.png",m.OnUpperLevel(),vf2d{1.f,1.f}*(MONSTER_DATA.at("Stone Golem Pillar").GetCollisionRadius()*MONSTER_DATA.at("Stone Golem Pillar").GetSizeMult()/12.f)*1.25f,0.3f,vf2d{},ConfigPixel("Pillar Respawns.Spell Circle Color"),util::random(2*PI),util::degToRad(ConfigFloat("Pillar Respawns.Spell Circle Rotation Spd")),false,vf2d{1.f,1.f}*(MONSTER_DATA.at("Stone Golem Pillar").GetCollisionRadius()*MONSTER_DATA.at("Stone Golem Pillar").GetSizeMult()/12.f)*0.9f,0.3f,vf2d{},ConfigPixel("Pillar Respawns.Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Pillar Respawns.Spell Insignia Rotation Spd"))),true);
|
||||
m.F(A::CASTING_TIMER)=ConfigFloat("Pillar Respawns.Cast Time");
|
||||
m.phase=RESPAWN_PILLAR_CAST;
|
||||
}
|
||||
}break;
|
||||
case SPAWN_PILLAR_CAST:{
|
||||
m.F(A::CASTING_TIMER)-=fElapsedTime;
|
||||
if(m.F(A::CASTING_TIMER)<=0.f){
|
||||
@@ -160,36 +191,15 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case RESPAWN_PILLAR_CAST:{
|
||||
m.F(A::CASTING_TIMER)-=fElapsedTime;
|
||||
if(m.F(A::CASTING_TIMER)<=0.f){
|
||||
SoundEffect::StopLoopingSFX(m.SIZET(A::LOOPING_SOUND_ID));
|
||||
SoundEffect::PlaySFX("Pillar Rise",m.V(A::LOCKON_POS));
|
||||
if(m.I(A::BAD_PILLAR_SPAWN_COUNT)>0&&
|
||||
(util::random_range(0,1)<0.5f||m.I(A::PATTERN_REPEAT_COUNT)<=m.I(A::BAD_PILLAR_SPAWN_COUNT))){
|
||||
Monster&badPillar{game->SpawnMonster(m.V(A::LOCKON_POS),MONSTER_DATA.at("Breaking Stone Golem Pillar"),m.OnUpperLevel())};
|
||||
badPillar._DealTrueDamage(badPillar.GetMaxHealth()-1U); //Force the health to be 1.
|
||||
m.I(A::BAD_PILLAR_SPAWN_COUNT)--;
|
||||
}else game->SpawnMonster(m.V(A::LOCKON_POS),MONSTER_DATA.at("Stone Golem Pillar"),m.OnUpperLevel());
|
||||
m.I(A::PATTERN_REPEAT_COUNT)--;
|
||||
game->Hurt(m.V(A::LOCKON_POS),MONSTER_DATA.at("Stone Golem Pillar").GetCollisionRadius()*MONSTER_DATA.at("Stone Golem Pillar").GetSizeMult(),MONSTER_DATA.at("Stone Golem Pillar").GetAttack(),m.OnUpperLevel(),0.f,HurtType::PLAYER);
|
||||
if(m.I(A::PATTERN_REPEAT_COUNT)<=0){
|
||||
m.phase=STANDARD;
|
||||
}else{
|
||||
m.PerformIdleAnimation(m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
|
||||
m.F(A::RECOVERY_TIME)=ConfigFloat("Pillar Respawns.Cast Delay Time");
|
||||
m.phase=RESPAWN_PILLAR_PREPARE;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case STANDARD:{
|
||||
BEAR(m,fElapsedTime,"Bear");
|
||||
//Extending the bear script's variables to read the state of it...
|
||||
const bool SlamHasFinished=m.I(A::ATTACK_COUNT)!=m.I(A::BEAR_STOMP_COUNT);
|
||||
const bool SlamHasFinished=m.I(A::PHASE)==0; //The bear script uses the internal phase variable to determine the state of things.
|
||||
if(SlamHasFinished){
|
||||
if(m.F(A::HEALTH_PCT_PHASE)-m.GetHealthRatio()>=ConfigFloat("Shockwave.Repeating Threshold")/100.f){
|
||||
m.F(A::HEALTH_PCT_PHASE)-=ConfigFloat("Shockwave.Repeating Threshold")/100.f;
|
||||
m.F(A::CASTING_TIMER)=ConfigFloat("Shockwave.Cast Time");
|
||||
m.SIZET(A::PREVIOUS_MONSTER_COUNT)=MONSTER_LIST.size();
|
||||
PrepareSafeAreas();
|
||||
m.phase=SHOCKWAVE;
|
||||
break;
|
||||
@@ -197,11 +207,10 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
|
||||
if(m.F(A::NEXT_HEALTH_PCT_PILLAR_PHASE)>=m.GetHealthRatio()){
|
||||
m.F(A::NEXT_HEALTH_PCT_PILLAR_PHASE)-=ConfigFloat("Pillar Respawns.Repeating Threshold")/100.f;
|
||||
|
||||
m.F(A::RECOVERY_TIME)=ConfigFloat("Pillar Respawns.Cast Delay Time");
|
||||
m.I(A::PATTERN_REPEAT_COUNT)=ConfigIntArr("Pillar Respawns.Respawn Count",0);
|
||||
m.I(A::BAD_PILLAR_SPAWN_COUNT)=ConfigIntArr("Pillar Respawns.Respawn Count",1);
|
||||
m.phase=RESPAWN_PILLAR_PREPARE;
|
||||
break;
|
||||
m.F(A::RESPAWN_RECOVERY_TIME)=ConfigFloat("Pillar Respawns.Cast Delay Time");
|
||||
m.I(A::RESPAWN_PATTERN_REPEAT_COUNT)+=ConfigIntArr("Pillar Respawns.Respawn Count",0);
|
||||
m.I(A::BAD_PILLAR_SPAWN_COUNT)+=ConfigIntArr("Pillar Respawns.Respawn Count",1);
|
||||
m.I(A::RESPAWN_PHASE)=RESPAWN_PILLAR_PREPARE;
|
||||
}
|
||||
|
||||
const bool StoneThrowRollSucceeds=util::random(100.f)<=ConfigFloat("Standard Attack.Stone Throw Chance");
|
||||
@@ -245,6 +254,12 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
|
||||
newCol.a=util::lerp(255.f,210.f,sin(geom2d::pi*game->GetRunTime()*2)/2.f+0.5f);
|
||||
game->SetWorldColor(newCol);
|
||||
|
||||
if(m.SIZET(A::PREVIOUS_MONSTER_COUNT)!=MONSTER_LIST.size()){ //The monster list has changed...Whether it's a pillar getting added or removed, it's important we recalculate safe areas proper.
|
||||
m.phase=FIX_SAFE_AREAS; //HACK ALERT! Since spawning/removing monsters doesn't immediately occur in the MONSTER_LIST structure, we must defer the safe areas until the next tick and then recalculate them. To do this, we put the monster into another state and pause the shockwave attack for a frame to fix the new spawn areas on the next tick.
|
||||
m.F(A::SAFE_AREA_WAIT_TIMER)=0.01f;
|
||||
m.SIZET(A::PREVIOUS_MONSTER_COUNT)=MONSTER_LIST.size();
|
||||
}
|
||||
|
||||
if(m.F(A::CASTING_TIMER)<=0.f){
|
||||
game->SetupWorldShake(ConfigFloat("Shockwave.Shockwave Screen Shake Time"));
|
||||
bool playerIsSafe{false};
|
||||
@@ -273,5 +288,11 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
|
||||
game->SetWorldColor(WHITE);
|
||||
}
|
||||
}break;
|
||||
case FIX_SAFE_AREAS:{
|
||||
if(m.F(A::SAFE_AREA_WAIT_TIMER)<=0.f){
|
||||
PrepareSafeAreas(); //Recalculate safe areas if the shockwave attack is going off.
|
||||
m.phase=SHOCKWAVE;
|
||||
}else m.F(A::SAFE_AREA_WAIT_TIMER)-=fElapsedTime;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user