Add additive blending property to bullets. Ink bubble explosion. Ink Bubble bullet behavior added. Add Ink Slowdown debuff property. Release Build 11900.

master
sigonasr2 4 weeks ago
parent b38b42f1d0
commit 8eb1878074
  1. 4
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 3
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 5
      Adventures in Lestoria/AdventuresInLestoria.cpp
  4. 1
      Adventures in Lestoria/Animation.cpp
  5. 1
      Adventures in Lestoria/Buff.h
  6. 6
      Adventures in Lestoria/BulletTypes.h
  7. 2
      Adventures in Lestoria/BurstBullet.cpp
  8. 4
      Adventures in Lestoria/Effect.cpp
  9. 9
      Adventures in Lestoria/Effect.h
  10. 4
      Adventures in Lestoria/GiantOctopus.cpp
  11. 11
      Adventures in Lestoria/IBullet.cpp
  12. 1
      Adventures in Lestoria/IBullet.h
  13. 52
      Adventures in Lestoria/Ink.cpp
  14. 31
      Adventures in Lestoria/InkBullet.cpp
  15. 3
      Adventures in Lestoria/Player.cpp
  16. 2
      Adventures in Lestoria/RotateBullet.cpp
  17. 2
      Adventures in Lestoria/Version.h
  18. 5
      Adventures in Lestoria/assets/config/MonsterStrategies.txt
  19. 2
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  20. BIN
      Adventures in Lestoria/assets/gamepack.pak
  21. BIN
      Adventures in Lestoria/assets/ink.png
  22. BIN
      Adventures in Lestoria/assets/inkbubble_explode.png
  23. BIN
      Adventures in Lestoria/assets/inkbullet.png
  24. BIN
      x64/Release/Adventures in Lestoria.exe

@ -979,6 +979,10 @@
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="Ink.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="InkBullet.cpp">
<SubType>
</SubType>

@ -1286,6 +1286,9 @@
<ClCompile Include="InkBullet.cpp">
<Filter>Source Files\Bullet Types</Filter>
</ClCompile>
<ClCompile Include="Ink.cpp">
<Filter>Source Files\Effects</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

