diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index 1a436447..c74b268a 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -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::vectorPlayer::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(){ diff --git a/Crawler/pixelGameEngine.o b/Crawler/pixelGameEngine.o deleted file mode 100644 index d273f0ca..00000000 Binary files a/Crawler/pixelGameEngine.o and /dev/null differ