Corrected issues with Ability declaration not matching macro. Cast cancelling moves now properly cancel any active cast. All abilities have configurable cancelCast settings.

This commit is contained in:
2023-09-15 16:32:04 -05:00
parent dbc68b8c4b
commit 4631733497
7 changed files with 23 additions and 10 deletions
+12 -2
View File
@@ -341,9 +341,14 @@ void Player::Update(float fElapsedTime){
//If pressed is set to false, uses held instead.
auto CheckAndPerformAbility=[&](Ability&ability,HWButton key){
if(ability.name!="???"){
if(CanAct()){
if(CanAct(ability)){
if(ability.cooldown==0&&GetMana()>=ability.manaCost){
if(key.bHeld||key.bReleased&&&ability==castPrepAbility&&GetState()==State::PREP_CAST){
if(GetState()==State::CASTING){
SetState(State::NORMAL);
castInfo.castTimer=castInfo.castTotalTime=0;
}
if(AllowedToCast(ability)&&ability.action(this,{})){
ability.cooldown=ability.COOLDOWN_TIME;
mana-=ability.manaCost;
@@ -483,7 +488,12 @@ bool Player::CanMove(){
}
bool Player::CanAct(){
return state!=State::CASTING&&state!=State::ANIMATION_LOCK;
Ability dummyAbility{"Dummy Ability",0,0};
return CanAct(dummyAbility);
}
bool Player::CanAct(Ability&ability){
return (ability.canCancelCast||state!=State::CASTING)&&state!=State::ANIMATION_LOCK;
}
bool Player::HasIframes(){