|
|
|
@ -195,7 +195,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
if(castInfo.castTimer<=0){ |
|
|
|
|
if(castPrepAbility->action(this,castInfo.castPos)){ |
|
|
|
|
castPrepAbility->cooldown=castPrepAbility->COOLDOWN_TIME; |
|
|
|
|
mana-=castPrepAbility->manaCost; |
|
|
|
|
ConsumeMana(castPrepAbility->manaCost); |
|
|
|
|
} |
|
|
|
|
castInfo.castTimer=0; |
|
|
|
|
SetState(State::NORMAL); |
|
|
|
@ -203,7 +203,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
while(manaTickTimer<=0){ |
|
|
|
|
manaTickTimer+=0.2; |
|
|
|
|
mana=std::min(maxmana,mana+1); |
|
|
|
|
RestoreMana(1); |
|
|
|
|
} |
|
|
|
|
for(std::vector<Buff>::iterator it=buffList.begin();it!=buffList.end();++it){ |
|
|
|
|
Buff&b=*it; |
|
|
|
@ -365,7 +365,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
if(AllowedToCast(ability)&&ability.action(this,{})){ |
|
|
|
|
ability.cooldown=ability.COOLDOWN_TIME; |
|
|
|
|
mana-=ability.manaCost; |
|
|
|
|
ConsumeMana(ability.manaCost); |
|
|
|
|
}else |
|
|
|
|
if(ability.precastInfo.precastTargetingRequired&&GetState()==State::NORMAL){ |
|
|
|
|
PrepareCast(ability); |
|
|
|
@ -704,4 +704,12 @@ void Player::SetIframes(float duration){ |
|
|
|
|
bool Player::Heal(int damage){ |
|
|
|
|
hp=std::clamp(hp+damage,0,maxhp); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::RestoreMana(int amt){ |
|
|
|
|
mana=std::clamp(mana+amt,0,maxmana); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::ConsumeMana(int amt){ |
|
|
|
|
mana=std::clamp(mana-amt,0,maxmana); |
|
|
|
|
} |