From 90da4c9f8a50ec730fc237d9c7b622a94b164f95 Mon Sep 17 00:00:00 2001 From: AMay Date: Mon, 8 Jun 2026 14:22:12 -0500 Subject: [PATCH] Merge with stash --- Adventures in Lestoria/Entity.cpp | 2 +- Adventures in Lestoria/Entity.h | 2 +- Adventures in Lestoria/Monster.cpp | 1 + Adventures in Lestoria/Monster.h | 3 ++- Adventures in Lestoria/MonsterAttribute.h | 1 + Adventures in Lestoria/Thief.cpp | 9 ++++++--- Adventures in Lestoria/Warrior+Thief.cpp | 15 +++++++++++++++ Adventures in Lestoria/Warrior.cpp | 2 +- .../assets/config/MonsterStrategies.txt | 11 +++++++++++ 9 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Adventures in Lestoria/Entity.cpp b/Adventures in Lestoria/Entity.cpp index 628de57c..fe1ec5a4 100644 --- a/Adventures in Lestoria/Entity.cpp +++ b/Adventures in Lestoria/Entity.cpp @@ -56,7 +56,7 @@ const vf2d Entity::GetPos()const{ CallClassFunc(GetPos()); } -void Entity::SetIframeTime(const float iframeTime){ +void Entity::ApplyIframes(const float iframeTime){ CallClassFunc(ApplyIframes(iframeTime)); } diff --git a/Adventures in Lestoria/Entity.h b/Adventures in Lestoria/Entity.h index 57519579..02f43d85 100644 --- a/Adventures in Lestoria/Entity.h +++ b/Adventures in Lestoria/Entity.h @@ -63,7 +63,7 @@ public: Player*const ToPlayer()const; Monster*const ToMonster()const; const vf2d GetPos()const; - void SetIframeTime(const float iframeTime); + void ApplyIframes(const float iframeTime); Buff&GetOrAddBuff(BuffType buffType,std::pairnewBuff); const std::optionalGetBuff(BuffType buff)const; const float GetDistanceFrom(vf2d target)const; diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index edd660ab..ad96a3ab 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -567,6 +567,7 @@ void Monster::Draw()const{ const float finalSpriteRot=HasFourWaySprites()?0.f:spriteRot; //Prevent 4-way sprites from being rotated. vf2d imageScale{vf2d(GetSizeMult()*(!HasFourWaySprites()&&GetFacingDirection()==Direction::EAST?-1:1),GetSizeMult())}; + imageScale.y*=ySquishFactor; if(GetRemainingStunDuration()>0.f)imageScale*=abs(sin(3*PI*game->GetRunTime()))*0.15f+0.85f; const vf2d glowPurpleImageScale{imageScale*1.1f}; diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index c1fd6afb..a8f75ff5 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -367,6 +367,7 @@ public: void SetTransparency(uint8_t alpha); uint8_t GetTransparency()const; void Spin(float duration,float spinSpd); + float friction=400; private: //NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!! // The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop. @@ -374,7 +375,6 @@ private: std::string name; vf2d pos; vf2d vel={0,0}; - float friction=400; vf2d target{}; float targetAcquireTimer=0; vf2d spawnPos; @@ -486,6 +486,7 @@ private: vf2d addedVel{}; std::weak_ptrattachedTarget; //A monster attached to another monster can then use this to alter behaviors based on the state of that other monster. float unconsciousTimer{}; + float ySquishFactor{1.f}; #ifdef UNIT_TESTING public: #endif diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h index 7b714fd7..15e3e831 100644 --- a/Adventures in Lestoria/MonsterAttribute.h +++ b/Adventures in Lestoria/MonsterAttribute.h @@ -188,4 +188,5 @@ enum class Attribute{ SPIN_STATE_ENUM_SLOT, SPIN_ATTACK_TIMER, SPIN_ANGLE, + ROLLING_TIMER, }; \ No newline at end of file diff --git a/Adventures in Lestoria/Thief.cpp b/Adventures in Lestoria/Thief.cpp index 40bd541a..d222e595 100644 --- a/Adventures in Lestoria/Thief.cpp +++ b/Adventures in Lestoria/Thief.cpp @@ -106,9 +106,12 @@ bool Thief::AutoAttack(){ void Thief::InitializeClassAbilities(){ #pragma region Thief Right-click Ability (Roll) Thief::rightClickAbility.action= - [](Entity e,vf2d pos={}){Player*p=e.ToPlayer(); //TODO - p->SetState(State::ROLL); - p->rolling_timer="Thief.Right Click Ability.Roll Time"_F; + [](Entity e,vf2d pos={}){ + IFPLAYER{ + p.SetState(State::ROLL); + p.rolling_timer=CONFIG_F("Thief.Right Click Ability.Roll Time"); + }ENDIF + IFMONSTER{m.F(A::ROLLING_TIMER)=CONFIG_F("Thief.Right Click Ability.Roll Time");}ENDIF const float originalRollIntensity{"Thief.Right Click Ability.Movespeed Buff"_f[0]/100.f}; float rollIntensity{originalRollIntensity}; diff --git a/Adventures in Lestoria/Warrior+Thief.cpp b/Adventures in Lestoria/Warrior+Thief.cpp index 9bd7c56f..c45602a4 100644 --- a/Adventures in Lestoria/Warrior+Thief.cpp +++ b/Adventures in Lestoria/Warrior+Thief.cpp @@ -46,12 +46,14 @@ DEFINE_STRATEGY(WARRIORTHIEF) INIT, RUN, SPIN, + ROLL, }; switch(PHASE()){ case INIT:{ m.F(A::DEFENSIVE_COOLDOWN)=0.f; SETPHASE(RUN); m.I(A::SPIN_STATE_ENUM_SLOT)=SPIN; + m.I(A::ROLL_STATE_ENUM_SLOT)=ROLL; }break; case RUN:{ m.F(A::DEFENSIVE_COOLDOWN)-=game->GetElapsedTime(); @@ -90,5 +92,18 @@ DEFINE_STRATEGY(WARRIORTHIEF) SETPHASE(RUN); } }break; + case ROLL:{ + footstepTimer-=fElapsedTime; + if(facingDirection==Direction::EAST)spin_angle+=util::degToRad("Thief.Right Click Ability.Roll Rotation Speed"_F)*fElapsedTime; + else spin_angle-=util::degToRad("Thief.Right Click Ability.Roll Rotation Speed"_F)*fElapsedTime; + ySquishFactor=0.5f*sin((PI*fElapsedTime)/"Thief.Right Click Ability.Bounce Period Time"_F)+0.5f; + if(rolling_timer<=0.f){ + SetState(State::NORMAL); + } + if(footstepTimer<=0.f){ + game->PlayFootstepSound(); + footstepTimer=0.05f; + } + }break; } END_STRATEGY \ No newline at end of file diff --git a/Adventures in Lestoria/Warrior.cpp b/Adventures in Lestoria/Warrior.cpp index 81caa832..8b09d8f9 100644 --- a/Adventures in Lestoria/Warrior.cpp +++ b/Adventures in Lestoria/Warrior.cpp @@ -143,7 +143,7 @@ void Warrior::InitializeClassAbilities(){ Warrior::ability2.action= [](Entity e,vf2d pos={}){ e.Spin(CONFIG_F("Warrior.Ability 2.SpinTime"),CONFIG_F("Warrior.Ability 2.SpinSpd")*PI); - e.SetIframeTime(CONFIG_F("Warrior.Ability 2.IframeTime")); + e.ApplyIframes(CONFIG_F("Warrior.Ability 2.IframeTime")); return true; }; #pragma endregion diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index db3705a9..09edf1cd 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -1546,5 +1546,16 @@ MonsterStrategy Warrior.Ability 3.ShakeTime = 0.5 + + # % speed increase, duration + Thief.Right Click Ability.Movespeed Buff = 30%, 2 seconds + Thief.Right Click Ability.Roll Time = 0.3s + Thief.Right Click Ability.Iframe Time = 0.5s + # How fast one period of the roll bounce cycle is. + Thief.Right Click Ability.Bounce Period Time = 0.045s + # How much to squish the sprite + Thief.Right Click Ability.Bounce Max Squish Amount = 60% + Thief.Right Click Ability.Roll Rotation Speed = 1280deg/s + Thief.Right Click Ability.Max Roll Range = 250 } } \ No newline at end of file