diff --git a/Crawler/Animation.cpp b/Crawler/Animation.cpp index e5e64e10..365de1ae 100644 --- a/Crawler/Animation.cpp +++ b/Crawler/Animation.cpp @@ -197,6 +197,8 @@ void sig::Animation::InitializeAnimations(){ CreateHorizontalAnimationSequence("lightning_splash_effect.png",5,{24,24}); + CreateHorizontalAnimationSequence("monsters/Slime King - Cast.png",10,{24,24}); + CreateStillAnimation("meteor.png",{192,192}); for(int i=0;i<5;i++){ diff --git a/Crawler/MonsterAttribute.h b/Crawler/MonsterAttribute.h index b35159b1..9b896196 100644 --- a/Crawler/MonsterAttribute.h +++ b/Crawler/MonsterAttribute.h @@ -21,4 +21,5 @@ enum class Attribute{ JUMP_ORIGINAL_POS, RECOVERY_TIME, SHOOT_ANIMATION_TIME, + SHOOT_TIMER, }; \ No newline at end of file diff --git a/Crawler/SlimeKing.cpp b/Crawler/SlimeKing.cpp index 9dc30f14..5b7b8efe 100644 --- a/Crawler/SlimeKing.cpp +++ b/Crawler/SlimeKing.cpp @@ -19,6 +19,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe float bulletSpd=ConfigFloat("BulletSpd")/100*24; + m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-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); m.F(A::JUMP_LANDING_TIMER)=std::max(0.f,m.F(A::JUMP_LANDING_TIMER)-fElapsedTime); @@ -138,13 +139,18 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe return; } + if(m.state==State::CASTING){ + m.UpdateAnimation("monsters/Slime King - Cast.png"); + return; + } + 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; + m.phase=ConfigInt("StartPhase"); }break; case 1:{ if(m.hp<=m.maxhp*ConfigFloat("Phase2.Change")/100){ @@ -186,6 +192,20 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe TransitionPhase(m.phase); return; } + if(m.F(A::SHOOT_TIMER)==0){ + m.F(A::SHOOT_TIMER)=ConfigInt("Phase2.ShootRate"); + m.I(A::PATTERN_REPEAT_COUNT)++; + int bulletCount=ConfigInt("Phase2.ShootProjectileCount"); + for(int i=0;iGetPlayer()->GetPos()); + float angle=(i-(bulletCount/2))*util::degToRad(ConfigFloat("Phase2.ShootAngleSpread"))+initialAngle; + BULLET_LIST.emplace_back(std::make_unique(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6})); + } + } + if(m.I(A::PATTERN_REPEAT_COUNT)>ConfigInt("Phase2.ShootCount")){ + m.I(A::PATTERN_REPEAT_COUNT)=0; + m.SetState(State::CASTING); + } }break; case 3:{ if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){ diff --git a/Crawler/Version.h b/Crawler/Version.h index 0bb38e2f..b48d2554 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 1364 +#define VERSION_BUILD 1371 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/MonsterStrategies.txt b/Crawler/assets/config/MonsterStrategies.txt index 82664907..2cf3b4aa 100644 --- a/Crawler/assets/config/MonsterStrategies.txt +++ b/Crawler/assets/config/MonsterStrategies.txt @@ -74,6 +74,8 @@ MonsterStrategy { # The Slime King Boss script. Name = Slime King + # Which phase to start on. Should be 1 most of the time. + StartPhase = 1 # How much time a jump will be pre-telegraphed. JumpWarningIndicatorTime = 1.0 # Distance to jump up into the sky. A higher value causes it to launch up and down seemingly faster. diff --git a/Crawler/assets/config/Monsters.txt b/Crawler/assets/config/Monsters.txt index ceadcb00..1df2a201 100644 --- a/Crawler/assets/config/Monsters.txt +++ b/Crawler/assets/config/Monsters.txt @@ -139,6 +139,7 @@ Monsters Size = 800 Strategy = Slime King + StartPhase = 2 #Size of each animation frame SheetFrameSize = 24,24 @@ -150,6 +151,6 @@ Monsters DeathAnimation = 10, 0.1, OneShot #Additional custom animations go down below. Start with ANIMATION[0] - #ANIMATION[0] = MY_NEW_ANIMATION + ANIMATION[0] = monsters/Slime King - Cast.png } } \ No newline at end of file diff --git a/Crawler/assets/config/gfx/gfx.txt b/Crawler/assets/config/gfx/gfx.txt index 38b8bfe0..a2956f0b 100644 --- a/Crawler/assets/config/gfx/gfx.txt +++ b/Crawler/assets/config/gfx/gfx.txt @@ -35,4 +35,5 @@ Images GFX_Splash_Effect = splash_effect.png GFX_Warrior_Sheet = nico-warrior.png GFX_Wizard_Sheet = nico-wizard.png + GFX_SlimeKing_Cast = monsters/Slime King - Cast.png } \ No newline at end of file diff --git a/Crawler/assets/monsters/Slime King - Cast.png b/Crawler/assets/monsters/Slime King - Cast.png new file mode 100644 index 00000000..1e29014f Binary files /dev/null and b/Crawler/assets/monsters/Slime King - Cast.png differ diff --git a/Crawler/utils.cpp b/Crawler/utils.cpp index 94eb7383..a368bddf 100644 --- a/Crawler/utils.cpp +++ b/Crawler/utils.cpp @@ -8,6 +8,10 @@ vf2d util::pointTo(vf2d posFrom,vf2d posTo){ return geom2d::line(posFrom,posTo).vector().norm(); } +float util::angleTo(vf2d posFrom,vf2d posTo){ + return geom2d::line(posFrom,posTo).vector().polar().y; +} + float util::degToRad(float deg){ return deg*(PI/180); } diff --git a/Crawler/utils.h b/Crawler/utils.h index e9576924..42e2763b 100644 --- a/Crawler/utils.h +++ b/Crawler/utils.h @@ -6,6 +6,8 @@ namespace util{ float random(float range); //Returns a normalized vector pointing from posFrom towards posTo. vf2d pointTo(vf2d posFrom,vf2d posTo); + //Returns the angle (in radians) pointing from posFrom towards posTo. + float angleTo(vf2d posFrom,vf2d posTo); float degToRad(float deg); float radToDeg(float rad); float lerp(float n1,float n2,double t);