Prevent precast consumable items (Ex. Bandages) from still being activated when the loadout slot quantity reaches 0. Release Build 7998.

mac-build
sigonasr2 9 months ago
parent e1088e9696
commit 92ae65270e
  1. 12
      Adventures in Lestoria/Player.cpp
  2. 2
      Adventures in Lestoria/Version.h
  3. BIN
      x64/Release/Adventures in Lestoria.exe

@ -520,24 +520,34 @@ void Player::Update(float fElapsedTime){
}
auto AllowedToCast=[&](Ability&ability){return !ability.precastInfo.precastTargetingRequired&&GetState()!=State::ANIMATION_LOCK;};
auto HasEnoughOfItem=[&](Ability&ability){
if(!ability.itemAbility)return true;
if(&ability==&item1&&game->GetLoadoutItem(0).lock()->Amt()>0)return true;
if(&ability==&item2&&game->GetLoadoutItem(1).lock()->Amt()>0)return true;
if(&ability==&item3&&game->GetLoadoutItem(2).lock()->Amt()>0)return true;
return false;
};
//If pressed is set to false, uses held instead.
auto CheckAndPerformAbility=[&](Ability&ability,InputGroup key){
if(ability.name!="???"){
if(CanAct(ability)){
if(ability.cooldown==0&&GetMana()>=ability.manaCost){
if(key.Held()||key.Released()&&&ability==castPrepAbility&&GetState()==State::PREP_CAST){
#pragma region Tutorial Defensive/Use Ability Tasks
if(&ability==&rightClickAbility){
Tutorial::GetTask(TutorialTaskName::USE_DEFENSIVE).I(A::DEFENSIVE_COUNT)++;
}else{
Tutorial::GetTask(TutorialTaskName::USE_ABILITIES).I(A::ABILITY_COUNT)++;
}
#pragma endregion
if(AllowedToCast(ability)&&ability.action(this,{})){
bool allowed=ability.actionPerformedDuringCast;
ability.cooldown=ability.GetCooldownTime();
CancelCast();
ConsumeMana(ability.manaCost);
}else
if(ability.precastInfo.precastTargetingRequired&&GetState()==State::NORMAL){
if(ability.precastInfo.precastTargetingRequired&&GetState()==State::NORMAL
&&HasEnoughOfItem(ability)){
PrepareCast(ability);
}
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 0
#define VERSION_BUILD 7997
#define VERSION_BUILD 7998
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save