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