Fix Ranger's Rapid Fire and Multi Shot abilities not abiding by the new Arrow constructor. Arrows once again have the correct acceleration and can hit monsters. Fix bug with knockback being applied while the player has iframes. Fix bug with Slime King constantly applying knockback to the player due to no iframes. Release Build 9152.

This commit is contained in:
sigonasr2 2024-04-29 00:48:51 -05:00
parent aa9c818773
commit aaaf10f6fc
6 changed files with 12 additions and 8 deletions

View File

@ -305,8 +305,10 @@ State::State Player::GetState(){
} }
void Player::Knockback(vf2d vel){ void Player::Knockback(vf2d vel){
if(!HasIframes()){
this->vel+=vel; this->vel+=vel;
} }
}
void Player::Update(float fElapsedTime){ void Player::Update(float fElapsedTime){
Ability&rightClickAbility=GetRightClickAbility(), Ability&rightClickAbility=GetRightClickAbility(),
@ -678,7 +680,7 @@ void Player::Update(float fElapsedTime){
vf2d extendedLine=pointTowardsCursor.upoint(1.1f); vf2d extendedLine=pointTowardsCursor.upoint(1.1f);
float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x); float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x);
attack_cooldown_timer=ARROW_ATTACK_COOLDOWN; attack_cooldown_timer=ARROW_ATTACK_COOLDOWN;
BULLET_LIST.push_back(std::make_unique<Arrow>(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F-PI/8*"Ranger.Ability 1.ArrowSpd"_F)}+movementVelocity/1.5f,12*"Ranger.Ability 1.ArrowRadius"_F/100,int(GetAttack()*"Ranger.Ability 1.DamageMult"_F),OnUpperLevel(),true))); BULLET_LIST.push_back(std::make_unique<Arrow>(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F-PI/8*"Ranger.Ability 1.ArrowSpd"_F)}+movementVelocity/1.5f,PI/2*"Ranger.Auto Attack.ArrowSpd"_F,12*"Ranger.Ability 1.ArrowRadius"_F/100,int(GetAttack()*"Ranger.Ability 1.DamageMult"_F),OnUpperLevel(),true)));
SetAnimationBasedOnTargetingDirection(angleToCursor); SetAnimationBasedOnTargetingDirection(angleToCursor);
rapidFireTimer=RAPID_FIRE_SHOOT_DELAY; rapidFireTimer=RAPID_FIRE_SHOOT_DELAY;
}else{ }else{

View File

@ -139,7 +139,7 @@ void Ranger::InitializeClassAbilities(){
const float newAngle=shootingAngle+leftAngle/2+i*increment; const float newAngle=shootingAngle+leftAngle/2+i*increment;
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist); geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
vf2d extendedLine=pointTowardsCursor.upoint(1.1f); vf2d extendedLine=pointTowardsCursor.upoint(1.1f);
BULLET_LIST.push_back(std::make_unique<Arrow>(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,12*"Ranger.Ability 3.ArrowRadius"_F/100,int(p->GetAttack()*"Ranger.Ability 3.DamageMult"_F),p->OnUpperLevel(),true))); BULLET_LIST.push_back(std::make_unique<Arrow>(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,PI/2*"Ranger.Auto Attack.ArrowSpd"_F,12*"Ranger.Ability 3.ArrowRadius"_F/100,int(p->GetAttack()*"Ranger.Ability 3.DamageMult"_F),p->OnUpperLevel(),true)));
} }
p->rangerShootAnimationTimer=0.3f; p->rangerShootAnimationTimer=0.3f;
p->SetState(State::SHOOT_ARROW); p->SetState(State::SHOOT_ARROW);

View File

@ -211,8 +211,10 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
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()*float(ConfigInt("JumpKnockbackFactor"))); game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*float(ConfigInt("JumpKnockbackFactor")));
if(m.phase!=2){ //In phase 2, the player can get slammed multiple times. No iframes for messing up. if(m.phase!=2){
game->GetPlayer()->SetIframes(1); game->GetPlayer()->SetIframes(1.f);
}else{ //In phase 2 you can get hit by multiple knockbacks, so the iframe time is a lot shorter.
game->GetPlayer()->SetIframes(0.2f);
} }
} }
m.SetZ(0); m.SetZ(0);

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 9146 #define VERSION_BUILD 9153
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -68,7 +68,7 @@ Monsters
# The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator.
IDLE = 10, 0.1, Repeat IDLE = 10, 0.1, Repeat
JUMP = 10, 0.06, Repeat JUMP = 10, 0.06, Repeat
SHOOT = 10, 0.1, OneShot SHOOT = 10, 0.1, Repeat
DEATH = 10, 0.1, OneShot DEATH = 10, 0.1, OneShot
} }
@ -197,7 +197,7 @@ Monsters
# The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator.
IDLE = 7, 0.1, PingPong IDLE = 7, 0.1, PingPong
JUMP = 1, 0.1, OneShot JUMP = 1, 0.1, OneShot
SHOOT = 5, 0.1, OneShot SHOOT = 5, 0.1, Repeat
DEATH = 5, 0.2, OneShot DEATH = 5, 0.2, OneShot
} }