Commit ef5f410e authored by AL's avatar AL

damage text ajust

parent 796213d2
......@@ -5,23 +5,6 @@
using namespace std::string_literals;
bool CombatEntity::SufferPhysicalDamage(size_t incDmg)
{
if (incDmg < HP + block) //if does not kill
{
incDmg -= block;
incDmg = (std::max)((int)0, (int)incDmg);
HP -= incDmg;
if (block >= incDmg)return false; else return true;
}
else
{
HP = 0;
OnDeath();
return true;
}
}
void CombatEntity::SufferPureDamage(size_t incDmg)
{
if (incDmg < HP) //if does not kill
......
......@@ -68,7 +68,7 @@ public:
}
void OnDeath();
bool IsDead();
virtual bool SufferPhysicalDamage(size_t incDmg); //returns 1 if damage was suffered and 0 if it was blocked
virtual size_t SufferPhysicalDamage(size_t incDmg) = 0; //returns 1 if damage was suffered and 0 if it was blocked
void SufferPureDamage(size_t incDmg);
virtual void DumpTemporaryStatus() = 0;
void AddEvent(SkillEvent incEv)
......
......@@ -427,17 +427,37 @@ void CombatManager::ChoseUpgrade()
rewardMenuIsActive = false;
}
void CombatManager::DrawDamage(bool missed, size_t dmg, bool crited, bool bleed) const
{
void CombatManager::DrawDamage(bool missed, size_t dmg, bool crited, bool bleed, bool playerProduced) const
{
if (missed)
{
TD::DrawStringTimed(L"MISS!", Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::White, 0.1f);
TD::DrawStringTimed(L"MISS!", Vec2{ -0.1f, -0.8f }, Colors::White, 0.15f);
}
else
{
if (crited)TD::DrawStringTimed(L"CRIT!", Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::Red, 0.1f);
if (bleed) TD::DrawStringTimed(L"BLEED!", Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::Red, 0.1f);
TD::DrawStringTimed(std::to_wstring(dmg), Vec2(RU.GetFloat(-DDDR, DDDR), RU.GetFloat(-DDDR, DDDR)), Colors::Yellow, 0.1f);
if (playerProduced)
{
if (crited)TD::DrawStringTimed(L"CRIT!", Vec2(0.1f, 0.5f), Colors::Cyan, 0.11f);
if (bleed) TD::DrawStringTimed(L"BLEED!", Vec2(-0.1f, 0.69f), Colors::Red, 0.11f);
if(dmg!=0u)
if(crited||bleed)
TD::DrawStringTimed(std::to_wstring(dmg), Vec2(-0.1f, 0.5f), Colors::Red, 0.13f);
else
TD::DrawStringTimed(std::to_wstring(dmg), Vec2(-0.1f, 0.5f), Colors::Yellow, 0.13f);
else
TD::DrawStringTimed(L"BLOCKED!", Vec2(-0.1f, 0.5f), Colors::LightBlue, 0.11f);
}
else
{
if (bleed) TD::DrawStringTimed(L"BLEED!", Vec2{ -0.12f, -0.6f }, Colors::Red, 0.12f);
if (dmg != 0u)
if(bleed)
TD::DrawStringTimed(std::to_wstring(dmg), Vec2(-0.05f, -0.84f), Colors::Red, 0.13f);
else
TD::DrawStringTimed(std::to_wstring(dmg), Vec2(-0.05f, -0.84f), Colors::Yellow, 0.13f);
else
TD::DrawStringTimed(L"BLOCKED!", Vec2(-0.14f, -0.88f), Colors::LightBlue, 0.11f);
}
}
}
......@@ -480,6 +500,7 @@ void CombatManager::HandleEvent(SkillEvent ev)
{
float fRoll;
size_t sDmg = 0u;
size_t dealtDmg = 0u;
bool attacked = false;
bool crit = false;
bool miss = false;
......@@ -494,7 +515,7 @@ void CombatManager::HandleEvent(SkillEvent ev)
if (fRoll < (enMan->GetCurAcc() * (1 - playMan->GetDodge())))
{
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh);//hit
if (playMan->SufferPhysicalDamage(sDmg))
if (dealtDmg = playMan->SufferPhysicalDamage(sDmg))
CM::PendScenario(CM::Scenario::GhoulAttack);
else
CM::PendScenario(CM::Scenario::GhoulAttackBlock);
......@@ -528,13 +549,13 @@ void CombatManager::HandleEvent(SkillEvent ev)
if (playMan->GetBlock() < sDmg)
{
playMan->AddBleed(OneBleedStackEmount);
playMan->SufferPhysicalDamage(sDmg); // bleed got through block
dealtDmg = playMan->SufferPhysicalDamage(sDmg); // bleed got through block
bleed = true;
CM::PendScenario(CM::Scenario::GhoulAttack);
}
else
{
playMan->SufferPhysicalDamage(sDmg); // bleed blocked
dealtDmg = playMan->SufferPhysicalDamage(sDmg); // bleed blocked
CM::PendScenario(CM::Scenario::GhoulAttackBlock);
}
}
......@@ -561,7 +582,7 @@ void CombatManager::HandleEvent(SkillEvent ev)
if (fRoll < playMan->GetCritMod())
{
sDmg = 2u * RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh); //crit
enMan->SufferPhysicalDamage(sDmg);
dealtDmg = enMan->SufferPhysicalDamage(sDmg);
crit = true;
SPI::Play(Sounds::CritWave, 0.5f, 1.4f);
......@@ -569,7 +590,7 @@ void CombatManager::HandleEvent(SkillEvent ev)
else
{
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh);
enMan->SufferPhysicalDamage(sDmg);
dealtDmg = enMan->SufferPhysicalDamage(sDmg);
}
break;
case EventType::Enemy_DecreaceAcc:
......@@ -592,14 +613,14 @@ void CombatManager::HandleEvent(SkillEvent ev)
if (enMan->GetBlock() < sDmg)
{
enMan->AddBleed(OneBleedStackEmount);
enMan->SufferPhysicalDamage(sDmg); //bleed got through block
dealtDmg = enMan->SufferPhysicalDamage(sDmg); //bleed got through block
crit = true;
bleed = true;
SPI::Play(Sounds::CritWave, 0.6f, 1.5f);
}
else
{
enMan->SufferPhysicalDamage(sDmg); //bleed blocked
dealtDmg = enMan->SufferPhysicalDamage(sDmg); //bleed blocked
crit = true;
SPI::Play(Sounds::CritWave, 0.6f, 1.5f);
}
......@@ -610,12 +631,12 @@ void CombatManager::HandleEvent(SkillEvent ev)
if (enMan->GetBlock() < sDmg)
{
enMan->AddBleed(OneBleedStackEmount);
enMan->SufferPhysicalDamage(sDmg); //bleed got through block
dealtDmg = enMan->SufferPhysicalDamage(sDmg); //bleed got through block
bleed = true;
}
else
{
enMan->SufferPhysicalDamage(sDmg); //bleed blocked
dealtDmg = enMan->SufferPhysicalDamage(sDmg); //bleed blocked
}
}
break;
......@@ -633,8 +654,10 @@ void CombatManager::HandleEvent(SkillEvent ev)
assert(false && "stray combat event detected! check switch statement");
break;
}
//displaying damage
if (attacked)
DrawDamage(miss, sDmg, crit, bleed);
DrawDamage(miss, dealtDmg, crit, bleed, playerProduced);
//hanling additional player crit stuff
if (playerProduced && crit)
{
AM::Alert(AM::Event::PlayerCrited);
......
......@@ -103,7 +103,7 @@ private:
if (killcount >= 5u)AM::Alert(AM::Event::PlayerKilled5Enemies);
}
void DrawDamage(bool missed = false, size_t dmg = 0u, bool crited = false, bool bleed = false) const;
void DrawDamage(bool missed = false, size_t dmg = 0u, bool crited = false, bool bleed = false, bool playerProduced = true) const;
void UpdateCombatData();
void HandleEvents();
void HandleEvent(SkillEvent ev);
......
......@@ -10,7 +10,7 @@ EnemyCombat::EnemyCombat()
activeStatusEffects[StatusEffects::Accuracy].first = baseAcc;
}
bool EnemyCombat::SufferPhysicalDamage(size_t incDmg)
size_t EnemyCombat::SufferPhysicalDamage(size_t incDmg)
{
if (incDmg < HP + block) //if does not kill
{
......@@ -18,7 +18,7 @@ bool EnemyCombat::SufferPhysicalDamage(size_t incDmg)
{
SPI::Play(Sounds::Ghoul_Block, 1.0f, (std::max)(0.1f, (std::min)(0.6f, incDmg*0.06f)));
SPI::Play(Sounds::Ghoul_oh_02, 1.0f, 0.1f);
return false;
return 0u;
}
else
{
......@@ -27,15 +27,16 @@ bool EnemyCombat::SufferPhysicalDamage(size_t incDmg)
if (block) SPI::Play(Sounds::Ghoul_Block, 1.0f, (std::max)(0.1f, (std::min)(0.6f, block*0.035f)));
SPI::Play(Sounds::Cut, 1.0f, (std::max)(0.1f,(std::min)(0.6f,incDmg*0.08f)));
SPI::Play(Sounds::Ghoul_oh_01, 1.0f, (std::max)(0.1f, (std::min)(0.6f, incDmg*0.08f)));
return true;
return incDmg;
}
}
else
{
auto dmg = HP;
SPI::Play(Sounds::Ghoul_Death);
HP = 0;
OnDeath();
return true;
return dmg;
}
}
float EnemyCombat::GetCurAcc() const
......
......@@ -24,7 +24,7 @@ public:
virtual ~EnemyCombat() = default;
bool SufferPhysicalDamage(size_t incDmg) override;
size_t SufferPhysicalDamage(size_t incDmg) override;
float GetCurAcc()const;
......
......@@ -2,10 +2,10 @@
# www.blender.org
mtllib GhoulPrepareRage.mtl
o Plane
v -1.000000 0.000000 0.800000
v 0.600000 0.000000 0.800000
v -1.000000 0.000000 -0.800000
v 0.600000 0.000000 -0.800000
v -1.000000 0.000000 0.850000
v 0.700000 0.000000 0.850000
v -1.000000 0.000000 -0.850000
v 0.700000 0.000000 -0.850000
vt 0.999900 0.999900
vt 0.000100 0.000100
vt 0.999900 0.000100
......
......@@ -2,10 +2,10 @@
# www.blender.org
mtllib GhoulRage.mtl
o Plane
v -1.000000 0.000000 0.800000
v 0.600000 0.000000 0.800000
v -1.000000 0.000000 -0.800000
v 0.600000 0.000000 -0.800000
v -1.000000 0.000000 0.850000
v 0.700000 0.000000 0.850000
v -1.000000 0.000000 -0.850000
v 0.700000 0.000000 -0.850000
vt 0.999900 0.999900
vt 0.000100 0.000100
vt 0.999900 0.000100
......
Engine/Media/Sprites/font.png

