Phase 1 Bullet shot pattern for Slime King implemented.
This commit is contained in:
+22
-10
@@ -10,10 +10,19 @@ 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);
|
||||
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);
|
||||
|
||||
auto ShootBulletRing=[&](float angleOffset){
|
||||
int bulletCount=ConfigInt("Phase1.RingBulletCount");
|
||||
for(int i=0;i<bulletCount;i++){
|
||||
float angle=((2*PI)/bulletCount)*i+angleOffset;
|
||||
BULLET_LIST.emplace_back(std::make_unique<Bullet>(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6}));
|
||||
}
|
||||
};
|
||||
|
||||
switch(m.phase){
|
||||
case 0:{
|
||||
@@ -28,20 +37,23 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
|
||||
m.phase=2;
|
||||
m.SetSize(ConfigFloat("Phase2.Size")/100,false);
|
||||
}
|
||||
if(m.GetFloat(Attribute::SHOOT_RING_TIMER)==0){
|
||||
if(m.F(A::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<bulletCount;i++){
|
||||
float angle=((2*PI)/bulletCount)*i;
|
||||
BULLET_LIST.emplace_back(std::make_unique<Bullet>(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6}));
|
||||
}
|
||||
ShootBulletRing(m.F(A::SHOOT_RING_OFFSET));
|
||||
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){
|
||||
if(m.I(A::SHOOT_RING_COUNTER)>0){
|
||||
if(m.F(A::SHOOT_RING_DELAY)==0){
|
||||
m.I(A::SHOOT_RING_COUNTER)--;
|
||||
m.F(A::SHOOT_RING_DELAY)=ConfigFloat("Phase1.ShootRingDelay");
|
||||
if(m.B(A::SHOOT_RING_RIGHT)){
|
||||
m.F(A::SHOOT_RING_OFFSET)+=util::degToRad(ConfigFloat("Phase1.RingOffset"));
|
||||
}else{
|
||||
m.F(A::SHOOT_RING_OFFSET)-=util::degToRad(ConfigFloat("Phase1.RingOffset"));
|
||||
}
|
||||
ShootBulletRing(m.F(A::SHOOT_RING_OFFSET));
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
Reference in New Issue
Block a user