diff --git a/Crawler/MonsterAttribute.h b/Crawler/MonsterAttribute.h index 42a1c4ea..ece168bf 100644 --- a/Crawler/MonsterAttribute.h +++ b/Crawler/MonsterAttribute.h @@ -12,4 +12,5 @@ enum class Attribute{ SHOOT_RING_DELAY, SHOOT_RING_COUNTER, SHOOT_RING_RIGHT, + SHOOT_RING_OFFSET, }; \ No newline at end of file diff --git a/Crawler/SlimeKing.cpp b/Crawler/SlimeKing.cpp index 3ccfb327..35011e1b 100644 --- a/Crawler/SlimeKing.cpp +++ b/Crawler/SlimeKing.cpp @@ -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(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(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; diff --git a/Crawler/Version.h b/Crawler/Version.h index 6ab6c27e..af864ac3 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -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 diff --git a/Crawler/assets/config/MonsterStrategies.txt b/Crawler/assets/config/MonsterStrategies.txt index 4284ea4b..bb784bd2 100644 --- a/Crawler/assets/config/MonsterStrategies.txt +++ b/Crawler/assets/config/MonsterStrategies.txt @@ -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 diff --git a/Crawler/utils.cpp b/Crawler/utils.cpp index f8a4bab6..cf1e2af4 100644 --- a/Crawler/utils.cpp +++ b/Crawler/utils.cpp @@ -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; } \ No newline at end of file diff --git a/Crawler/utils.h b/Crawler/utils.h index e694e790..2bf204c6 100644 --- a/Crawler/utils.h +++ b/Crawler/utils.h @@ -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); } \ No newline at end of file