Player gains iframes if getting hit by ground slam to prevent insta-gibbing via the spawned bullet ring.

pull/28/head
sigonasr2 1 year ago
parent 0d6b6584d5
commit 3c3d32bf7e
  1. 11
      Crawler/Player.cpp
  2. 3
      Crawler/Player.h
  3. 1
      Crawler/SlimeKing.cpp
  4. 2
      Crawler/Version.h

@ -6,6 +6,7 @@
#include "BulletTypes.h" #include "BulletTypes.h"
#include "DEFINES.h" #include "DEFINES.h"
#include "safemap.h" #include "safemap.h"
#include "utils.h"
INCLUDE_MONSTER_DATA INCLUDE_MONSTER_DATA
INCLUDE_MONSTER_LIST INCLUDE_MONSTER_LIST
@ -310,7 +311,11 @@ void Player::Update(float fElapsedTime){
} }
geom2d::line line(pos,m.GetPos()); geom2d::line line(pos,m.GetPos());
float dist = line.length(); float dist = line.length();
m.SetPos(line.rpoint(dist*1.1)); if(dist<=0.001){
m.SetPos(m.GetPos()+vf2d{util::random(2)-1,util::random(2)-1});
}else{
m.SetPos(line.rpoint(dist*1.1));
}
if(m.IsAlive()){ if(m.IsAlive()){
vel=line.vector().norm()*-128; vel=line.vector().norm()*-128;
} }
@ -678,4 +683,8 @@ void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){
UpdateAnimation("RANGER_SHOOT_N"); UpdateAnimation("RANGER_SHOOT_N");
} }
} }
}
void Player::SetIframes(float duration){
iframe_time=duration;
} }

@ -53,6 +53,7 @@ private:
float lastHitTimer=0; //When this is greater than zero, if we get hit again it adds to our displayed combo number. float lastHitTimer=0; //When this is greater than zero, if we get hit again it adds to our displayed combo number.
std::shared_ptr<DamageNumber>damageNumberPtr; std::shared_ptr<DamageNumber>damageNumberPtr;
void Initialize(); void Initialize();
float iframe_time=0;
protected: protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;
@ -71,7 +72,6 @@ protected:
bool SetPos(vf2d pos); bool SetPos(vf2d pos);
float friction="Player.Friction"_F; float friction="Player.Friction"_F;
float attack_cooldown_timer=0; float attack_cooldown_timer=0;
float iframe_time=0;
float teleportAnimationTimer=0; float teleportAnimationTimer=0;
vf2d teleportTarget={}; vf2d teleportTarget={};
vf2d teleportStartPosition={}; vf2d teleportStartPosition={};
@ -131,6 +131,7 @@ public:
bool CanAct(); bool CanAct();
bool CanAct(Ability&ability); bool CanAct(Ability&ability);
void Knockback(vf2d vel); void Knockback(vf2d vel);
void SetIframes(float duration);
void AddBuff(BuffType type,float duration,float intensity); void AddBuff(BuffType type,float duration,float intensity);
std::vector<Buff>GetBuffs(BuffType buff); std::vector<Buff>GetBuffs(BuffType buff);

@ -124,6 +124,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
lineToPlayer={m.GetPos(),m.GetPos()+vf2d{cos(randomDir),sin(randomDir)}*1}; lineToPlayer={m.GetPos(),m.GetPos()+vf2d{cos(randomDir),sin(randomDir)}*1};
} }
game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*ConfigInt("JumpKnockbackFactor")); game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*ConfigInt("JumpKnockbackFactor"));
game->GetPlayer()->SetIframes(1);
} }
Landed(m.phase); Landed(m.phase);
m.SetStrategyDrawFunction([](Crawler*game){}); m.SetStrategyDrawFunction([](Crawler*game){});

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 1362 #define VERSION_BUILD 1364
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save