17.5 KB | W: | H:

Engine/Media/Sprites/font.png

17.5 KB | W: | H:

Engine/Media/Sprites/font.png
Engine/Media/Sprites/font.png
Engine/Media/Sprites/font.png
Engine/Media/Sprites/font.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -85,14 +85,14 @@ void PlayerManager::Reset()
isDead = false;
}
bool PlayerManager::SufferPhysicalDamage(size_t incDmg)
size_t PlayerManager::SufferPhysicalDamage(size_t incDmg)
{
if (incDmg < HP + block) //if does not kill
{
if (block >= incDmg)
{
SPI::Play(Sounds::Player_Block, 1.0f, (std::max)(0.1f, (std::min)(0.8f, incDmg*0.1f)));
return false;
return 0u;
}
else
{
......@@ -101,15 +101,16 @@ bool PlayerManager::SufferPhysicalDamage(size_t incDmg)
if (block) SPI::Play(Sounds::Player_Block, 1.0f, (std::max)(0.1f, (std::min)(0.8f, block*0.015f)));
SPI::Play(Sounds::Player_Hit, 1.0f, (std::max)(0.1f, (std::min)(0.9f, incDmg*0.09f))); //not sure if this works
AM::Alert(AM::Event::PlayerLostHP);
return true;
return incDmg;
}
}
else
{
auto dmg = HP;
HP = 0;
OnDeath();
AM::Alert(AM::Event::PlayerLostHP);
return true;
return dmg;
}
}
......
......@@ -17,7 +17,7 @@ public:
bool ProcessInput(const char input);
bool SufferPhysicalDamage(size_t incDmg) override;
size_t SufferPhysicalDamage(size_t incDmg) override;
float GetCritMod()const;
......
......@@ -46,14 +46,14 @@ void PlayerStatusBar::SmartSubmit(FrameCommander& fc) const
//handling ascending text
if (previousCD.playerBlock > cd.playerBlock)
TD::DrawStringAscending( std::to_wstring((int)cd.playerBlock - (int)previousCD.playerBlock), blockOffset, Colors::LightBlue, textSize);
TD::DrawStringAscending( std::to_wstring((int)cd.playerBlock - (int)previousCD.playerBlock), blockOffset, Colors::LightBlue, ascSize);
else if(previousCD.playerBlock < cd.playerBlock)
TD::DrawStringAscending(L"+" + std::to_wstring( cd.playerBlock - previousCD.playerBlock), blockOffset, Colors::LightBlue, textSize);
TD::DrawStringAscending(L"+" + std::to_wstring( cd.playerBlock - previousCD.playerBlock), blockOffset, Colors::LightBlue, ascSize);
if (previousCD.playerHP > cd.playerHP)
TD::DrawStringAscending( std::to_wstring((int)cd.playerHP - (int)previousCD.playerHP), healthOffset, Colors::Red, textSize);
TD::DrawStringAscending( std::to_wstring((int)cd.playerHP - (int)previousCD.playerHP), healthOffset, Colors::Red, ascSize);
else if (previousCD.playerHP < cd.playerHP)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.playerHP - previousCD.playerHP), healthOffset, Colors::Green, textSize);
TD::DrawStringAscending(L"+" + std::to_wstring(cd.playerHP - previousCD.playerHP), healthOffset, Colors::Green, ascSize);
previousCD.playerHP = cd.playerHP;
previousCD.playerMaxHP = cd.playerMaxHP;
......@@ -78,14 +78,14 @@ void EnemyStatusBar::SmartSubmit(FrameCommander& fc) const
//handling ascending text
if (previousCD.enemyBlock > cd.enemyBlock)
TD::DrawStringAscending( std::to_wstring((int)cd.enemyBlock - (int)previousCD.enemyBlock), blockOffset, Colors::LightBlue, textSize, 1.0f, -textSpeed);
TD::DrawStringAscending( std::to_wstring((int)cd.enemyBlock - (int)previousCD.enemyBlock), blockOffset, Colors::LightBlue, ascSize, 1.0f, -textSpeed);
else if (previousCD.enemyBlock < cd.enemyBlock)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyBlock - previousCD.enemyBlock), blockOffset, Colors::LightBlue, textSize, 1.0f, -textSpeed);
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyBlock - previousCD.enemyBlock), blockOffset, Colors::LightBlue, ascSize, 1.0f, -textSpeed);
if (previousCD.enemyHP > cd.enemyHP)
TD::DrawStringAscending( std::to_wstring((int)cd.enemyHP - (int)previousCD.enemyHP), healthOffset, Colors::Red, textSize, 1.0f, -textSpeed);
TD::DrawStringAscending( std::to_wstring((int)cd.enemyHP - (int)previousCD.enemyHP), healthOffset, Colors::Red, ascSize, 1.0f, -textSpeed);
else if (previousCD.enemyHP < cd.enemyHP)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyHP - previousCD.enemyHP), healthOffset, Colors::Green, textSize, 1.0f, -textSpeed);
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyHP - previousCD.enemyHP), healthOffset, Colors::Green, ascSize, 1.0f, -textSpeed);
previousCD.enemyHP = cd.enemyHP;
previousCD.enemyMaxHP = cd.enemyMaxHP;
......
......@@ -19,7 +19,8 @@ protected:
Vec2 blockOffset;
Vec2 healthOffset;
static constexpr float textSpeed = 0.15f;
static constexpr float textSize = 0.02f;
static constexpr float textSize = 0.028f;
static constexpr float ascSize = 0.036f;
};
class PlayerStatusBar : public StatusBar
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment