Merge with stash
Some checks failed
Emscripten Build / UnitTesting (push) Has been cancelled
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled

This commit is contained in:
AMay 2026-06-08 14:22:12 -05:00
parent cd1e033798
commit 90da4c9f8a
9 changed files with 39 additions and 7 deletions

View File

@ -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));
}

View File

@ -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::pair<BuffDuration,BuffIntensity>newBuff);
const std::optional<Buff>GetBuff(BuffType buff)const;
const float GetDistanceFrom(vf2d target)const;

View File

@ -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};

View File

@ -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_ptr<Monster>attachedTarget; //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

View File

@ -188,4 +188,5 @@ enum class Attribute{
SPIN_STATE_ENUM_SLOT,
SPIN_ATTACK_TIMER,
SPIN_ANGLE,
ROLLING_TIMER,
};

View File

@ -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};

View File

@ -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

View File

@ -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

View File

@ -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
}
}