The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
3.2 KiB
63 lines
3.2 KiB
#include "Effect.h"
|
|
#include "DEFINES.h"
|
|
#include "Crawler.h"
|
|
#include "utils.h"
|
|
|
|
INCLUDE_game
|
|
INCLUDE_ANIMATION_DATA
|
|
INCLUDE_MONSTER_LIST
|
|
|
|
PulsatingFire::PulsatingFire(vf2d pos, float lifetime, AnimationState animation, bool upperLevel, vf2d size, float fadeout, vf2d spd, Pixel col, float rotation, float rotationSpd, bool additiveBlending)
|
|
:Effect(pos,lifetime,animation,upperLevel,size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){
|
|
for(int i=0;i<8;i++){
|
|
pulsatingFireValues.push_back(util::random(1));
|
|
}
|
|
}
|
|
|
|
bool PulsatingFire::Update(float fElapsedTime){
|
|
lastParticleTimer-=fElapsedTime;
|
|
lastDamageTimer-=fElapsedTime;
|
|
if(lastParticleTimer<=0){
|
|
int particleCount="Wizard.Ability 3.FireRingParticleSpawnAmtRange"_FRange;
|
|
for(int i=0;i<particleCount;i++){
|
|
float randomAngle="Wizard.Ability 3.FireRingParticleAngleRange"_FRange;
|
|
float randomRange=12*size.x*(1-util::random("Wizard.Ability 3.FireRingParticleRandomVariance"_F))*(1-util::random("Wizard.Ability 3.FireRingParticleRandomVariance"_F));
|
|
float randomColorTintG=128*(1-util::random("Wizard.Ability 3.FireRingParticleColorGVariance"_F))*(1-util::random("Wizard.Ability 3.FireRingParticleColorGVariance"_F));
|
|
float randomColorTint="Wizard.Ability 3.FireRingParticleColorBlueRange"_FRange;
|
|
game->AddEffect(std::make_unique<Effect>(pos+vf2d{cos(randomAngle),sin(randomAngle)}*randomRange,0,AnimationState::DOT_PARTICLE,OnUpperLevel(),vf2d{"Wizard.Ability 3.FireRingParticleXSizeRange"_FRange,"Wizard.Ability 3.FireRingParticleYSizeRange"_FRange},"Wizard.Ability 3.FireRingParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 3.FireRingParticleXSpeedRange"_FRange,"Wizard.Ability 3.FireRingParticleYSpeedRange"_FRange},Pixel{128,uint8_t(randomColorTintG),uint8_t(randomColorTint),uint8_t("Wizard.Ability 3.FireRingParticleAlphaRange"_FRange)}));
|
|
}
|
|
lastParticleTimer="Wizard.Ability 3.FireRingParticleFreqRange"_FRange;
|
|
}
|
|
if(lastDamageTimer<=0){
|
|
lastDamageTimer="Wizard.Ability 3.FireRingDamageFreq"_F-0.01;
|
|
game->HurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,game->GetPlayer()->GetAttack()*"Wizard.Ability 3.FireRingDamageMult"_F,OnUpperLevel());
|
|
}
|
|
return Effect::Update(fElapsedTime);
|
|
}
|
|
|
|
void PulsatingFire::Draw(){
|
|
for(int i=0;i<8;i++){
|
|
Animate2D::FrameSequence*effectSpr=nullptr;
|
|
switch(int(pulsatingFireValues[i]*5)){
|
|
case 0:{
|
|
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING1];
|
|
}break;
|
|
case 1:{
|
|
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING2];
|
|
}break;
|
|
case 2:{
|
|
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING3];
|
|
}break;
|
|
case 3:{
|
|
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING4];
|
|
}break;
|
|
case 4:{
|
|
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING5];
|
|
}break;
|
|
default:
|
|
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING1];
|
|
}
|
|
const Renderable*img=effectSpr->GetFrame(0).GetSourceImage();
|
|
game->view.DrawPartialDecal(pos-effectSpr->GetFrame(0).GetSourceRect().size/2*size,img->Decal(),effectSpr->GetFrame(0).GetSourceRect().pos,effectSpr->GetFrame(0).GetSourceRect().size,size,{255,uint8_t(pulsatingFireValues[i]*256),0,uint8_t((63*(sin("Wizard.Ability 3.FireRingOscillatingFrequency"_F*lifetime+PI*pulsatingFireValues[i]))+63)*(fadeout/original_fadeoutTime))});
|
|
}
|
|
} |