Finish entire class refactor. Class swapping needs to be reimplemented. Fixed shadow color from white to black
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>pull/28/head
parent
d3454727cd
commit
c75a01a1ad
@ -1,277 +0,0 @@ |
||||
|
||||
#include "DEFINES.h" |
||||
#include "Crawler.h" |
||||
#include "BulletTypes.h" |
||||
|
||||
INCLUDE_game |
||||
INCLUDE_MONSTER_LIST |
||||
INCLUDE_BULLET_LIST |
||||
|
||||
std::map<Class,std::unique_ptr<ClassData>>CLASS_DATA; |
||||
|
||||
void ClassData::InitializeClassData(){ |
||||
CLASS_DATA[WARRIOR]=std::make_unique<Warrior>(Warrior("Warrior",WARRIOR, |
||||
, |
||||
, |
||||
, |
||||
, |
||||
WARRIOR_WALK_N,WARRIOR_WALK_E,WARRIOR_WALK_S,WARRIOR_WALK_W, |
||||
WARRIOR_IDLE_N,WARRIOR_IDLE_E,WARRIOR_IDLE_S,WARRIOR_IDLE_W)); |
||||
CLASS_DATA[RANGER]=std::make_unique<Ranger>(Ranger("Ranger",RANGER, |
||||
{"Retreat",7,0,VERY_DARK_BLUE,DARK_BLUE}, |
||||
{"Rapid Fire",12,35}, |
||||
{"Charged Shot",15,40}, |
||||
{"Multishot",25,50}, |
||||
RANGER_WALK_N,RANGER_WALK_E,RANGER_WALK_S,RANGER_WALK_W, |
||||
RANGER_IDLE_N,RANGER_IDLE_E,RANGER_IDLE_S,RANGER_IDLE_W)); |
||||
CLASS_DATA[TRAPPER]=std::make_unique<Bard>(Bard("Bard",TRAPPER, |
||||
{"???",7,0,VERY_DARK_BLUE,DARK_BLUE}, |
||||
{"???",12,0}, |
||||
{"???",15,0}, |
||||
{"???",25,0}, |
||||
WARRIOR_WALK_N,WARRIOR_WALK_E,WARRIOR_WALK_S,WARRIOR_WALK_W, |
||||
WARRIOR_IDLE_N,WARRIOR_IDLE_E,WARRIOR_IDLE_S,WARRIOR_IDLE_W)); |
||||
CLASS_DATA[WIZARD]=std::make_unique<Wizard>(Wizard("Wizard",WIZARD, |
||||
{"Teleport",8,5,VERY_DARK_BLUE,DARK_BLUE}, |
||||
{"Firebolt",6,30}, |
||||
{"Lightning Bolt",6,25}, |
||||
{"Meteor",40,75}, |
||||
WIZARD_WALK_N,WIZARD_WALK_E,WIZARD_WALK_S,WIZARD_WALK_W, |
||||
WIZARD_IDLE_N,WIZARD_IDLE_E,WIZARD_IDLE_S,WIZARD_IDLE_W)); |
||||
CLASS_DATA[WITCH]=std::make_unique<Witch>(Witch("Witch",WITCH, |
||||
{"???",8,0,VERY_DARK_BLUE,DARK_BLUE}, |
||||
{"???",6,0}, |
||||
{"???",6,0}, |
||||
{"???",40,0}, |
||||
WARRIOR_WALK_N,WARRIOR_WALK_E,WARRIOR_WALK_S,WARRIOR_WALK_W, |
||||
WARRIOR_IDLE_N,WARRIOR_IDLE_E,WARRIOR_IDLE_S,WARRIOR_IDLE_W)); |
||||
} |
||||
|
||||
ClassData::ClassData(std::string name,Class cl,Ability rightClickAbility,Ability ability1,Ability ability2,Ability ability3, |
||||
AnimationState walk_n,AnimationState walk_e,AnimationState walk_s,AnimationState walk_w,AnimationState idle_n,AnimationState idle_e,AnimationState idle_s,AnimationState idle_w) |
||||
:name(name),cl(cl),rightClickAbility(rightClickAbility),ability1(ability1),ability2(ability2),ability3(ability3), |
||||
walk_n(walk_n),walk_e(walk_e),walk_s(walk_s),walk_w(walk_w),idle_n(idle_n),idle_w(idle_w),idle_s(idle_s),idle_e(idle_e) |
||||
{} |
||||
|
||||
Warrior::Warrior(std::string name,Class cl,Ability rightClickAbility,Ability ability1,Ability ability2,Ability ability3, |
||||
AnimationState walk_n,AnimationState walk_e,AnimationState walk_s,AnimationState walk_w,AnimationState idle_n,AnimationState idle_e,AnimationState idle_s,AnimationState idle_w) |
||||
:ClassData(name,cl,rightClickAbility,ability1,ability2,ability3, |
||||
walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w) |
||||
{} |
||||
|
||||
Thief::Thief(std::string name,Class cl,Ability rightClickAbility,Ability ability1,Ability ability2,Ability ability3, |
||||
AnimationState walk_n,AnimationState walk_e,AnimationState walk_s,AnimationState walk_w,AnimationState idle_n,AnimationState idle_e,AnimationState idle_s,AnimationState idle_w) |
||||
:ClassData(name,cl,rightClickAbility,ability1,ability2,ability3, |
||||
walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w) |
||||
{} |
||||
|
||||
void Thief::Update(float fElapsedTime){ |
||||
} |
||||
|
||||
bool Thief::AutoAttack(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Thief::Ability1(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Thief::Ability2(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Thief::Ability3(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Thief::RightClickAbility(){ |
||||
return true; |
||||
} |
||||
|
||||
Ranger::Ranger(std::string name,Class cl,Ability rightClickAbility,Ability ability1,Ability ability2,Ability ability3, |
||||
AnimationState walk_n,AnimationState walk_e,AnimationState walk_s,AnimationState walk_w,AnimationState idle_n,AnimationState idle_e,AnimationState idle_s,AnimationState idle_w) |
||||
:ClassData(name,cl,rightClickAbility,ability1,ability2,ability3, |
||||
walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w) |
||||
{} |
||||
|
||||
void Ranger::Update(float fElapsedTime){ |
||||
} |
||||
|
||||
bool Ranger::AutoAttack(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Ranger::Ability1(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Ranger::Ability2(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Ranger::Ability3(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Ranger::RightClickAbility(){ |
||||
return true; |
||||
} |
||||
|
||||
Bard::Bard(std::string name,Class cl,Ability rightClickAbility,Ability ability1,Ability ability2,Ability ability3, |
||||
AnimationState walk_n,AnimationState walk_e,AnimationState walk_s,AnimationState walk_w,AnimationState idle_n,AnimationState idle_e,AnimationState idle_s,AnimationState idle_w) |
||||
:ClassData(name,cl,rightClickAbility,ability1,ability2,ability3, |
||||
walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w) |
||||
{} |
||||
|
||||
void Bard::Update(float fElapsedTime){ |
||||
} |
||||
|
||||
bool Bard::AutoAttack(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Bard::Ability1(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Bard::Ability2(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Bard::Ability3(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Bard::RightClickAbility(){ |
||||
return true; |
||||
} |
||||
|
||||
Wizard::Wizard(std::string name,Class cl,Ability rightClickAbility,Ability ability1,Ability ability2,Ability ability3, |
||||
AnimationState walk_n,AnimationState walk_e,AnimationState walk_s,AnimationState walk_w,AnimationState idle_n,AnimationState idle_e,AnimationState idle_s,AnimationState idle_w) |
||||
:ClassData(name,cl,rightClickAbility,ability1,ability2,ability3, |
||||
walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w) |
||||
{} |
||||
|
||||
void Wizard::Update(float fElapsedTime){ |
||||
ACCESS_PLAYER |
||||
if(p->attack_cooldown_timer>0){ |
||||
CLASS_DATA[cl]->idle_n=AnimationState::WIZARD_IDLE_ATTACK_N; |
||||
CLASS_DATA[cl]->idle_e=AnimationState::WIZARD_IDLE_ATTACK_E; |
||||
CLASS_DATA[cl]->idle_s=AnimationState::WIZARD_IDLE_ATTACK_S; |
||||
CLASS_DATA[cl]->idle_w=AnimationState::WIZARD_IDLE_ATTACK_W; |
||||
CLASS_DATA[cl]->walk_n=AnimationState::WIZARD_ATTACK_N; |
||||
CLASS_DATA[cl]->walk_e=AnimationState::WIZARD_ATTACK_E; |
||||
CLASS_DATA[cl]->walk_s=AnimationState::WIZARD_ATTACK_S; |
||||
CLASS_DATA[cl]->walk_w=AnimationState::WIZARD_ATTACK_W; |
||||
} else { |
||||
CLASS_DATA[cl]->idle_n=AnimationState::WIZARD_IDLE_N; |
||||
CLASS_DATA[cl]->idle_e=AnimationState::WIZARD_IDLE_E; |
||||
CLASS_DATA[cl]->idle_s=AnimationState::WIZARD_IDLE_S; |
||||
CLASS_DATA[cl]->idle_w=AnimationState::WIZARD_IDLE_W; |
||||
CLASS_DATA[cl]->walk_n=AnimationState::WIZARD_WALK_N; |
||||
CLASS_DATA[cl]->walk_e=AnimationState::WIZARD_WALK_E; |
||||
CLASS_DATA[cl]->walk_s=AnimationState::WIZARD_WALK_S; |
||||
CLASS_DATA[cl]->walk_w=AnimationState::WIZARD_WALK_W; |
||||
} |
||||
if(p->GetState()==State::CASTING){ |
||||
switch(p->GetFacingDirection()){ |
||||
case UP:{ |
||||
p->UpdateAnimation(AnimationState::WIZARD_CAST_N); |
||||
}break; |
||||
case DOWN:{ |
||||
p->UpdateAnimation(AnimationState::WIZARD_CAST_S); |
||||
}break; |
||||
case LEFT:{ |
||||
p->UpdateAnimation(AnimationState::WIZARD_CAST_W); |
||||
}break; |
||||
case RIGHT:{ |
||||
p->UpdateAnimation(AnimationState::WIZARD_CAST_E); |
||||
}break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool Wizard::AutoAttack(){ |
||||
ACCESS_PLAYER |
||||
p->attack_cooldown_timer=p->MAGIC_ATTACK_COOLDOWN; |
||||
float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); |
||||
BULLET_LIST.push_back(std::make_unique<EnergyBolt>(EnergyBolt(p->GetPos(),{cos(angleToCursor)*200,sin(angleToCursor)*200},12,p->GetAttack(),p->upperLevel,true,WHITE))); |
||||
return true; |
||||
} |
||||
|
||||
bool Wizard::Ability1(){ |
||||
ACCESS_PLAYER |
||||
float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); |
||||
BULLET_LIST.push_back(std::make_unique<FireBolt>(FireBolt(p->GetPos(),{cos(angleToCursor)*275,sin(angleToCursor)*275},12,p->GetAttack(),p->upperLevel,true,{240,120,60}))); |
||||
return true; |
||||
} |
||||
|
||||
bool Wizard::Ability2(){ |
||||
ACCESS_PLAYER |
||||
float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); |
||||
BULLET_LIST.push_back(std::make_unique<LightningBolt>(LightningBolt(p->GetPos(),{cos(angleToCursor)*230,sin(angleToCursor)*230},12,p->GetAttack()*4,p->upperLevel,true,WHITE))); |
||||
return true; |
||||
} |
||||
|
||||
bool Wizard::Ability3(){ |
||||
ACCESS_PLAYER |
||||
p->SetState(State::CASTING); |
||||
game->AddEffect(std::make_unique<Meteor>(p->GetPos(),3,AnimationState::METEOR,p->OnUpperLevel(),vf2d{1,1},2)); |
||||
return true; |
||||
} |
||||
|
||||
bool Wizard::RightClickAbility(){ |
||||
ACCESS_PLAYER |
||||
float pointMouseDirection=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); |
||||
vf2d pointTowardsMouse={cos(pointMouseDirection),sin(pointMouseDirection)}; |
||||
float dist=std::clamp(geom2d::line<float>{p->GetPos(),game->GetWorldMousePos()}.length(),0.f,6.5f*24); |
||||
if(dist<12)return false; |
||||
vf2d teleportPoint=p->GetPos()+pointTowardsMouse*dist; |
||||
while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p->CanPathfindTo(p->GetPos(),teleportPoint)){ |
||||
dist-=24; |
||||
teleportPoint=p->GetPos()+pointTowardsMouse*dist; |
||||
} |
||||
if(dist>0&&p->CanPathfindTo(p->GetPos(),teleportPoint)){ |
||||
p->SetState(State::TELEPORT); |
||||
p->teleportAnimationTimer=0.35; |
||||
p->teleportTarget=teleportPoint; |
||||
p->teleportStartPosition=p->GetPos(); |
||||
p->iframe_time=0.35; |
||||
for(int i=0;i<16;i++){ |
||||
game->AddEffect(std::make_unique<Effect>(p->GetPos()+vf2d{(rand()%160-80)/10.f,(rand()%160-80)/10.f},float(rand()%300)/1000,AnimationState::DOT_PARTICLE,p->upperLevel,0.3,0.2,vf2d{float(rand()%1000-500)/100,float(rand()%1000-500)/100},BLACK)); |
||||
} |
||||
return true; |
||||
} else { |
||||
p->notificationDisplay={"Cannot Teleport to that location!",0.5}; |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
Witch::Witch(std::string name,Class cl,Ability rightClickAbility,Ability ability1,Ability ability2,Ability ability3, |
||||
AnimationState walk_n,AnimationState walk_e,AnimationState walk_s,AnimationState walk_w,AnimationState idle_n,AnimationState idle_e,AnimationState idle_s,AnimationState idle_w) |
||||
:ClassData(name,cl,rightClickAbility,ability1,ability2,ability3, |
||||
walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w) |
||||
{} |
||||
|
||||
void Witch::Update(float fElapsedTime){ |
||||
} |
||||
|
||||
bool Witch::AutoAttack(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Witch::Ability1(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Witch::Ability2(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Witch::Ability3(){ |
||||
return true; |
||||
} |
||||
|
||||
bool Witch::RightClickAbility(){ |
||||
return true; |
||||
} |
Binary file not shown.
@ -0,0 +1,62 @@ |
||||
#include "Class.h" |
||||
#include "olcPixelGameEngine.h" |
||||
#include "DEFINES.h" |
||||
#include "Player.h" |
||||
#include "Effect.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_MONSTER_LIST |
||||
INCLUDE_BULLET_LIST |
||||
INCLUDE_game |
||||
|
||||
std::string Ranger::name="Ranger"; |
||||
Class Ranger::cl=RANGER; |
||||
Ability Ranger::rightClickAbility={"Retreat",7,0,VERY_DARK_BLUE,DARK_BLUE}; |
||||
Ability Ranger::ability1={"Rapid Fire",12,35}; |
||||
Ability Ranger::ability2={"Charged Shot",15,40}; |
||||
Ability Ranger::ability3={"Multishot",25,50}; |
||||
Ability Ranger::ability4={"???",0,0}; |
||||
AnimationState Ranger::idle_n=RANGER_IDLE_N; |
||||
AnimationState Ranger::idle_e=RANGER_IDLE_E; |
||||
AnimationState Ranger::idle_s=RANGER_IDLE_S; |
||||
AnimationState Ranger::idle_w=RANGER_IDLE_W; |
||||
AnimationState Ranger::walk_n=RANGER_WALK_N; |
||||
AnimationState Ranger::walk_e=RANGER_WALK_E; |
||||
AnimationState Ranger::walk_s=RANGER_WALK_S; |
||||
AnimationState Ranger::walk_w=RANGER_WALK_W; |
||||
|
||||
SETUP_CLASS(Ranger) |
||||
|
||||
void Ranger::OnUpdate(float fElapsedTime){ |
||||
|
||||
} |
||||
|
||||
bool Ranger::AutoAttack(){ |
||||
return false; |
||||
} |
||||
void Ranger::InitializeClassAbilities(){ |
||||
#pragma region Ranger Right-click Ability (???) |
||||
Ranger::rightClickAbility.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Ranger Ability 1 (???) |
||||
Ranger::ability1.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Ranger Ability 2 (???) |
||||
Ranger::ability2.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Ranger Ability 3 (???) |
||||
Ranger::ability3.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
} |
@ -0,0 +1,62 @@ |
||||
#include "Class.h" |
||||
#include "olcPixelGameEngine.h" |
||||
#include "DEFINES.h" |
||||
#include "Player.h" |
||||
#include "Effect.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_MONSTER_LIST |
||||
INCLUDE_BULLET_LIST |
||||
INCLUDE_game |
||||
|
||||
std::string Thief::name="Thief"; |
||||
Class Thief::cl=THIEF; |
||||
Ability Thief::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE}; |
||||
Ability Thief::ability1={"???",12,40}; |
||||
Ability Thief::ability2={"???",15,50}; |
||||
Ability Thief::ability3={"???",40,60}; |
||||
Ability Thief::ability4={"???",0,0}; |
||||
AnimationState Thief::idle_n=WARRIOR_IDLE_N; |
||||
AnimationState Thief::idle_e=WARRIOR_IDLE_E; |
||||
AnimationState Thief::idle_s=WARRIOR_IDLE_S; |
||||
AnimationState Thief::idle_w=WARRIOR_IDLE_W; |
||||
AnimationState Thief::walk_n=WARRIOR_WALK_N; |
||||
AnimationState Thief::walk_e=WARRIOR_WALK_E; |
||||
AnimationState Thief::walk_s=WARRIOR_WALK_S; |
||||
AnimationState Thief::walk_w=WARRIOR_WALK_W; |
||||
|
||||
SETUP_CLASS(Thief) |
||||
|
||||
void Thief::OnUpdate(float fElapsedTime){ |
||||
|
||||
} |
||||
|
||||
bool Thief::AutoAttack(){ |
||||
return false; |
||||
} |
||||
void Thief::InitializeClassAbilities(){ |
||||
#pragma region Thief Right-click Ability (???) |
||||
Thief::rightClickAbility.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Thief Ability 1 (???) |
||||
Thief::ability1.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Thief Ability 2 (???) |
||||
Thief::ability2.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Thief Ability 3 (???) |
||||
Thief::ability3.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
} |
@ -0,0 +1,62 @@ |
||||
#include "Class.h" |
||||
#include "olcPixelGameEngine.h" |
||||
#include "DEFINES.h" |
||||
#include "Player.h" |
||||
#include "Effect.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_MONSTER_LIST |
||||
INCLUDE_BULLET_LIST |
||||
INCLUDE_game |
||||
|
||||
std::string Trapper::name="Trapper"; |
||||
Class Trapper::cl=TRAPPER; |
||||
Ability Trapper::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE}; |
||||
Ability Trapper::ability1={"???",12,40}; |
||||
Ability Trapper::ability2={"???",15,50}; |
||||
Ability Trapper::ability3={"???",40,60}; |
||||
Ability Trapper::ability4={"???",0,0}; |
||||
AnimationState Trapper::idle_n=WARRIOR_IDLE_N; |
||||
AnimationState Trapper::idle_e=WARRIOR_IDLE_E; |
||||
AnimationState Trapper::idle_s=WARRIOR_IDLE_S; |
||||
AnimationState Trapper::idle_w=WARRIOR_IDLE_W; |
||||
AnimationState Trapper::walk_n=WARRIOR_WALK_N; |
||||
AnimationState Trapper::walk_e=WARRIOR_WALK_E; |
||||
AnimationState Trapper::walk_s=WARRIOR_WALK_S; |
||||
AnimationState Trapper::walk_w=WARRIOR_WALK_W; |
||||
|
||||
SETUP_CLASS(Trapper) |
||||
|
||||
void Trapper::OnUpdate(float fElapsedTime){ |
||||
|
||||
} |
||||
|
||||
bool Trapper::AutoAttack(){ |
||||
return false; |
||||
} |
||||
void Trapper::InitializeClassAbilities(){ |
||||
#pragma region Trapper Right-click Ability (???) |
||||
Trapper::rightClickAbility.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Trapper Ability 1 (???) |
||||
Trapper::ability1.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Trapper Ability 2 (???) |
||||
Trapper::ability2.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Trapper Ability 3 (???) |
||||
Trapper::ability3.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
} |
@ -0,0 +1,62 @@ |
||||
#include "Class.h" |
||||
#include "olcPixelGameEngine.h" |
||||
#include "DEFINES.h" |
||||
#include "Player.h" |
||||
#include "Effect.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_MONSTER_LIST |
||||
INCLUDE_BULLET_LIST |
||||
INCLUDE_game |
||||
|
||||
std::string Witch::name="Witch"; |
||||
Class Witch::cl=WITCH; |
||||
Ability Witch::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE}; |
||||
Ability Witch::ability1={"???",12,40}; |
||||
Ability Witch::ability2={"???",15,50}; |
||||
Ability Witch::ability3={"???",40,60}; |
||||
Ability Witch::ability4={"???",0,0}; |
||||
AnimationState Witch::idle_n=WARRIOR_IDLE_N; |
||||
AnimationState Witch::idle_e=WARRIOR_IDLE_E; |
||||
AnimationState Witch::idle_s=WARRIOR_IDLE_S; |
||||
AnimationState Witch::idle_w=WARRIOR_IDLE_W; |
||||
AnimationState Witch::walk_n=WARRIOR_WALK_N; |
||||
AnimationState Witch::walk_e=WARRIOR_WALK_E; |
||||
AnimationState Witch::walk_s=WARRIOR_WALK_S; |
||||
AnimationState Witch::walk_w=WARRIOR_WALK_W; |
||||
|
||||
SETUP_CLASS(Witch) |
||||
|
||||
void Witch::OnUpdate(float fElapsedTime){ |
||||
|
||||
} |
||||
|
||||
bool Witch::AutoAttack(){ |
||||
return false; |
||||
} |
||||
void Witch::InitializeClassAbilities(){ |
||||
#pragma region Witch Right-click Ability (???) |
||||
Witch::rightClickAbility.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Witch Ability 1 (???) |
||||
Witch::ability1.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Witch Ability 2 (???) |
||||
Witch::ability2.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Witch Ability 3 (???) |
||||
Witch::ability3.action= |
||||
[&](){ |
||||
return false; |
||||
}; |
||||
#pragma endregion |
||||
} |
@ -0,0 +1,128 @@ |
||||
#include "Class.h" |
||||
#include "olcPixelGameEngine.h" |
||||
#include "DEFINES.h" |
||||
#include "Player.h" |
||||
#include "Effect.h" |
||||
#include "Crawler.h" |
||||
#include "BulletTypes.h" |
||||
|
||||
INCLUDE_MONSTER_LIST |
||||
INCLUDE_BULLET_LIST |
||||
INCLUDE_game |
||||
|
||||
std::string Wizard::name="Wizard"; |
||||
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::ability4={"???",0,0}; |
||||
AnimationState Wizard::idle_n=WIZARD_IDLE_N; |
||||
AnimationState Wizard::idle_e=WIZARD_IDLE_E; |
||||
AnimationState Wizard::idle_s=WIZARD_IDLE_S; |
||||
AnimationState Wizard::idle_w=WIZARD_IDLE_W; |
||||
AnimationState Wizard::walk_n=WIZARD_WALK_N; |
||||
AnimationState Wizard::walk_e=WIZARD_WALK_E; |
||||
AnimationState Wizard::walk_s=WIZARD_WALK_S; |
||||
AnimationState Wizard::walk_w=WIZARD_WALK_W; |
||||
|
||||
SETUP_CLASS(Wizard) |
||||
|
||||
void Wizard::OnUpdate(float fElapsedTime){ |
||||
if(attack_cooldown_timer>0){ |
||||
idle_n=AnimationState::WIZARD_IDLE_ATTACK_N; |
||||
idle_e=AnimationState::WIZARD_IDLE_ATTACK_E; |
||||
idle_s=AnimationState::WIZARD_IDLE_ATTACK_S; |
||||
idle_w=AnimationState::WIZARD_IDLE_ATTACK_W; |
||||
walk_n=AnimationState::WIZARD_ATTACK_N; |
||||
walk_e=AnimationState::WIZARD_ATTACK_E; |
||||
walk_s=AnimationState::WIZARD_ATTACK_S; |
||||
walk_w=AnimationState::WIZARD_ATTACK_W; |
||||
} else { |
||||
idle_n=AnimationState::WIZARD_IDLE_N; |
||||
idle_e=AnimationState::WIZARD_IDLE_E; |
||||
idle_s=AnimationState::WIZARD_IDLE_S; |
||||
idle_w=AnimationState::WIZARD_IDLE_W; |
||||
walk_n=AnimationState::WIZARD_WALK_N; |
||||
walk_e=AnimationState::WIZARD_WALK_E; |
||||
walk_s=AnimationState::WIZARD_WALK_S; |
||||
walk_w=AnimationState::WIZARD_WALK_W; |
||||
} |
||||
if(GetState()==State::CASTING){ |
||||
switch(GetFacingDirection()){ |
||||
case UP:{ |
||||
UpdateAnimation(AnimationState::WIZARD_CAST_N,WIZARD|WITCH); |
||||
}break; |
||||
case DOWN:{ |
||||
UpdateAnimation(AnimationState::WIZARD_CAST_S,WIZARD|WITCH); |
||||
}break; |
||||
case LEFT:{ |
||||
UpdateAnimation(AnimationState::WIZARD_CAST_W,WIZARD|WITCH); |
||||
}break; |
||||
case RIGHT:{ |
||||
UpdateAnimation(AnimationState::WIZARD_CAST_E,WIZARD|WITCH); |
||||
}break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool Wizard::AutoAttack(){ |
||||
attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN; |
||||
float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); |
||||
BULLET_LIST.push_back(std::make_unique<EnergyBolt>(EnergyBolt(GetPos(),{cos(angleToCursor)*200,sin(angleToCursor)*200},12,GetAttack(),upperLevel,true,WHITE))); |
||||
return true; |
||||
} |
||||
void Wizard::InitializeClassAbilities(){ |
||||
#pragma region Wizard Right-click Ability (???) |
||||
Wizard::rightClickAbility.action= |
||||
[&](){ |
||||
float pointMouseDirection=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); |
||||
vf2d pointTowardsMouse={cos(pointMouseDirection),sin(pointMouseDirection)}; |
||||
float dist=std::clamp(geom2d::line<float>{GetPos(),game->GetWorldMousePos()}.length(),0.f,6.5f*24); |
||||
if(dist<12)return false; |
||||
vf2d teleportPoint=GetPos()+pointTowardsMouse*dist; |
||||
while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&CanPathfindTo(GetPos(),teleportPoint)){ |
||||
dist-=24; |
||||
teleportPoint=GetPos()+pointTowardsMouse*dist; |
||||
} |
||||
if(dist>0&&CanPathfindTo(GetPos(),teleportPoint)){ |
||||
SetState(State::TELEPORT); |
||||
teleportAnimationTimer=0.35; |
||||
teleportTarget=teleportPoint; |
||||
teleportStartPosition=GetPos(); |
||||
iframe_time=0.35; |
||||
for(int i=0;i<16;i++){ |
||||
game->AddEffect(std::make_unique<Effect>(GetPos()+vf2d{(rand()%160-80)/10.f,(rand()%160-80)/10.f},float(rand()%300)/1000,AnimationState::DOT_PARTICLE,upperLevel,0.3,0.2,vf2d{float(rand()%1000-500)/100,float(rand()%1000-500)/100},BLACK)); |
||||
} |
||||
return true; |
||||
} else { |
||||
notificationDisplay={"Cannot Teleport to that location!",0.5}; |
||||
return false; |
||||
} |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Wizard Ability 1 (???) |
||||
Wizard::ability1.action= |
||||
[&](){ |
||||
float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); |
||||
BULLET_LIST.push_back(std::make_unique<FireBolt>(FireBolt(GetPos(),{cos(angleToCursor)*275,sin(angleToCursor)*275},12,GetAttack(),upperLevel,true,{240,120,60}))); |
||||
return true; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Wizard Ability 2 (???) |
||||
Wizard::ability2.action= |
||||
[&](){ |
||||
float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); |
||||
BULLET_LIST.push_back(std::make_unique<LightningBolt>(LightningBolt(GetPos(),{cos(angleToCursor)*230,sin(angleToCursor)*230},12,GetAttack()*4,upperLevel,true,WHITE))); |
||||
return true; |
||||
}; |
||||
#pragma endregion |
||||
#pragma region Wizard Ability 3 (???) |
||||
Wizard::ability3.action= |
||||
[&](){ |
||||
SetState(State::CASTING); |
||||
game->AddEffect(std::make_unique<Meteor>(GetPos(),3,AnimationState::METEOR,OnUpperLevel(),vf2d{1,1},2)); |
||||
return true; |
||||
}; |
||||
#pragma endregion |
||||
} |
Loading…
Reference in new issue