Phase 1 Bullet shot pattern for Slime King implemented.
This commit is contained in:
parent
54e72d088e
commit
efdf696d2c
@ -12,4 +12,5 @@ enum class Attribute{
|
||||
SHOOT_RING_DELAY,
|
||||
SHOOT_RING_COUNTER,
|
||||
SHOOT_RING_RIGHT,
|
||||
SHOOT_RING_OFFSET,
|
||||
};
|
@ -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;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 1117
|
||||
#define VERSION_BUILD 1119
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -79,7 +79,7 @@ MonsterStrategy
|
||||
ProjectileDamage = 10
|
||||
JumpAttackDamage = 20
|
||||
|
||||
BulletSpd = 150
|
||||
BulletSpd = 250
|
||||
|
||||
Phase1
|
||||
{
|
||||
@ -90,7 +90,7 @@ MonsterStrategy
|
||||
ShootRingDelay = 0.2
|
||||
RingBulletCount = 16
|
||||
# In degrees.
|
||||
RingOffset = 10
|
||||
RingOffset = 10.0
|
||||
JumpAfter = 4 shots
|
||||
AirborneTime = 3.0
|
||||
LandingRingCount = 1
|
||||
|
@ -6,4 +6,12 @@ float util::random(float range){
|
||||
|
||||
vf2d util::pointTo(vf2d posFrom,vf2d posTo){
|
||||
return geom2d::line(posFrom,posTo).vector().norm();
|
||||
}
|
||||
|
||||
float util::degToRad(float deg){
|
||||
return deg*(PI/180);
|
||||
}
|
||||
|
||||
float util::radToDeg(float rad){
|
||||
return rad*57.2957795130823208767;
|
||||
}
|
@ -6,4 +6,6 @@ namespace util{
|
||||
float random(float range);
|
||||
//Returns a normalized vector pointing from posFrom towards posTo.
|
||||
vf2d pointTo(vf2d posFrom,vf2d posTo);
|
||||
float degToRad(float deg);
|
||||
float radToDeg(float rad);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user