|
|
|
|
#pragma region License
|
|
|
|
|
/*
|
|
|
|
|
License (OLC-3)
|
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
|
|
1. Redistributions or derivations of source code must retain the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
|
|
2. Redistributions or derivative works in binary form must reproduce the above
|
|
|
|
|
copyright notice. This list of conditions and the following disclaimer must be
|
|
|
|
|
reproduced in the documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
|
|
3. Neither the name of the copyright holder nor the names of its contributors may
|
|
|
|
|
be used to endorse or promote products derived from this software without specific
|
|
|
|
|
prior written permission.
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
|
|
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
|
|
|
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
|
|
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
|
|
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
Portions of this software are copyright <EFBFBD> 2024 The FreeType
|
|
|
|
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
|
|
|
|
All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
|
|
|
|
#include "Effect.h"
|
|
|
|
|
#include "util.h"
|
|
|
|
|
#include "AdventuresinLestoria.h"
|
|
|
|
|
#include "SoundEffect.h"
|
|
|
|
|
|
|
|
|
|
INCLUDE_game
|
|
|
|
|
INCLUDE_GFX
|
|
|
|
|
|
|
|
|
|
MonsterSoul::MonsterSoul(vf2d pos,float fadeoutTime,float size,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
|
|
|
|
|
:Effect(pos,INFINITE,"monstersoul.png",OnUpperLevel(),size,fadeoutTime,spd,col,rotation,rotationSpd,additiveBlending),fadeoutTime(fadeoutTime){
|
|
|
|
|
type=EffectType::MONSTER_SOUL;
|
|
|
|
|
}
|
|
|
|
|
bool MonsterSoul::Update(float fElapsedTime){
|
|
|
|
|
bool updateResult{Effect::Update(fElapsedTime)};
|
|
|
|
|
switch(phase){
|
|
|
|
|
case RISING:{
|
|
|
|
|
if(GetZ()<10.f){
|
|
|
|
|
z+=10.f*fElapsedTime;
|
|
|
|
|
alpha=uint8_t(util::lerp(0,255,z/10.f));
|
|
|
|
|
}else{
|
|
|
|
|
phase=TRACKING_PLAYER;
|
|
|
|
|
alpha=255;
|
|
|
|
|
}
|
|
|
|
|
}break;
|
|
|
|
|
case TRACKING_PLAYER:{
|
|
|
|
|
z=util::lerp(7,13,abs(sin(3*PI*lifetime)));
|
|
|
|
|
moveSpd+=48.f*fElapsedTime;
|
|
|
|
|
vf2d projectedPos{pos+util::pointTo(pos,game->GetPlayer()->GetPos())*moveSpd*fElapsedTime};
|
|
|
|
|
geom2d::line<float>collisionLine{pos,projectedPos};
|
|
|
|
|
pos=projectedPos;
|
|
|
|
|
if(geom2d::overlaps(collisionLine,geom2d::circle<float>(game->GetPlayer()->GetPos(),game->GetPlayer()->GetSizeMult()*8.f))){
|
|
|
|
|
lifetime=0.f;
|
|
|
|
|
fadeout=fadeoutTime;
|
|
|
|
|
game->GetPlayer()->Heal("Reaper of Souls"_ENC["HEALTH GAIN"]);
|
|
|
|
|
game->GetPlayer()->RestoreMana("Reaper of Souls"_ENC["MANA GAIN"]);
|
|
|
|
|
game->GetPlayer()->GetRightClickAbility().cooldown-="Reaper of Souls"_ENC["COOLDOWN REDUCTION"];
|
|
|
|
|
game->GetPlayer()->GetAbility1().cooldown-="Reaper of Souls"_ENC["COOLDOWN REDUCTION"];
|
|
|
|
|
game->GetPlayer()->GetAbility2().cooldown-="Reaper of Souls"_ENC["COOLDOWN REDUCTION"];
|
|
|
|
|
game->GetPlayer()->GetAbility3().cooldown-="Reaper of Souls"_ENC["COOLDOWN REDUCTION"];
|
|
|
|
|
game->GetPlayer()->GetAbility4().cooldown-="Reaper of Souls"_ENC["COOLDOWN REDUCTION"];
|
|
|
|
|
SoundEffect::PlaySFX("Collect Soul",pos);
|
|
|
|
|
phase=DEAD;
|
|
|
|
|
}
|
|
|
|
|
}break;
|
|
|
|
|
}
|
|
|
|
|
return updateResult;
|
|
|
|
|
}
|
|
|
|
|
void MonsterSoul::Draw()const{
|
|
|
|
|
game->SetDecalMode(DecalMode::ADDITIVE);
|
|
|
|
|
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()},GFX["monstersoulglow.png"].Decal(),0.f,GFX["monstersoulglow.png"].Sprite()->Size()/2,size*util::lerp(0.6f,1.4f,abs(sin(2*PI*lifetime))));
|
|
|
|
|
game->SetDecalMode(DecalMode::NORMAL);
|
|
|
|
|
Effect::Draw();
|
|
|
|
|
}
|