|
|
|
#include "BulletTypes.h"
|
|
|
|
#include "Effect.h"
|
|
|
|
#include "Crawler.h"
|
|
|
|
#include "DEFINES.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
INCLUDE_game
|
|
|
|
INCLUDE_MONSTER_LIST
|
|
|
|
|
|
|
|
FireBolt::FireBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
|
|
|
|
:Bullet(pos,vel,radius,damage,AnimationState::ENERGY_BOLT,upperLevel,false,INFINITE,true,friendly,col){}
|
|
|
|
|
|
|
|
void FireBolt::Update(float fElapsedTime){
|
|
|
|
lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime);
|
|
|
|
if(lastParticleSpawn==0){
|
|
|
|
lastParticleSpawn=0.03;
|
|
|
|
game->AddEffect(Effect(pos,util::random(1),AnimationState::ENERGY_PARTICLE,upperLevel,util::random(2),0.3,{util::random(120)-60,-util::random(60)},{255,uint8_t(util::random(250)),0}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FireBolt::PlayerHit(Player& player)
|
|
|
|
{
|
|
|
|
deactivated=true;
|
|
|
|
fadeOutTime=0.2f;
|
|
|
|
game->AddEffect(Effect(player.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,5,0.25,{},{240,120,60}));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FireBolt::MonsterHit(Monster& monster)
|
|
|
|
{
|
|
|
|
deactivated=true;
|
|
|
|
fadeOutTime=0.2f;
|
|
|
|
for(int i=0;i<72;i++){
|
|
|
|
game->AddEffect(Effect(monster.GetPos(),util::random(0.5),AnimationState::DOT_PARTICLE,upperLevel,util::random(2),util::random(0.4),{util::random(300)-150,util::random(300)-150},{255,uint8_t(util::random(190)+60),60}));
|
|
|
|
}
|
|
|
|
game->SetupWorldShake(0.25);
|
|
|
|
for(Monster&m:MONSTER_LIST){
|
|
|
|
if(geom2d::line(monster.GetPos(),m.GetPos()).length()<=2.5*24){
|
|
|
|
m.Hurt(3*damage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
game->AddEffect(Effect(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,5,0.25,{},{240,120,60}));
|
|
|
|
return false;
|
|
|
|
}
|