Add precast ability conditions
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
7ec58742de
commit
e0b1f74c5f
@ -1,5 +1,5 @@
|
||||
#include "Ability.h"
|
||||
|
||||
Ability::Ability(){};
|
||||
Ability::Ability(std::string name,float cooldownTime,int manaCost,Pixel barColor1,Pixel barColor2)
|
||||
:name(name),cooldown(0),COOLDOWN_TIME(cooldownTime),manaCost(manaCost),barColor1(barColor1),barColor2(barColor2){}
|
||||
Ability::Ability(std::string name,float cooldownTime,int manaCost,Pixel barColor1,Pixel barColor2,bool precastTargetingRequired)
|
||||
:name(name),cooldown(0),COOLDOWN_TIME(cooldownTime),manaCost(manaCost),barColor1(barColor1),barColor2(barColor2),precastTargetingRequired(precastTargetingRequired){}
|
@ -8,7 +8,8 @@ struct Ability{
|
||||
float COOLDOWN_TIME=0;
|
||||
int manaCost=0;
|
||||
Pixel barColor1,barColor2;
|
||||
bool precastTargetingRequired;
|
||||
std::function<bool()>action=[&](){return false;};
|
||||
Ability();
|
||||
Ability(std::string name,float cooldownTime,int manaCost,Pixel barColor1=VERY_DARK_RED,Pixel barColor2=DARK_RED);
|
||||
Ability(std::string name,float cooldownTime,int manaCost,Pixel barColor1=VERY_DARK_RED,Pixel barColor2=DARK_RED,bool precastTargetingRequired=false);
|
||||
};
|
@ -709,7 +709,7 @@ void Crawler::RenderHud(){
|
||||
GradientFillRectDecal(vf2d{ScreenWidth()/2-90.f,ScreenHeight()-88.f},{(timer/totalTime)*180,16},{247,125,37},{247,125,37},{247,184,37},{247,184,37});
|
||||
std::stringstream castTimeDisplay;
|
||||
castTimeDisplay<<std::fixed<<std::setprecision(1)<<timer;
|
||||
DrawShadowStringPropDecal(vf2d{ScreenWidth()/2+90.f,ScreenHeight()-88.f}-vf2d{float(GetTextSizeProp(castTimeDisplay.str()).x),0},castTimeDisplay.str(),WHITE,BLACK);
|
||||
DrawShadowStringPropDecal(vf2d{ScreenWidth()/2+90.f,ScreenHeight()-80.f}-vf2d{float(GetTextSizeProp(castTimeDisplay.str()).x),0},castTimeDisplay.str(),WHITE,BLACK);
|
||||
DrawShadowStringPropDecal(vf2d{ScreenWidth()/2.f-GetTextSizeProp(castText).x*2/2,ScreenHeight()-64.f},castText,WHITE,BLACK,{2,3},2.f);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,6 @@ void Player::Update(float fElapsedTime){
|
||||
ability1.cooldown=ability1.COOLDOWN_TIME;
|
||||
mana-=ability1.manaCost;
|
||||
}
|
||||
|
||||
} else
|
||||
if(ability1.cooldown==0&&GetMana()<ability1.manaCost&&game->GetKey(SHIFT).bPressed){
|
||||
notEnoughManaDisplay={ability1.name,1};
|
||||
|
@ -69,6 +69,7 @@ protected:
|
||||
Key facingDirection;
|
||||
float swordSwingTimer=0;
|
||||
void CastSpell(std::string name,float castTotalTime);
|
||||
|
||||
public:
|
||||
Player();
|
||||
//So this is rather fascinating and only exists because we have the ability to change classes which means we need to initialize a class
|
||||
|
@ -10,5 +10,6 @@ enum State{
|
||||
BLOCK,
|
||||
TELEPORT,
|
||||
PATH_AROUND,
|
||||
CASTING
|
||||
CASTING,
|
||||
PREP_CAST,
|
||||
};
|
@ -15,7 +15,7 @@ Class Wizard::cl=WIZARD;
|
||||
Ability Wizard::rightClickAbility={"Teleport",8,5,VERY_DARK_BLUE,DARK_BLUE};
|
||||
Ability Wizard::ability1={"Firebolt",6,30};
|
||||
Ability Wizard::ability2={"Lightning Bolt",6,25};
|
||||
Ability Wizard::ability3={"Meteor",40,75};
|
||||
Ability Wizard::ability3={"Meteor",40,75,VERY_DARK_RED,VERY_DARK_RED,true};
|
||||
Ability Wizard::ability4={"???",0,0};
|
||||
AnimationState Wizard::idle_n=WIZARD_IDLE_N;
|
||||
AnimationState Wizard::idle_e=WIZARD_IDLE_E;
|
||||
@ -120,7 +120,6 @@ void Wizard::InitializeClassAbilities(){
|
||||
#pragma region Wizard Ability 3 (Meteor)
|
||||
Wizard::ability3.action=
|
||||
[&](){
|
||||
SetState(State::CASTING);
|
||||
CastSpell("Meteor",1.5);
|
||||
game->AddEffect(std::make_unique<Meteor>(GetPos(),3,AnimationState::METEOR,OnUpperLevel(),vf2d{1,1},2));
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user