#include "Monster.h" #include "MonsterStrategyHelpers.h" #include "DEFINES.h" #include "Crawler.h" #include "utils.h" INCLUDE_game INCLUDE_BULLET_LIST typedef Attribute A; void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumber){ float bulletSpd=ConfigFloat("BulletSpd")/100*24; m.F(Attribute::SHOOT_RING_TIMER)=std::max(0.f,m.F(Attribute::SHOOT_RING_TIMER)-fElapsedTime); m.F(Attribute::SHOOT_RING_DELAY)=std::max(0.f,m.F(Attribute::SHOOT_RING_DELAY)-fElapsedTime); switch(m.phase){ case 0:{ m.size=ConfigInt("Phase1.Size")/100; m.diesNormally=false; m.F(A::IFRAME_TIME_UPON_HIT)=0; m.iframe_timer=ConfigFloat("Phase5.IframeTimePerHit"); m.phase=1; }break; case 1:{ if(m.hp<=m.maxhp*ConfigFloat("Phase2.Change")/100){ m.phase=2; m.SetSize(ConfigFloat("Phase2.Size")/100,false); } if(m.GetFloat(Attribute::SHOOT_RING_TIMER)==0){ m.I(A::SHOOT_RING_COUNTER)=ConfigInt("Phase1.ShootRingCount")-1; m.F(A::SHOOT_RING_DELAY)=ConfigFloat("Phase1.ShootRingDelay"); int bulletCount=ConfigInt("Phase1.RingBulletCount"); for(int i=0;i(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6})); } m.F(A::SHOOT_RING_TIMER)=ConfigFloat("Phase1.ShootRepeatTime"); m.B(A::SHOOT_RING_RIGHT)=bool(rand()%2); } if(m.GetInt(Attribute::SHOOT_RING_COUNTER)>0){ if(m.GetFloat(Attribute::SHOOT_RING_DELAY)==0){ m.I(A::SHOOT_RING_COUNTER)--; } } }break; case 2:{ if(m.hp<=m.maxhp*ConfigFloat("Phase3.Change")/100){ m.phase=3; m.SetSize(ConfigFloat("Phase3.Size")/100,false); } }break; case 3:{ if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){ m.phase=4; m.SetSize(ConfigFloat("Phase4.Size")/100,false); } }break; case 4:{ if(m.hp<=0){ m.phase=5; m.F(A::IFRAME_TIME_UPON_HIT)=1; } }break; } }