Inactive/Active ring status based on being in/out of combat.

This commit is contained in:
sigonasr2 2023-11-19 13:40:01 -06:00
parent eeb24934a3
commit 5b28478596
9 changed files with 26 additions and 3 deletions

View File

@ -665,7 +665,12 @@ void Crawler::RenderWorld(float fElapsedTime){
auto RenderZone=[&](geom2d::rect<int>&zone){ auto RenderZone=[&](geom2d::rect<int>&zone){
game->SetDecalMode(DecalMode::ADDITIVE); game->SetDecalMode(DecalMode::ADDITIVE);
view.DrawDecal(zone.pos,GFX["finishring.png"].Decal(),vf2d(zone.size)/vf2d(GFX["finishring.png"].Sprite()->Size()),{255,255,255,uint8_t(abs(sin(game->levelTime))*255)}); Pixel ringColor={64,255,64,uint8_t(abs(sin(game->levelTime))*255)};
if(!player->IsOutOfCombat()){
game->SetDecalMode(DecalMode::NORMAL);
ringColor.r=ringColor.g=ringColor.b=64;
}
view.DrawDecal(zone.pos,GFX["finishring.png"].Decal(),vf2d(zone.size)/vf2d(GFX["finishring.png"].Sprite()->Size()),ringColor);
game->SetDecalMode(DecalMode::NORMAL); game->SetDecalMode(DecalMode::NORMAL);
}; };

View File

@ -71,7 +71,7 @@ vf2d&Monster::GetPos(){
} }
int Monster::GetHealth(){ int Monster::GetHealth(){
return hp; return hp;
} }
int Monster::GetAttack(){ int Monster::GetAttack(){
float mod_atk=atk; float mod_atk=atk;
for(Buff&b:GetBuffs(ATTACK_UP)){ for(Buff&b:GetBuffs(ATTACK_UP)){
@ -277,6 +277,7 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){
if(game->InBossEncounter()){ if(game->InBossEncounter()){
game->StartBossEncounter(); game->StartBossEncounter();
} }
game->GetPlayer()->ResetLastCombatTime();
float mod_dmg=damage; float mod_dmg=damage;
for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){ for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){
mod_dmg-=damage*b.intensity; mod_dmg-=damage*b.intensity;

View File

@ -222,6 +222,7 @@ void Player::Update(float fElapsedTime){
notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime); notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime);
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime); lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
blockTimer=std::max(0.f,blockTimer-fElapsedTime); blockTimer=std::max(0.f,blockTimer-fElapsedTime);
lastCombatTime=lastCombatTime+fElapsedTime;
manaTickTimer-=fElapsedTime; manaTickTimer-=fElapsedTime;
if(castInfo.castTimer>0){ if(castInfo.castTimer>0){
castInfo.castTimer-=fElapsedTime; castInfo.castTimer-=fElapsedTime;
@ -553,6 +554,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
if(hp<=0||HasIframes()||OnUpperLevel()!=onUpperLevel||abs(GetZ()-z)>1) return false; if(hp<=0||HasIframes()||OnUpperLevel()!=onUpperLevel||abs(GetZ()-z)>1) return false;
if(GetState()==State::BLOCK)damage*=1-"Warrior.Right Click Ability.DamageReduction"_F; if(GetState()==State::BLOCK)damage*=1-"Warrior.Right Click Ability.DamageReduction"_F;
float mod_dmg=damage; float mod_dmg=damage;
lastCombatTime=0;
for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){ for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){
mod_dmg-=damage*b.intensity; mod_dmg-=damage*b.intensity;
} }
@ -749,4 +751,12 @@ void Player::ConsumeMana(int amt){
void Player::SetSizeMult(float size){ void Player::SetSizeMult(float size){
this->size=size; this->size=size;
}
void Player::ResetLastCombatTime(){
lastCombatTime=0;
}
bool Player::IsOutOfCombat(){
return lastCombatTime>="Player.Out of Combat Time"_F;
} }

View File

@ -91,6 +91,7 @@ private:
std::shared_ptr<DamageNumber>damageNumberPtr; std::shared_ptr<DamageNumber>damageNumberPtr;
void Initialize(); void Initialize();
float iframe_time=0; float iframe_time=0;
float lastCombatTime=0;
protected: protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;
@ -189,6 +190,8 @@ public:
Key GetLastReleasedMovementKey(); Key GetLastReleasedMovementKey();
float GetSwordSwingTimer(); float GetSwordSwingTimer();
bool OnUpperLevel(); bool OnUpperLevel();
void ResetLastCombatTime();
bool IsOutOfCombat();
//Triggers when the player has moved. //Triggers when the player has moved.
void Moved(); void Moved();
virtual ~Player()=default; virtual ~Player()=default;

View File

@ -33,7 +33,7 @@ SUCH DAMAGE.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 2903 #define VERSION_BUILD 2920
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -12,6 +12,9 @@ Player
# How many of any one type of item we can bring to the battlefield max per slot. # How many of any one type of item we can bring to the battlefield max per slot.
Item Loadout Limit = 10 Item Loadout Limit = 10
# How many seconds must pass before the player is considered out of combat (meaning they can exit a level)
Out of Combat Time = 5.0
# Each attack will have _N,_E,_S,_W appended to them once read in-game. # Each attack will have _N,_E,_S,_W appended to them once read in-game.
PLAYER_ANIMATION[0] = WARRIOR_WALK PLAYER_ANIMATION[0] = WARRIOR_WALK
PLAYER_ANIMATION[1] = WARRIOR_IDLE PLAYER_ANIMATION[1] = WARRIOR_IDLE

View File

@ -39,6 +39,7 @@ Images
GFX_SkillOverlayIcon = skill_overlay_icon.png GFX_SkillOverlayIcon = skill_overlay_icon.png
GFX_SkillOverlayIconOverlay = skill_overlay_icon_overlay.png GFX_SkillOverlayIconOverlay = skill_overlay_icon_overlay.png
GFX_FinishRing = finishring.png GFX_FinishRing = finishring.png
GFX_FinishRingGreen = finishring_green.png
# Ability Icons # Ability Icons
GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB