|
|
|
@ -6,6 +6,7 @@ |
|
|
|
|
#include "Crawler.h" |
|
|
|
|
#include "BulletTypes.h" |
|
|
|
|
#include "config.h" |
|
|
|
|
#include "utils.h" |
|
|
|
|
|
|
|
|
|
INCLUDE_MONSTER_LIST |
|
|
|
|
INCLUDE_BULLET_LIST |
|
|
|
@ -66,7 +67,7 @@ void Wizard::OnUpdate(float fElapsedTime){ |
|
|
|
|
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))); |
|
|
|
|
BULLET_LIST.push_back(std::make_unique<EnergyBolt>(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,GetAttack(),upperLevel,true,WHITE))); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
void Wizard::InitializeClassAbilities(){ |
|
|
|
@ -76,21 +77,37 @@ void Wizard::InitializeClassAbilities(){ |
|
|
|
|
if(p->GetState()==State::CASTING)return false; |
|
|
|
|
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; |
|
|
|
|
float dist=std::clamp(geom2d::line<float>{p->GetPos(),game->GetWorldMousePos()}.length(),0.f,"Wizard.Right Click Ability.TeleportRange"_F/100*24); |
|
|
|
|
if(dist<"Wizard.Right Click Ability.TilesMin"_I*12)return false; |
|
|
|
|
vf2d teleportPoint=p->GetPos()+pointTowardsMouse*dist; |
|
|
|
|
while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p->CanPathfindTo(p->GetPos(),teleportPoint)){ |
|
|
|
|
while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p->CanPathfindTo(p->GetPos(),teleportPoint,"Wizard.Right Click Ability.TilesMax"_I)){ |
|
|
|
|
dist-=24; |
|
|
|
|
teleportPoint=p->GetPos()+pointTowardsMouse*dist; |
|
|
|
|
} |
|
|
|
|
if(dist>0&&p->CanPathfindTo(p->GetPos(),teleportPoint)){ |
|
|
|
|
if(dist>0&&p->CanPathfindTo(p->GetPos(),teleportPoint,"Wizard.Right Click Ability.TilesMax"_I)){ |
|
|
|
|
p->SetState(State::TELEPORT); |
|
|
|
|
p->teleportAnimationTimer=0.35; |
|
|
|
|
p->teleportAnimationTimer="Wizard.Right Click Ability.AnimationTime"_F; |
|
|
|
|
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)); |
|
|
|
|
p->iframe_time="Wizard.Right Click Ability.IframeTime"_F; |
|
|
|
|
for(int i=0;i<"Wizard.Right Click Ability.ParticleCount"_I;i++){ |
|
|
|
|
game->AddEffect( |
|
|
|
|
std::make_unique<Effect>( |
|
|
|
|
p->GetPos()+ |
|
|
|
|
vf2d{(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)- |
|
|
|
|
"Wizard.Right Click Ability.ParticleRange"_F/100)*12 |
|
|
|
|
,(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)- |
|
|
|
|
"Wizard.Right Click Ability.ParticleRange"_F/100)*12}, |
|
|
|
|
util::random("Wizard.Right Click Ability.ParticleLifetimeMax"_F)+ |
|
|
|
|
"Wizard.Right Click Ability.ParticleLifetimeMin"_F, |
|
|
|
|
AnimationState::DOT_PARTICLE,p->upperLevel, |
|
|
|
|
"Wizard.Right Click Ability.ParticleSize"_F, |
|
|
|
|
"Wizard.Right Click Ability.ParticleFadetime"_F, |
|
|
|
|
vf2d{util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+ |
|
|
|
|
"Wizard.Right Click Ability.ParticleSpeedMin"_F, |
|
|
|
|
util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+ |
|
|
|
|
"Wizard.Right Click Ability.ParticleSpeedMin"_F}, |
|
|
|
|
"Wizard.Right Click Ability.ParticleColor"_Pixel)); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|