|
|
@ -114,6 +114,7 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy |
|
|
|
m.PerformOtherAnimation(2); |
|
|
|
m.PerformOtherAnimation(2); |
|
|
|
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime); |
|
|
|
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma region Environment Color Change Handling |
|
|
|
m.F(A::ENVIRONMENT_TIMER)=std::max(0.f,m.F(A::ENVIRONMENT_TIMER)-fElapsedTime); |
|
|
|
m.F(A::ENVIRONMENT_TIMER)=std::max(0.f,m.F(A::ENVIRONMENT_TIMER)-fElapsedTime); |
|
|
|
switch(m.I(A::ENVIRONMENT_PHASE)){ |
|
|
|
switch(m.I(A::ENVIRONMENT_PHASE)){ |
|
|
|
case 0:{ //Fade out.
|
|
|
|
case 0:{ //Fade out.
|
|
|
@ -138,6 +139,7 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#pragma endregion |
|
|
|
|
|
|
|
|
|
|
|
if(m.I(A::PHASE_REPEAT_COUNT)>0){ |
|
|
|
if(m.I(A::PHASE_REPEAT_COUNT)>0){ |
|
|
|
if(m.F(A::SHOOT_TIMER)==0.f){ |
|
|
|
if(m.F(A::SHOOT_TIMER)==0.f){ |
|
|
@ -174,19 +176,94 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy |
|
|
|
m.I(A::PHASE_REPEAT_COUNT)--; |
|
|
|
m.I(A::PHASE_REPEAT_COUNT)--; |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto TransitionToPhase3=[&](){ |
|
|
|
|
|
|
|
m.phase=3; |
|
|
|
|
|
|
|
game->SetWorldColor(ConfigPixel("Phase 3.Environment Fade-In Color")); |
|
|
|
|
|
|
|
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 3.Environment Fade-in Time"); |
|
|
|
|
|
|
|
m.I(A::ENVIRONMENT_PHASE)=0; |
|
|
|
|
|
|
|
m.RemoveBuff(BARRIER_DAMAGE_REDUCTION); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if(m.F(A::RECOVERY_TIME)==0.f){ |
|
|
|
if(m.F(A::RECOVERY_TIME)==0.f){ |
|
|
|
if(ConfigFloat("Phase 2.Wisp Count Phase Change Wait")==0.f)m.phase=3; |
|
|
|
if(ConfigFloat("Phase 2.Wisp Count Phase Change Wait")==0.f){ |
|
|
|
|
|
|
|
TransitionToPhase3(); |
|
|
|
|
|
|
|
} |
|
|
|
m.F(A::RECOVERY_TIME)=ConfigFloat("Phase 2.Wisp Count Phase Change Wait"); |
|
|
|
m.F(A::RECOVERY_TIME)=ConfigFloat("Phase 2.Wisp Count Phase Change Wait"); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
m.F(A::RECOVERY_TIME)-=fElapsedTime; |
|
|
|
m.F(A::RECOVERY_TIME)-=fElapsedTime; |
|
|
|
if(m.F(A::RECOVERY_TIME)<=0.f){ |
|
|
|
if(m.F(A::RECOVERY_TIME)<=0.f){ |
|
|
|
m.phase=3; |
|
|
|
TransitionToPhase3(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case 3:{ |
|
|
|
case 3:{ |
|
|
|
|
|
|
|
#pragma region Environment Color Change Handling |
|
|
|
|
|
|
|
m.F(A::ENVIRONMENT_TIMER)=std::max(0.f,m.F(A::ENVIRONMENT_TIMER)-fElapsedTime); |
|
|
|
|
|
|
|
switch(m.I(A::ENVIRONMENT_PHASE)){ |
|
|
|
|
|
|
|
case 0:{ //Fade out. Use the phase 2 environment fade-in color as the previous color to lerp out from.
|
|
|
|
|
|
|
|
game->SetWorldColor(ConfigPixel("Phase 2.Environment Fade-In Color")*util::lerp(0.f,1.0f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 3.Environment Fade-out Time"))); |
|
|
|
|
|
|
|
if(m.F(A::ENVIRONMENT_TIMER)==0.f){ |
|
|
|
|
|
|
|
game->SetWorldColor({0,0,0,255}); |
|
|
|
|
|
|
|
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 3.Environment Fade-in Time"); |
|
|
|
|
|
|
|
m.I(A::ENVIRONMENT_PHASE)++; |
|
|
|
|
|
|
|
game->SetWorldColorFunc([&](vi2d pos){return game->GetWorldColor();}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case 1:{ //Fade in.
|
|
|
|
|
|
|
|
Pixel fadeInCol=ConfigPixel("Phase 3.Environment Fade-In Color"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
game->SetWorldColor(fadeInCol*util::lerp(1.f,0.f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 3.Environment Fade-in Time"))); |
|
|
|
|
|
|
|
if(m.F(A::ENVIRONMENT_TIMER)==0.f){ |
|
|
|
|
|
|
|
game->SetWorldColor(fadeInCol); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#pragma endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float distToPlayer=geom2d::line<float>(game->GetPlayer()->GetPos(),m.GetPos()).length(); |
|
|
|
|
|
|
|
m.F(A::CHARGE_COOLDOWN)=std::max(0.f,m.F(A::CHARGE_COOLDOWN)-fElapsedTime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(m.I(A::PHASE)!=0)goto bear2; //Prevent doing anything else if a part of bear AI is still running.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(distToPlayer>=ConfigFloat("Phase 3.Charge Range")/100.f*24.f&&m.F(A::CHARGE_COOLDOWN)==0.f){ |
|
|
|
|
|
|
|
if(ConfigFloat("Phase 3.Charge Cast Time")!=0.f){ |
|
|
|
|
|
|
|
if(m.F(A::CASTING_TIMER)==0.f)m.F(A::CASTING_TIMER)=ConfigFloat("Phase 3.Charge Cast Time"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(m.F(A::CASTING_TIMER)>0.f){ |
|
|
|
|
|
|
|
m.F(A::CASTING_TIMER)=std::max(0.f,m.F(A::CASTING_TIMER)-fElapsedTime); |
|
|
|
|
|
|
|
if(m.F(A::CASTING_TIMER)==0.f){ |
|
|
|
|
|
|
|
m.phase=4; |
|
|
|
|
|
|
|
m.AddBuff(SPEEDBOOST,10.f,ConfigFloat("Phase 3.Charge Speed Boost")/100.f); |
|
|
|
|
|
|
|
m.AddBuff(FIXED_COLLISION_DMG,10.f,ConfigFloat("Phase 3.Charge Attack Damage")); |
|
|
|
|
|
|
|
m.AddBuff(COLLISION_KNOCKBACK_STRENGTH,10.f,ConfigFloat("Phase 3.Charge Attack Knockback Strength")); |
|
|
|
|
|
|
|
m.target=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).upoint(2.0f); |
|
|
|
|
|
|
|
m.F(A::CHARGE_COOLDOWN)=ConfigFloat("Phase 3.Charge Attack Cooldown"); |
|
|
|
|
|
|
|
m.PerformOtherAnimation(3); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bear2: |
|
|
|
|
|
|
|
BEAR(m,fElapsedTime,"Bear"); |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case 4:{ //A charging phase.
|
|
|
|
|
|
|
|
if(geom2d::line(m.pos,m.target).length()>100*fElapsedTime*m.GetMoveSpdMult()){ |
|
|
|
|
|
|
|
vf2d newPos=m.pos+geom2d::line(m.pos,m.target).vector().norm()*100*fElapsedTime*m.GetMoveSpdMult(); |
|
|
|
|
|
|
|
m.SetPos(newPos); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float distToTarget=geom2d::line<float>(m.target,m.GetPos()).length(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(distToTarget<=4.f){ |
|
|
|
|
|
|
|
m.phase=3; |
|
|
|
|
|
|
|
m.RemoveBuff(SPEEDBOOST); |
|
|
|
|
|
|
|
m.RemoveBuff(FIXED_COLLISION_DMG); |
|
|
|
|
|
|
|
m.RemoveBuff(COLLISION_KNOCKBACK_STRENGTH); |
|
|
|
|
|
|
|
m.PerformIdleAnimation(); |
|
|
|
|
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
default:{ |
|
|
|
default:{ |
|
|
|
ERR(std::format("WARNING! Unknown phase {} for {} reached!",m.phase,m.GetName())); |
|
|
|
ERR(std::format("WARNING! Unknown phase {} for {} reached!",m.phase,m.GetName())); |
|
|
|