@ -758,6 +758,9 @@ void AiL::HandleUserInput(float fElapsedTime){
}
}
}
//NOTE: An assumption is made that after handling user input all user movement temporary counters can be completely reset. They should go here!
player->RemoveAllBuffs(BuffType::INK_SLOWDOWN);
}
void AiL::UpdateCamera(float fElapsedTime){
@ -2100,6 +2103,8 @@ void AiL::RenderHud(){
const float vignetteTotalDisplayTime="Interface.Vignette Appearance Time"_F+"Interface.Vignette Fadeout Time"_F;
if(vignetteDisplayTime<"Interface.Vignette Fadeout Time"_F)vignetteOverlayCol.a=util::lerp(0,255,vignetteDisplayTime/"Interface.Vignette Fadeout Time"_F);
DrawDecal({0,0},GFX["vignette.png"].Decal(),{1.f,1.f},vignetteOverlayCol);
DrawStringDecal({},std::to_string(player->GetMoveSpdMult()));
}
void AiL::RenderCooldowns(){

@ -466,6 +466,7 @@ void sig::Animation::InitializeAnimations(){
CreateHorizontalAnimationSequence("portal.png",8,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("burstbullet.png",4,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("inkbubble_explode.png",4,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::OneShot}});
//!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//DO NOT CREATE MORE ANIMATION SEQUENCES UNDERNEATH HERE AS THE NEXT BLOCK WILL CREATE DEFAULT ANIMATIONS

@ -65,6 +65,7 @@ enum BuffType{
CURSE_OF_PAIN,
CURSE_OF_DEATH,
AFFECTED_BY_LIGHTNING_BOLT, //Intensity indicates number of repeats remaining.
INK_SLOWDOWN, //Intensity indicates number of ink spots running over. This buff type is reset every frame by AdventuresInLestoria::HandleUserInput! See Ink class constructor comment for more information on how this works!
};
enum class BuffRestorationType{
ONE_OFF, //This is used as a hack fix for the RestoreDuringCast Item script since they require us to restore 1 tick immediately. Over time buffs do not apply a tick immediately.

@ -417,14 +417,16 @@ private:
};
struct InkBullet:public Bullet{
InkBullet(const vf2d pos,const vf2d targetPos,const vf2d vel,const float inkExplosionRadius,const float inkSlowdownPct,const float inkPuddleLifetime);
InkBullet(const vf2d pos,const vf2d targetPos,const vf2d vel,const float inkExplosionRadius,const float inkPuddleLifetime,const float inkPuddleRadius,const bool upperLevel,const bool friendly);
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 Splat();
const vf2d targetPos;
const float inkExplosionRadius;
const float inkSlowdownPct;
const float inkPuddleLifetime;
}
const float inkPuddleRadius;
};

@ -89,11 +89,13 @@ void BurstBullet::Update(float fElapsedTime){
BulletDestroyState BurstBullet::PlayerHit(Player*player){
Explode();
player->ApplyIframes(0.2f);
return BulletDestroyState::KEEP_ALIVE;
}
BulletDestroyState BurstBullet::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
Explode();
monster.ApplyIframes(0.2f);
return BulletDestroyState::KEEP_ALIVE;
}

@ -44,15 +44,19 @@ INCLUDE_ANIMATION_DATA
INCLUDE_game
INCLUDE_GFX
//Note: The fadeout time activates when the original lifetime of the bullet expires! It doesn't begin immediately.
Effect::Effect(vf2d pos,float lifetime,const std::string&imgFile,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:Effect(pos,lifetime,imgFile,upperLevel,0.f,fadeout,vf2d{size,size},spd,col,rotation,rotationSpd,additiveBlending){}
//Note: The fadeout time activates when the original lifetime of the bullet expires! It doesn't begin immediately.
Effect::Effect(vf2d pos,float lifetime,const std::string&imgFile,bool upperLevel,vf2d size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:Effect(pos,lifetime,imgFile,upperLevel,0.f,fadeout,size,spd,col,rotation,rotationSpd,additiveBlending){}
//Note: The fadeout time activates when the original lifetime of the bullet expires! It doesn't begin immediately.
Effect::Effect(vf2d pos,float lifetime,const std::string&imgFile,bool upperLevel,float fadein,float fadeout,vf2d size,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:Effect(pos,lifetime,imgFile,upperLevel,fadein,fadeout,size,spd,EffectType::NONE,col,rotation,rotationSpd,additiveBlending){}
//Note: The fadeout time activates when the original lifetime of the bullet expires! It doesn't begin immediately.
Effect::Effect(vf2d pos,float lifetime,const std::string&imgFile,bool upperLevel,float fadein,float fadeout,vf2d size,vf2d spd,EffectType type,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:pos(pos),lifetime(lifetime),upperLevel(upperLevel),size(size),fadein(fadein),original_fadeInTime(fadein),fadeout(fadeout),original_fadeOutTime(fadeout),spd(spd),col(col),rotation(rotation),rotationSpd(rotationSpd),additiveBlending(additiveBlending),type(type){
this->animation.AddState(imgFile,ANIMATION_DATA.at(imgFile));

@ -213,4 +213,13 @@ struct LingeringEffect:FadeInOutEffect{
const float radius;
HurtType friendly;
const size_t sfxID{};
};
struct Ink:Effect{
//NOTE: The way ink works is that every update frame, each ink stack will check for distance to player, and if the player collides with the radius of the ink it will add one to the ink debuff for the player.
// At the end of AdventuresInLestoria::HandleUserInput(), the ink stack counter is reset after handling user input for moving the player.
Ink(vf2d pos,float radius,float lifetime,float fadeinTime,float fadeoutTime,vf2d size,Pixel col,bool onUpperLevel,float rotation);
virtual bool Update(float fElapsedTime)override final;
private:
const float radius;
};

@ -139,13 +139,15 @@ void Monster::STRATEGY::GIANT_OCTOPUS(Monster&m,float fElapsedTime,std::string s
if(m.F(A::SHOOT_TIMER)<=0.f){
if(InSecondPhase){
if(m.F(A::LAST_INK_SHOOT_TIMER)<=0.f){
CreateBullet(InkBullet)(m.GetPos())EndBullet;
CreateBullet(InkBullet)(m.GetPos(),game->GetPlayer()->GetPos(),vf2d{ConfigFloat("Phase 2.Ink Bullet Speed"),0.f},ConfigFloat("Phase 2.Ink Explosion Radius"),ConfigFloat("Phase 2.Ink Puddle Lifetime"),ConfigFloat("Phase 2.Ink Puddle Collision Radius"),m.OnUpperLevel(),false)EndBullet;
m.F(A::LAST_INK_SHOOT_TIMER)=ConfigFloat("Phase 2.Ink Bullet Frequency");
goto BulletShot;
}else
if(m.I(A::BULLET_COUNT_AFTER_INK_ATTACK)>ConfigInt("Phase 2.Homing Bullet Starts After")){
/*
if(m.I(A::ATTACK_COUNT)%ConfigInt("Phase 2.Homing Bullet Frequency")==0)CreateBullet(HomingBullet)(m.GetPos(),util::pointTo(m.GetPos(),game->GetPlayer()->GetPos())*ConfigFloat("Bullet Speed"),ConfigFloat("Bullet Radius"),ConfigFloat("Bullet Damage"),m.OnUpperLevel(),false,ConfigPixel("Bullet Color"),{ConfigFloat("Bullet Radius"),ConfigFloat("Bullet Radius")})EndBullet;
else CreateBullet(Bullet)(m.GetPos(),util::pointTo(m.GetPos(),game->GetPlayer()->GetPos())*ConfigFloat("Bullet Speed"),ConfigFloat("Bullet Radius"),ConfigFloat("Bullet Damage"),m.OnUpperLevel(),false,ConfigPixel("Bullet Color"),{ConfigFloat("Bullet Radius"),ConfigFloat("Bullet Radius")})EndBullet;
*/
goto BulletShot;
}
m.I(A::BULLET_COUNT_AFTER_INK_ATTACK)++;

@ -108,9 +108,7 @@ void IBullet::_Update(const float fElapsedTime){
if(m->Hurt(damageData)){
hitList.insert(&*m);
if(!hitsMultiple){
if(_MonsterHit(*m,markStacksBeforeHit)==BulletDestroyState::DESTROY){
dead=true;
}
if(_MonsterHit(*m,markStacksBeforeHit)==BulletDestroyState::DESTROY)dead=true;
return false;
}else _MonsterHit(*m,markStacksBeforeHit);
if(!CollisionCheckRequired())return false;
@ -127,9 +125,7 @@ void IBullet::_Update(const float fElapsedTime){
if(game->GetPlayer()->Hurt(damageData)){
hitList.insert(game->GetPlayer());
if(!hitsMultiple){
if(_PlayerHit(&*game->GetPlayer())==BulletDestroyState::DESTROY){
dead=true;
}
if(_PlayerHit(&*game->GetPlayer())==BulletDestroyState::DESTROY)dead=true;
return false;
}else _PlayerHit(&*game->GetPlayer());
if(!CollisionCheckRequired())return false;
@ -172,6 +168,8 @@ void IBullet::_Update(const float fElapsedTime){
}
void IBullet::_Draw()const{
game->SetDecalMode(DecalMode::NORMAL);
if(additiveBlending)game->SetDecalMode(DecalMode::ADDITIVE);
Pixel blendCol=col;
if(fadeInTime==0&&fadeOutTime==0)blendCol.a=col.a;
@ -190,6 +188,7 @@ void IBullet::_Draw()const{
blendCol.a/=1.59f; //Comes from 255 divided by 160 which is roughly what we want the alpha to be when the bullet has full transparency.
}
Draw(blendCol);
game->SetDecalMode(DecalMode::NORMAL);
}
void IBullet::Draw(const Pixel blendCol)const{

@ -83,6 +83,7 @@ protected:
virtual void Update(float fElapsedTime);
void Deactivate();
void Activate();
bool additiveBlending{false};
private:
float fadeOutTimer=0;
float fadeInTimer=0;

@ -0,0 +1,52 @@
#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 "AdventuresInLestoria.h"
INCLUDE_game
Ink::Ink(vf2d pos,float radius,float lifetime,float fadeinTime,float fadeoutTime,vf2d size,Pixel col,bool onUpperLevel,float rotation)
:Effect(pos,lifetime,"ink.png",onUpperLevel,fadeinTime,fadeoutTime,size,{},EffectType::NONE,col,rotation,0.f,false),radius(radius){}
bool Ink::Update(float fElapsedTime){
const float distToPlayer{util::distance(game->GetPlayer()->GetPos(),pos)};
if(distToPlayer<=radius){
Buff&currentInkSlowdown{game->GetPlayer()->GetOrAddBuff(BuffType::INK_SLOWDOWN,{lifetime,0})};
currentInkSlowdown.intensity++;
}
return Effect::Update(fElapsedTime);
}

@ -34,4 +34,33 @@ Portions of this software are copyright
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#pragma endregion
#include "BulletTypes.h"
INCLUDE_ANIMATION_DATA
InkBullet::InkBullet(const vf2d pos,const vf2d targetPos,const vf2d vel,const float inkExplosionRadius,const float inkPuddleLifetime,const float inkPuddleRadius,const bool upperLevel,const bool friendly)
:Bullet(pos,vel,inkExplosionRadius,0,"inkbullet.png",upperLevel,friendly),targetPos(targetPos),inkExplosionRadius(inkExplosionRadius),inkSlowdownPct(inkSlowdownPct),inkPuddleLifetime(inkPuddleLifetime),inkPuddleRadius(inkPuddleRadius){
additiveBlending=true;
}
void InkBullet::Update(float fElapsedTime){
const float magnitude{vel.mag()};
vel=util::pointTo(pos,targetPos)*magnitude;
if(util::distance(pos,targetPos)<=8.f){Splat();}
else if(GetAliveTime()>=30.f)ERR(std::format("WARNING! An Ink Bullet did not resolve to target position {} in time! Last reported pos: {}! THE DISTANCE THRESHOLD FOR INK EXPLOSIONS IS LIKELY TOO HIGH! THIS SHOULD NOT BE HAPPENING!",targetPos.str(),pos.str())); //NOTE: THIS SHOULD NOT BE HAPPENING! If this does, then we probably just set the distance threshold WAY TOO LOW! Let's crash for now.
}
void InkBullet::Splat(){
game->AddEffect(std::make_unique<Effect>(pos,ANIMATION_DATA["inkbubble_explode.png"].GetTotalAnimationDuration(),"inkbubble_explode.png",OnUpperLevel(),vf2d{1.f,1.f},0.f,vf2d{},WHITE,0.f,0.f,additiveBlending));
game->AddEffect(std::make_unique<Ink>(pos,inkPuddleRadius,inkPuddleLifetime,0.4f,0.4f,vf2d{1.f,1.f},WHITE,OnUpperLevel(),int(util::random_range(0,4.f))*PI/2),true);
lifetime=0.f;
}
BulletDestroyState InkBullet::PlayerHit(Player*player){
Splat();
return BulletDestroyState::DESTROY;
}
BulletDestroyState InkBullet::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
Splat();
return BulletDestroyState::DESTROY;
}
void InkBullet::ModifyOutgoingDamageData(HurtDamageInfo&data){}

@ -330,6 +330,9 @@ float Player::GetMoveSpdMult(){
for(const Buff&b:GetBuffs(BuffType::ADRENALINE_RUSH)){
mod_moveSpd+=moveSpdPct*"Thief.Ability 3.Movement Speed Increase"_F/100.f;
}
for(const Buff&b:GetBuffs(BuffType::INK_SLOWDOWN)){
mod_moveSpd-=moveSpdPct*(b.intensity*"MonsterStrategy.Giant Octopus.Phase 2.Ink Slowdown Amount"_F/100.f);
}
return mod_moveSpd;
}

@ -52,12 +52,14 @@ void RotateBullet::Update(float fElapsedTime){
BulletDestroyState RotateBullet::PlayerHit(Player*player){
fadeOutTime=0.2f;
player->ApplyIframes(0.2f);
Deactivate();
return BulletDestroyState::KEEP_ALIVE;
}
BulletDestroyState RotateBullet::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
fadeOutTime=0.2f;
monster.ApplyIframes(0.2f);
Deactivate();
return BulletDestroyState::KEEP_ALIVE;
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 11896
#define VERSION_BUILD 11900
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -1281,12 +1281,13 @@ MonsterStrategy
Phase 2
{
Ink Bullet Speed = 250
Ink Bullet Speed = 120
Ink Bullet Frequency = 15s
Ink Explosion Radius = 57px
# Movespeed to decrease by
Ink Slowdown Amount = 10%
Ink Slowdown Amount = 30%
Ink Puddle Lifetime = 30s
Ink Puddle Collision Radius = 28px
Homing Bullet Starts After = 6 Ink Bullets
# Every nth bullet will be a homing bullet, n determined by this value
Homing Bullet Frequency = 2 Bullets

@ -144,6 +144,8 @@ Images
GFX_BurstBullet = burstbullet.png
GFX_BurstRotateBullet = burstrotatebullet.png
GFX_InkBullet = inkbullet.png
GFX_InkBubbleExplode = inkbubble_explode.png
GFX_Ink = ink.png
GFX_Thief_Sheet = nico-thief.png
GFX_Trapper_Sheet = nico-trapper.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Loading…
Cancel
Save