|
|
|
@ -139,7 +139,10 @@ int Player::GetAttack(){ |
|
|
|
|
float Player::GetMoveSpdMult(){ |
|
|
|
|
float mod_moveSpd=moveSpd; |
|
|
|
|
for(Buff&b:GetBuffs(BuffType::SLOWDOWN)){ |
|
|
|
|
mod_moveSpd-=moveSpd*b.intensity; |
|
|
|
|
mod_moveSpd-=mod_moveSpd*b.intensity; |
|
|
|
|
} |
|
|
|
|
for(Buff&b:GetBuffs(BuffType::BLOCK_SLOWDOWN)){ |
|
|
|
|
mod_moveSpd-=mod_moveSpd*b.intensity; |
|
|
|
|
} |
|
|
|
|
return mod_moveSpd; |
|
|
|
|
} |
|
|
|
@ -171,6 +174,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
notEnoughManaDisplay.second=std::max(0.f,notEnoughManaDisplay.second-fElapsedTime); |
|
|
|
|
notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime); |
|
|
|
|
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime); |
|
|
|
|
blockTimer=std::max(0.f,blockTimer-fElapsedTime); |
|
|
|
|
manaTickTimer-=fElapsedTime; |
|
|
|
|
if(castInfo.castTimer>0){ |
|
|
|
|
castInfo.castTimer-=fElapsedTime; |
|
|
|
@ -237,7 +241,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
animation.UpdateState(internal_animState,fElapsedTime); |
|
|
|
|
}break; |
|
|
|
|
case BLOCK:{ |
|
|
|
|
if(rightClickAbility.COOLDOWN_TIME-rightClickAbility.cooldown>"Warrior.Right Click Ability.Duration"_F){ |
|
|
|
|
if(blockTimer<=0){ |
|
|
|
|
SetState(NORMAL); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
@ -457,6 +461,9 @@ void Player::SetSwordSwingTimer(float val){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::SetState(State newState){ |
|
|
|
|
if(GetState()==State::BLOCK){ |
|
|
|
|
RemoveAllBuffs(BuffType::BLOCK_SLOWDOWN); |
|
|
|
|
} |
|
|
|
|
state=newState; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -474,7 +481,7 @@ bool Player::HasIframes(){ |
|
|
|
|
|
|
|
|
|
bool Player::Hurt(int damage,bool onUpperLevel){ |
|
|
|
|
if(hp<=0||iframe_time!=0||OnUpperLevel()!=onUpperLevel) return false; |
|
|
|
|
if(state==State::BLOCK)damage*=1-"Warrior.Right Click Ability.DamageReduction"_F; |
|
|
|
|
if(GetState()==State::BLOCK)damage*=1-"Warrior.Right Click Ability.DamageReduction"_F; |
|
|
|
|
float mod_dmg=damage; |
|
|
|
|
for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){ |
|
|
|
|
mod_dmg-=damage*b.intensity; |
|
|
|
@ -542,7 +549,7 @@ void Player::Moved(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::Spin(float duration,float spinSpd){ |
|
|
|
|
state=State::SPIN; |
|
|
|
|
SetState(State::SPIN); |
|
|
|
|
spin_attack_timer=duration; |
|
|
|
|
spin_spd=spinSpd; |
|
|
|
|
spin_angle=0; |
|
|
|
@ -584,6 +591,24 @@ std::vector<Buff>Player::GetBuffs(BuffType buff){ |
|
|
|
|
return filteredBuffs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::RemoveBuff(BuffType buff){ |
|
|
|
|
for(auto it=buffList.begin();it!=buffList.end();++it){ |
|
|
|
|
Buff&b=*it; |
|
|
|
|
if(b.type==buff){ |
|
|
|
|
buffList.erase(it); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::RemoveAllBuffs(BuffType buff){ |
|
|
|
|
std::erase_if(buffList,[&](Buff&b){return b.type==buff;}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::RemoveAllBuffs(){ |
|
|
|
|
buffList.clear(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::CastSpell(Ability&ability){ |
|
|
|
|
vf2d castPosition=game->GetWorldMousePos(); |
|
|
|
|
float distance=sqrt(pow(GetX()-game->GetWorldMousePos().x,2)+pow(GetY()-game->GetWorldMousePos().y,2)); |
|
|
|
|