diff --git a/Crawler/DEFINES.h b/Crawler/DEFINES.h index 37c07a6d..3e28d55f 100644 --- a/Crawler/DEFINES.h +++ b/Crawler/DEFINES.h @@ -16,6 +16,8 @@ #define ACCESS_PLAYER Player*p=game->GetPlayer(); +#define VARIANTS float,int,std::string,bool,vf2d + #define INFINITE 999999 #define SETUP_CLASS(class) \ diff --git a/Crawler/Monster.cpp b/Crawler/Monster.cpp index f4963b5a..291949f8 100644 --- a/Crawler/Monster.cpp +++ b/Crawler/Monster.cpp @@ -7,6 +7,7 @@ #include "safemap.h" #include "MonsterStrategyHelpers.h" #include "utils.h" +#include "MonsterAttribute.h" INCLUDE_ANIMATION_DATA INCLUDE_MONSTER_DATA diff --git a/Crawler/Monster.h b/Crawler/Monster.h index 81dd6607..bf64b1f0 100644 --- a/Crawler/Monster.h +++ b/Crawler/Monster.h @@ -5,12 +5,14 @@ #include "Buff.h" #include "olcUTIL_Animate2D.h" #include "DamageNumber.h" +#include "DEFINES.h" #include -#include "MonsterAttribute.h" struct Player; class Crawler; +enum class Attribute; + enum MonsterAnimation{ IDLE, JUMP, diff --git a/Crawler/MonsterAttribute.h b/Crawler/MonsterAttribute.h index eefef509..b1e527c7 100644 --- a/Crawler/MonsterAttribute.h +++ b/Crawler/MonsterAttribute.h @@ -1,5 +1,4 @@ #pragma once -#define VARIANTS float,int,std::string,bool,vf2d #include #define F(attr) GetFloat(attr) #define I(attr) GetInt(attr) @@ -25,7 +24,7 @@ enum class Attribute{ JUMP_MOVE_SPD, JUMP_COUNT, CASTING_TIMER, - TELEPORT_TO_PLAYER, RUN_AWAY_TIMER, PHASE_REPEAT_COUNT, + JUMP_TOWARDS_PLAYER, }; \ No newline at end of file diff --git a/Crawler/SlimeKing.cpp b/Crawler/SlimeKing.cpp index 0c92f83f..74134c21 100644 --- a/Crawler/SlimeKing.cpp +++ b/Crawler/SlimeKing.cpp @@ -6,6 +6,7 @@ #include "safemap.h" #include "Effect.h" #include "FallingDebris.h" +#include "MonsterAttribute.h" INCLUDE_game INCLUDE_BULLET_LIST @@ -15,8 +16,6 @@ INCLUDE_MONSTER_NAME_DATA typedef Attribute A; void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumber){ - - float bulletSpd=ConfigFloat("BulletSpd")/100*24; m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime); @@ -76,13 +75,22 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe } }; - const auto StartJump=[&](float jumpDuration,vf2d targetPos,float recoveryTime,float jumpMoveSpd,bool teleportToPlayer=false){ + const auto StartJumpTowardsPlayer=[&](float jumpDuration,float recoveryTime,float jumpMoveSpd){ + m.V(A::JUMP_ORIGINAL_POS)=m.GetPos(); + m.F(A::JUMP_ORIGINAL_LANDING_TIMER)=m.F(A::JUMP_LANDING_TIMER)=jumpDuration; + m.B(A::JUMP_TOWARDS_PLAYER)=true; + m.F(A::RECOVERY_TIME)=recoveryTime; + m.F(A::JUMP_MOVE_SPD)=jumpMoveSpd; + m.SetState(State::JUMP); + }; + + const auto StartJump=[&](float jumpDuration,vf2d targetPos,float recoveryTime,float jumpMoveSpd){ m.V(A::JUMP_ORIGINAL_POS)=m.GetPos(); m.F(A::JUMP_ORIGINAL_LANDING_TIMER)=m.F(A::JUMP_LANDING_TIMER)=jumpDuration; m.V(A::JUMP_TARGET_POS)=targetPos; + m.B(A::JUMP_TOWARDS_PLAYER)=false; m.F(A::RECOVERY_TIME)=recoveryTime; m.F(A::JUMP_MOVE_SPD)=jumpMoveSpd; - m.B(A::TELEPORT_TO_PLAYER)=teleportToPlayer; m.SetState(State::JUMP); }; @@ -95,8 +103,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe m.I(A::JUMP_COUNT)++; float jumpTime=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",0); float jumpSpd=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",1); - bool jumpTeleport=bool(ConfigIntArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",2)); - StartJump(jumpTime,game->GetPlayer()->GetPos(),0.2,jumpSpd,jumpTeleport); + StartJumpTowardsPlayer(jumpTime,0.2,jumpSpd); }break; default:{ m.PerformIdleAnimation(); @@ -124,17 +131,21 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe if(m.GetState()==State::JUMP){ float jumpLandingTimerRatio=m.F(A::JUMP_LANDING_TIMER)/m.F(A::JUMP_ORIGINAL_LANDING_TIMER); - if(m.GetPos().x>m.V(A::JUMP_TARGET_POS).x){ - m.SetX(std::max(m.V(A::JUMP_TARGET_POS).x,m.GetPos().x-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); + vf2d jumpTargetPos=m.V(A::JUMP_TARGET_POS); + if(m.B(A::JUMP_TOWARDS_PLAYER)){ + jumpTargetPos=game->GetPlayer()->GetPos(); + } + if(m.GetPos().x>jumpTargetPos.x){ + m.SetX(std::max(jumpTargetPos.x,m.GetPos().x-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); } else - if(m.GetPos().xGetElapsedTime())); + if(m.GetPos().xGetElapsedTime())); } if(m.GetPos().y>m.V(A::JUMP_TARGET_POS).y){ - m.SetY(std::max(m.V(A::JUMP_TARGET_POS).y,m.GetPos().y-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); + m.SetY(std::max(jumpTargetPos.y,m.GetPos().y-m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); } else if(m.GetPos().yGetElapsedTime())); + m.SetY(std::min(jumpTargetPos.y,m.GetPos().y+m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); } if(m.F(A::JUMP_LANDING_TIMER)>=m.F(A::JUMP_ORIGINAL_LANDING_TIMER)/2){ m.SetZ(util::lerp(0,ConfigInt("JumpHeight"),1-jumpLandingTimerRatio)); @@ -165,10 +176,6 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe m.SetStrategyDrawFunction([](Crawler*game){}); } else if(m.F(A::JUMP_LANDING_TIMER)<=ConfigFloat("JumpWarningIndicatorTime")){ - if(m.B(A::TELEPORT_TO_PLAYER)){ - m.B(A::TELEPORT_TO_PLAYER)=false; - m.SetPos(game->GetPlayer()->GetPos()); - } m.SetStrategyDrawFunction([&](Crawler*game){ Decal*dec=ANIMATION_DATA["range_indicator.png"].GetFrame(game->GetElapsedTime()).GetSourceImage()->Decal(); game->view.DrawRotatedDecal(m.GetPos(),dec,0,dec->sprite->Size()/2,vf2d{m.GetSizeMult(),m.GetSizeMult()},RED); @@ -184,7 +191,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe m.I(A::JUMP_COUNT)++; float jumpTime=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",0); float jumpSpd=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",1); - StartJump(jumpTime,game->GetPlayer()->GetPos(),0.2,jumpSpd); + StartJumpTowardsPlayer(jumpTime,0.2,jumpSpd); } return; } @@ -206,7 +213,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe } if(m.F(A::SHOOT_RING_TIMER)==0){ if(m.I(A::PATTERN_REPEAT_COUNT)>=ConfigInt("Phase1.JumpAfter")){ - StartJump(ConfigFloat("Phase1.AirborneTime"),game->GetPlayer()->GetPos(),ConfigFloat("Phase1.LandingRecoveryTime"),ConfigFloat("JumpMoveSpd")); + StartJumpTowardsPlayer(ConfigFloat("Phase1.AirborneTime"),ConfigFloat("Phase1.LandingRecoveryTime"),ConfigFloat("JumpMoveSpd")); m.I(A::PATTERN_REPEAT_COUNT)=0; return; } @@ -258,12 +265,12 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){ m.phase=4; m.SetSize(ConfigFloat("Phase4.Size")/100,false); - m.AddBuff(BuffType::SLOWDOWN,9999999,ConfigFloat("Phase4.MoveSpdModifier")/100); + m.AddBuff(BuffType::SLOWDOWN,99999,ConfigFloat("Phase4.MoveSpdModifier")/100); TransitionPhase(m.phase); return; } if(m.I(A::PATTERN_REPEAT_COUNT)==0){ - StartJump(ConfigFloat("Phase3.JumpDelayTime"),game->GetPlayer()->GetPos(),ConfigFloat("Phase3.JumpRecoveryTime"),ConfigFloat("Phase3.JumpMoveSpd")); + StartJumpTowardsPlayer(ConfigFloat("Phase3.JumpDelayTime"),ConfigFloat("Phase3.JumpRecoveryTime"),ConfigFloat("Phase3.JumpMoveSpd")); m.I(A::PATTERN_REPEAT_COUNT)++; }else if(m.I(A::PATTERN_REPEAT_COUNT)<4&&m.F(A::SHOOT_TIMER)==0){ diff --git a/Crawler/Turret.cpp b/Crawler/Turret.cpp index 00b184dc..e9a0930c 100644 --- a/Crawler/Turret.cpp +++ b/Crawler/Turret.cpp @@ -3,6 +3,7 @@ #include "DEFINES.h" #include "Crawler.h" #include "utils.h" +#include "MonsterAttribute.h" typedef Attribute A; diff --git a/Crawler/Version.h b/Crawler/Version.h index 547f7a21..1366b2cb 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 1400 +#define VERSION_BUILD 1407 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/MonsterStrategies.txt b/Crawler/assets/config/MonsterStrategies.txt index 0fbb5407..62cf74ea 100644 --- a/Crawler/assets/config/MonsterStrategies.txt +++ b/Crawler/assets/config/MonsterStrategies.txt @@ -118,10 +118,9 @@ MonsterStrategy # Argument 0 is jump time. # Argument 1 is move speed. - # Argument 2 is whether to teleport to the player or not (0=Don't Teleport, 1=Teleport) - Jump[1] = 2.0, 75, 0 - Jump[2] = 0.3, 300, 1 - Jump[3] = 1.2, 70, 0 + Jump[1] = 2.0, 75 + Jump[2] = 0.3, 850 + Jump[3] = 1.2, 70 } Phase3 {