|
|
|
@ -163,7 +163,17 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
notEnoughManaDisplay.second=std::max(0.f,notEnoughManaDisplay.second-fElapsedTime); |
|
|
|
|
notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime); |
|
|
|
|
manaTickTimer-=fElapsedTime; |
|
|
|
|
castInfo.castTimer=std::max(0.f,castInfo.castTimer-fElapsedTime); |
|
|
|
|
if(castInfo.castTimer>0){ |
|
|
|
|
castInfo.castTimer-=fElapsedTime; |
|
|
|
|
if(castInfo.castTimer<=0){ |
|
|
|
|
if(castPrepAbility->action()){ |
|
|
|
|
castPrepAbility->cooldown=castPrepAbility->COOLDOWN_TIME; |
|
|
|
|
mana-=castPrepAbility->manaCost; |
|
|
|
|
} |
|
|
|
|
castInfo.castTimer=0; |
|
|
|
|
SetState(State::NORMAL); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
while(manaTickTimer<=0){ |
|
|
|
|
manaTickTimer+=0.2; |
|
|
|
|
mana=std::min(maxmana,mana+1); |
|
|
|
@ -293,7 +303,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto AllowedToCast=[&](Ability&ability){return !ability.precastInfo.precastTargetingRequired||ability.precastInfo.precastTargetingRequired&&GetState()==State::PREP_CAST;}; |
|
|
|
|
auto AllowedToCast=[&](Ability&ability){return !ability.precastInfo.precastTargetingRequired;}; |
|
|
|
|
auto CheckAndPerformAbility=[&](Ability&ability,HWButton key){ |
|
|
|
|
if(ability.cooldown==0&&GetMana()>=ability.manaCost){ |
|
|
|
|
if(key.bPressed||key.bReleased&&&ability==castPrepAbility&&GetState()==State::PREP_CAST){ |
|
|
|
@ -486,7 +496,7 @@ std::vector<Buff>Player::GetBuffs(BuffType buff){ |
|
|
|
|
|
|
|
|
|
void Player::CastSpell(Ability&ability){ |
|
|
|
|
castInfo={ability.name,ability.precastInfo.castTime,ability.precastInfo.castTime}; |
|
|
|
|
SetState(State::NORMAL); |
|
|
|
|
SetState(State::CASTING); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CastInfo&Player::GetCastInfo(){ |
|
|
|
|