Implemented Trapper's Explosive Trap ability. Release Build 10304.

mac-build
sigonasr2 4 months ago
parent 8903410848
commit 3850cbaef9
  1. 4
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 3
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 2
      Adventures in Lestoria/Animation.cpp
  4. 15
      Adventures in Lestoria/BulletTypes.h
  5. 114
      Adventures in Lestoria/ExplosiveTrap.cpp
  6. 7
      Adventures in Lestoria/Trapper.cpp
  7. 2
      Adventures in Lestoria/Version.h
  8. 5
      Adventures in Lestoria/assets/config/classes/Trapper.txt
  9. 58
      Adventures in Lestoria/assets/config/credits.txt
  10. 2
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  11. BIN
      Adventures in Lestoria/assets/explosionframes.png
  12. BIN
      Adventures in Lestoria/assets/explosive_trap.png
  13. BIN
      x64/Release/Adventures in Lestoria.exe

@ -760,6 +760,10 @@
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="ExplosiveTrap.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="IBullet.cpp" />
<ClCompile Include="BuyItemWindow.cpp">
<SubType>

@ -1145,6 +1145,9 @@
<ClCompile Include="Buff.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ExplosiveTrap.cpp">
<Filter>Source Files\Bullet Types</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

@ -342,6 +342,8 @@ void sig::Animation::InitializeAnimations(){
#pragma endregion
CreateHorizontalAnimationSequence("bear_trap.png",3,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("explosive_trap.png",4,{48,48},AnimationData{.frameDuration{0.06f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("explosionframes.png",21,{24,24},AnimationData{.frameDuration{0.05f},.style{Animate2D::Style::OneShot}});
for(auto&dat:GFX){
std::string imgFile=dat.first;

@ -301,4 +301,19 @@ struct BearTrap:public Bullet{
BulletDestroyState PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!!
BulletDestroyState MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!!
void ModifyOutgoingDamageData(HurtDamageInfo&data);
};
struct ExplosiveTrap:public Bullet{
ExplosiveTrap(vf2d pos,float radius,float explosionRadius,float automaticDetonationTime,int damage,float fadeinTime,float fadeoutTime,float activationWaitTime,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1});
void Update(float fElapsedTime)override;
BulletDestroyState PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!!
BulletDestroyState MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!!
void ModifyOutgoingDamageData(HurtDamageInfo&data);
private:
void Detonate();
const float explosionRadius{};
const float activationRadius{};
float automaticDetonationTime{};
float activationWaitTime{};
float lastBeepTime{};
};

@ -0,0 +1,114 @@
#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 © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "BulletTypes.h"
#include "AdventuresInLestoria.h"
#include <ranges>
#include "config.h"
#include "util.h"
#include "SoundEffect.h"
INCLUDE_ANIMATION_DATA
INCLUDE_game
ExplosiveTrap::ExplosiveTrap(vf2d pos,float radius,float explosionRadius,float automaticDetonationTime,int damage,float fadeinTime,float fadeoutTime,float activationWaitTime,bool upperLevel,bool hitsMultiple,float lifetime,bool friendly,Pixel col,vf2d scale)
:activationWaitTime(activationWaitTime),automaticDetonationTime(automaticDetonationTime),activationRadius(radius),explosionRadius(explosionRadius),Bullet(pos,{},0.f,damage,"Ability Icons/explosive_trap.png",upperLevel,hitsMultiple,lifetime,false,friendly,col,scale,0.f,"Trap Hit"){
fadeInTime=fadeinTime;
animation.AddState("explosive_trap.png",ANIMATION_DATA["explosive_trap.png"]);
if(!friendly)ERR("WARNING! Trying to use unimplemented enemy version of the Explosive Trap Bullet!");
}
void ExplosiveTrap::Update(float fElapsedTime){
const bool trapActivated{radius==activationRadius};
if(!trapActivated){
activationWaitTime-=fElapsedTime;
if(activationWaitTime<=0.f){
radius=activationRadius;
animation.ChangeState(internal_animState,"explosive_trap.png");
SoundEffect::PlaySFX("Beep",pos);
lastBeepTime=1.f;
}
}else{
automaticDetonationTime-=fElapsedTime;
lastBeepTime-=fElapsedTime;
if(lastBeepTime<=0.f){
SoundEffect::PlaySFX("Beep",pos);
lastBeepTime=1.f;
}
if(IsActivated()&&automaticDetonationTime<=0.f)Detonate();
}
}
void ExplosiveTrap::ModifyOutgoingDamageData(HurtDamageInfo&data){
data.hurtFlags|=HurtFlag::PLAYER_ABILITY;
}
BulletDestroyState ExplosiveTrap::PlayerHit(Player*player){
fadeOutTime=0.5f;
return BulletDestroyState::KEEP_ALIVE;
}
void ExplosiveTrap::Detonate(){
fadeOutTime=0.5f;
const HurtList list{game->HurtNotHit(pos,"Trapper.Ability 3.Explosion Radius"_F/100.f*24,damage,hitList,OnUpperLevel(),GetZ(),HurtType::MONSTER,HurtFlag::PLAYER_ABILITY)};
for(const auto&[targetPtr,wasHit]:list){
if(wasHit){
std::get<Monster*>(targetPtr)->ProximityKnockback(pos,"Trapper.Ability 3.Explosion Knockup Amount"_F);
std::get<Monster*>(targetPtr)->Knockup("Trapper.Ability 3.Explosion Knockup Amount"_F);
std::get<Monster*>(targetPtr)->ApplyMark("Trapper.Ability 3.Explosion Mark Stack Time"_F,"Trapper.Ability 3.Explosion Mark Stack Increase"_I);
}
}
game->AddEffect(std::make_unique<Effect>(pos,ANIMATION_DATA["explosionframes.png"].GetTotalAnimationDuration()-0.2f,"explosionframes.png",OnUpperLevel(),scale*2.f,0.2f,vf2d{},WHITE,util::random(2*PI),0.f));
Deactivate();
}
BulletDestroyState ExplosiveTrap::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
for(int i:std::ranges::iota_view(0,"Trapper.Ability 3.Trap Mark Trigger Count"_I-1)){
monster.Hurt(0,monster.OnUpperLevel(),monster.GetZ(),HurtFlag::PLAYER_ABILITY);//Triggers mark multiple times after the first mark.
}
monster.ProximityKnockback(pos,"Trapper.Ability 3.Explosion Knockup Amount"_F);
monster.Knockup("Trapper.Ability 3.Explosion Knockup Amount"_F);
Detonate();
return BulletDestroyState::KEEP_ALIVE;
}

@ -121,10 +121,13 @@ void Trapper::InitializeClassAbilities(){
return true;
};
#pragma endregion
#pragma region Trapper Ability 3 (???)
#pragma region Trapper Ability 3 (Explosive Trap)
Trapper::ability3.action=
[](Player*p,vf2d pos={}){
return false;
CreateBullet(ExplosiveTrap)(p->GetPos(),"Trapper.Ability 3.Trap Radius"_I,"Trapper.Ability 3.Explosion Radius"_F/100.f*24,"Trapper.Ability 3.Trap Auto Detonate Time"_F,"Trapper.Ability 3.DamageMult"_F*p->GetAttack(),0.2f,0.5f,"Trapper.Ability 3.Trap Activation Time"_F,p->OnUpperLevel(),false,INFINITE,true,WHITE,{1.f,1.f})EndBullet;
SoundEffect::PlaySFX("Place Down Trap",p->GetPos());
p->SetAnimationBasedOnTargetingDirection("SETTRAP",p->GetFacingDirection());
return true;
};
#pragma endregion
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 10303
#define VERSION_BUILD 10304
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -116,6 +116,11 @@ Trapper
Trap Mark Trigger Count = 2
# Number of mark stacks to add to any targets caught by the explosion.
Explosion Mark Stack Increase = 1
Explosion Mark Stack Time = 7s
Explosion Knockback Amount = 150
Explosion Knockup Amount = 0.6s
Trap Radius = 17px
Explosion Knockup Amount = 20
Explosion Knockback Amount = 250

@ -42,40 +42,42 @@ Credits
LINE[39]=" "
LINE[40]="Animated Slime by Calciumtrice - Creative Commons Attribution 3.0."
LINE[41]=" "
LINE[42]="ERA OF FANTASY - GRASSLANDS"
LINE[43]="X: @Namatnieks"
LINE[44]=" "
LINE[45]="Fantastic Pillar by InThePixel"
LINE[42]="Explosion (animated) by Ville Seppanen - villeseppanen.com - Creative Commons Attribution 3.0."
LINE[43]=" "
LINE[44]="ERA OF FANTASY - GRASSLANDS"
LINE[45]="X: @Namatnieks"
LINE[46]=" "
LINE[47]="*** Minifantasy - Tiny Overworld v1.0 ***"
LINE[48]="Minifantasy is an original idea by Krishna Palacio"
LINE[49]=" "
LINE[50]="Public Domain Font Authors"
LINE[51]="c64esque by andraaspar"
LINE[52]="Habbo by Omni"
LINE[53]="Unknown by Anonymous"
LINE[54]=" "
LINE[55]="Nb Pixel Font Bundle"
LINE[56]="Nb Pixel Font Bundle 2"
LINE[57]=" "
LINE[58]="Spells and Company by LittleFieryOne"
LINE[47]="Fantastic Pillar by InThePixel"
LINE[48]=" "
LINE[49]="*** Minifantasy - Tiny Overworld v1.0 ***"
LINE[50]="Minifantasy is an original idea by Krishna Palacio"
LINE[51]=" "
LINE[52]="Public Domain Font Authors"
LINE[53]="c64esque by andraaspar"
LINE[54]="Habbo by Omni"
LINE[55]="Unknown by Anonymous"
LINE[56]=" "
LINE[57]="Nb Pixel Font Bundle"
LINE[58]="Nb Pixel Font Bundle 2"
LINE[59]=" "
LINE[60]=" "
LINE[60]="Spells and Company by LittleFieryOne"
LINE[61]=" "
LINE[62]="Game License"
LINE[63]="~~~~~~~~~~~~~~~~"
LINE[64]="License (OLC-3)"
LINE[65]="~~~~~~~~~~~~~~~"
LINE[66]=" "
LINE[67]="Copyright ` 2024 Sig Productions <niconiconii@lestoria.net>"
LINE[62]=" "
LINE[63]=" "
LINE[64]="Game License"
LINE[65]="~~~~~~~~~~~~~~~~"
LINE[66]="License (OLC-3)"
LINE[67]="~~~~~~~~~~~~~~~"
LINE[68]=" "
LINE[69]="Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:"
LINE[69]="Copyright ` 2024 Sig Productions <niconiconii@lestoria.net>"
LINE[70]=" "
LINE[71]="1. Redistributions or derivations of source code must retain the above copyright notice, this list of conditions and the following disclaimer."
LINE[71]="Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:"
LINE[72]=" "
LINE[73]="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."
LINE[73]="1. Redistributions or derivations of source code must retain the above copyright notice, this list of conditions and the following disclaimer."
LINE[74]=" "
LINE[75]="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."
LINE[75]="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."
LINE[76]=" "
LINE[77]="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."
LINE[77]="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."
LINE[78]=" "
LINE[79]="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."
}

@ -112,6 +112,8 @@ Images
GFX_TargetMark = target.png
GFX_MarkTrail = mark_trail.png
GFX_BearTrap = bear_trap.png
GFX_ExplosiveTrap = explosive_trap.png
GFX_Explosion = explosionframes.png
GFX_Thief_Sheet = nico-thief.png
GFX_Trapper_Sheet = nico-trapper.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Loading…
Cancel
Save