Commit c5337820 authored by AL's avatar AL

minorsuffer damage func rework + added cam manager scenarios

parent 47f3baf5
......@@ -21,7 +21,7 @@ void CameraManager::Update(float dt)
{
switch (pendingScenarios.back())
{
case Scenario:: ThrowSand:
case Scenario:: ThrowSand: //called from player skill
{
CamSequence cs;
float v0 = 0.18f;
......@@ -33,7 +33,7 @@ void CameraManager::Update(float dt)
break;
}
case Scenario::UnsettleDust:
case Scenario::UnsettleDust: //called from player skill
{
CamSequence cs;
cs.push(std::tuple<CamTilt, CamMove, float>({ 0.2f,0.0f,0.0f }, { 0.0f,-0.4f,0.0f }, SandStorm::step0));
......@@ -42,7 +42,7 @@ void CameraManager::Update(float dt)
break;
}
case Scenario::Strike:
case Scenario::Strike: //called from player skill
{
CamSequence cs;
float v0 = 0.2f;
......@@ -55,7 +55,7 @@ void CameraManager::Update(float dt)
break;
}
case Scenario::Defend:
case Scenario::Defend: //called from player skill
{
CamSequence cs;
float dir = RU.GetBool() ? 0.2f : -0.2f;
......@@ -63,6 +63,58 @@ void CameraManager::Update(float dt)
scenarious.emplace_back(cs);
break;
}
case Scenario::GhoulRage: //called from Ghoul Enrage Skill
{
CamSequence cs;
float v0 = 0.01f;
auto angle1 = RU.GetFloat(0.0f, PI*2.0f);
auto angle2 = RU.GetFloat(0.0f, PI*2.0f);
cs.push(std::tuple<CamTilt, CamMove, float>({ 0.0f,0.0f,0.0f }, { -0.05f,-0.03f,0.0f }, 0.3f));
cs.push(std::tuple<CamTilt, CamMove, float>({ -v0 * sin(angle1),-v0 * cos(angle1),0.0f }, { -0.05f,-0.03f,0.0f }, 0.15f));
cs.push(std::tuple<CamTilt, CamMove, float>({ -v0 * sin(angle2),-v0 * cos(angle2),0.0f }, { -0.05f,-0.03f,0.0f }, 0.15f));
cs.push(std::tuple<CamTilt, CamMove, float>({ -v0 * cos(angle1),-v0 * sin(angle1),0.0f }, { -0.05f,-0.03f,0.0f }, 0.15f));
cs.push(std::tuple<CamTilt, CamMove, float>({ -v0 * cos(angle2),-v0 * sin(angle2),0.0f }, { -0.05f,-0.03f,0.0f }, 0.15f));
angle1 = RU.GetFloat(0.0f, PI * 2.0f);
angle2 = RU.GetFloat(0.0f, PI * 2.0f);
CamSequence cs1;
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * sin(angle1),-v0 * cos(angle1),0.0f }, { 0.0f,0.0f,0.0f }, 0.15f));
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * sin(angle2),-v0 * cos(angle2),0.0f }, { 0.0f,0.0f,0.0f }, 0.15f));
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * cos(angle1),-v0 * sin(angle1),0.0f }, { 0.0f,0.0f,0.0f }, 0.15f));
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * cos(angle2),-v0 * sin(angle2),0.0f }, { 0.0f,0.0f,0.0f }, 0.15f));
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * sin(angle1),-v0 * cos(angle1),0.0f }, { 0.0f,0.0f,0.0f }, 0.15f));
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * cos(angle1),-v0 * sin(angle1),0.0f }, { 0.0f,0.0f,0.0f }, 0.15f));
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * sin(angle2),-v0 * cos(angle2),0.0f }, { 0.0f,0.0f,0.0f }, 0.25f));
cs1.push(std::tuple<CamTilt, CamMove, float>({ -v0 * cos(angle1),-v0 * sin(angle1),0.0f }, { 0.0f,0.0f,0.0f }, 0.25f));
scenarious.emplace_back(cs);
scenarious.emplace_back(cs1);
break;
}
case Scenario::GhoulAttack: //called from CombatManager
{
CamSequence cs;
float angle = RU.GetFloat(-0.5f, 0.5f);
cs.push(std::tuple<CamTilt, CamMove, float>({ 0.3,angle,0.0f }, { -0.3f,0.0,0.0f }, 0.2f));
scenarious.emplace_back(cs);
break;
}
case Scenario::GhoulAttackMiss: //called from CombatManager
{
CamSequence cs;
float dir = RU.GetBool() ? 0.4f : -0.4f;
cs.push(std::tuple<CamTilt, CamMove, float>({ 0.0f,dir,0.0f }, { -0.4f,0.0f,dir*3.0f },0.2f));
scenarious.emplace_back(cs);
break;
}
case Scenario::GhoulAttackBlock: //called from CombatManager
{
CamSequence cs;
float angle = RU.GetFloat(-0.2f, 0.2f);
cs.push(std::tuple<CamTilt, CamMove, float>({ -0.35f,angle,0.0f }, { 0.6f,0.0,0.0f }, 0.2f));
scenarious.emplace_back(cs);
break;
}
}
pendingScenarios.pop_back();
}
......
......@@ -27,14 +27,19 @@ public:
ThrowSand,
UnsettleDust,
Strike,
Defend
Defend,
GhoulRage,
GhoulAttack,
GhoulAttackMiss,
GhoulAttackBlock,
BattleBegins,
Death
};
static void PendScenario(Scenario s);
void Update(float dt);
DirectX::XMMATRIX GetMatrix() const noexcept;
DirectX::XMFLOAT3 GetPosition() const noexcept;
//for debugging
void Rotate(float dx, float dy) noexcept
{
......
......@@ -5,18 +5,20 @@
using namespace std::string_literals;
void CombatEntity::SufferPhysicalDamage(size_t incDmg)
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;
}
}
......
......@@ -68,7 +68,7 @@ public:
}
void OnDeath();
bool IsDead();
virtual void SufferPhysicalDamage(size_t incDmg);
virtual bool SufferPhysicalDamage(size_t incDmg); //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)
......
......@@ -116,43 +116,43 @@ int CombatManager::ProcessInput(Keyboard::Event in_event) //why does it return
EndBattle();
}
if (in_event.GetCode() == 'G') //for testing
{
SL::PendDistortion(SL::LightDistortionType::YellowSpark);
}
if (in_event.GetCode() == 'H') //for testing
{
SL::PendDistortion(SL::LightDistortionType::GreenWave);
}
if (in_event.GetCode() == 'J') //for testing
{
EH::AddEffect3D(EH::Effect::PlayerSandThrowDamage);
}
if (in_event.GetCode() == 'K') //for testing
{
EH::AddEffect3D(EH::Effect::PlayerSandThrow);
}
if (in_event.GetCode() == 'L') //for testing
//if (in_event.GetCode() == 'G') //for testing
//{
// SL::PendDistortion(SL::LightDistortionType::YellowSpark);
//}
//if (in_event.GetCode() == 'H') //for testing
//{
// SL::PendDistortion(SL::LightDistortionType::GreenWave);
//}
//
//if (in_event.GetCode() == 'J') //for testing
//{
// EH::AddEffect3D(EH::Effect::PlayerSandThrowDamage);
//}
//
//if (in_event.GetCode() == 'K') //for testing
//{
// EH::AddEffect3D(EH::Effect::PlayerSandThrow);
//}
//if (in_event.GetCode() == 'L') //for testing
//{
// EH::AddEffect3D(EH::Effect::PlayerSandStorm);
//}
if (in_event.GetCode() == 'T') //for testing
{
EH::AddEffect3D(EH::Effect::PlayerSandStorm);
CM::PendScenario(CM::Scenario::GhoulRage);
}
if (in_event.GetCode() == 'T') //for testing
if (in_event.GetCode() == 'Y') //for testing
{
CM::PendScenario(CM::Scenario::ThrowSand);
CM::PendScenario(CM::Scenario::GhoulAttack);
}
//if (in_event.GetCode() == 'Y') //for testing
//{
// CM::PendScenario(CM::Scenario::UnsettleDust);
//}
if (in_event.GetCode() == 'U') //for testing
{
CM::PendScenario(CM::Scenario::Strike);
CM::PendScenario(CM::Scenario::GhoulAttackMiss);
}
if (in_event.GetCode() == 'I') //for testing
{
EH::AddEffect3D(EH::Effect::PlayerSwordAttackUpgraded);
CM::PendScenario(CM::Scenario::GhoulAttackBlock);
}
if (curTurn != Turn::NotInCombat)
......@@ -490,12 +490,16 @@ void CombatManager::HandleEvent(SkillEvent ev)
if (fRoll < (enMan->GetCurAcc() * (1 - playMan->GetDodge())))
{
sDmg = RU.GetUInt((size_t)ev.valLow, (size_t)ev.valHigh);//hit
playMan->SufferPhysicalDamage(sDmg);
if (playMan->SufferPhysicalDamage(sDmg))
CM::PendScenario(CM::Scenario::GhoulAttack);
else
CM::PendScenario(CM::Scenario::GhoulAttackBlock);
}
else
{
SPI::Play(Sounds::MissBigDamage); //miss
miss = true;
CM::PendScenario(CM::Scenario::GhoulAttackMiss);
}
break;
case EventType::Player_AddDodge:
......@@ -521,15 +525,18 @@ void CombatManager::HandleEvent(SkillEvent ev)
playMan->AddBleed(OneBleedStackEmount);
playMan->SufferPhysicalDamage(sDmg); // bleed got through block
bleed = true;
CM::PendScenario(CM::Scenario::GhoulAttack);
}
else
{
playMan->SufferPhysicalDamage(sDmg); // bleed blocked
CM::PendScenario(CM::Scenario::GhoulAttackBlock);
}
}
else
{
SPI::Play(Sounds::MissBigDamage); //miss
CM::PendScenario(CM::Scenario::GhoulAttackMiss);
miss = true;
}
break;
......
......@@ -100,7 +100,7 @@ HudEffect<Effect3DSequence, PlaneTexNorm>::HudEffect(DXGraphics& gfx, Effect3DSe
s.AddBindable(Bind::PixelShader::Resolve(gfx, L"PhongPSOpac.cso"));
scaleCbuf = std::make_shared<Bind::VertexConstantBuffer<EffectCBuff>>(gfx, 3);
cbuf = std::make_shared<Bind::PixelConstantBuffer<EffectCBuff>>(gfx, 4);
cbuf = std::make_shared<Bind::PixelConstantBuffer<EffectCBuff>>(gfx, 4); //opacity buffer
s.AddBindable(cbuf);
s.AddBindable(scaleCbuf);
s.AddBindable(Bind::Blender::Resolve(gfx, true)); //alpha usage set to true by default
......
......@@ -10,33 +10,32 @@ EnemyCombat::EnemyCombat()
activeStatusEffects[StatusEffects::Accuracy].first = baseAcc;
}
void EnemyCombat::SufferPhysicalDamage(size_t incDmg)
bool EnemyCombat::SufferPhysicalDamage(size_t incDmg)
{
if (incDmg < HP + block) //if does not kill
{
if (block > incDmg)
if (block >= 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); //not sure if this works
//MainScene::AddScenario(std::make_unique<scenarios::EnemyBlocking>(incDmg));
SPI::Play(Sounds::Ghoul_oh_02, 1.0f, 0.1f);
return false;
}
else
{
incDmg -= block;
HP -= 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))); //not sure if this works
SPI::Play(Sounds::Ghoul_oh_01, 1.0f, (std::max)(0.1f, (std::min)(0.6f, incDmg*0.08f))); //not sure if this works
//MainScene::AddScenario(std::make_unique<scenarios::EnemySufferDamage>(incDmg));
//MainScene::AddScenario(std::make_unique<scenarios::EnemyBlocking>(block));
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;
}
}
else
{
SPI::Play(Sounds::Ghoul_Death);
HP = 0;
//MainScene::AddScenario(std::make_unique<scenarios::EnemyDeath>());
OnDeath();
return true;
}
}
float EnemyCombat::GetCurAcc() const
......
......@@ -24,7 +24,7 @@ public:
virtual ~EnemyCombat() = default;
void SufferPhysicalDamage(size_t incDmg) override;
bool SufferPhysicalDamage(size_t incDmg) override;
float GetCurAcc()const;
......
......@@ -6,6 +6,7 @@
#include <assert.h>
#include "AchievementManager.h"
#include "SceneLight.h"
#include "CameraManager.h"
class Ghoul_Bite : public Skill
{
......@@ -55,7 +56,7 @@ public:
SPI::Play(Sounds::Ghoul_Enforce, 1.0f);
owner->AddEvent(SkillEvent(EventType::Enemy_AddBlock, valLow, valHigh));
dynamic_cast<EnemyCombat*>(owner)->SetState(EnemyCombat::State::GhoulCovering);
SceneLight::PendDistortion(SceneLight::LightDistortionType::ColdEmbrace);
SL::PendDistortion(SL::LightDistortionType::ColdEmbrace);
}
};
......@@ -72,9 +73,9 @@ public:
{
SPI::Play(Sounds::Ghoul_Enrage, 1.0f);
owner->AddEvent(SkillEvent(EventType::Enemy_AddSpeed, valLow, valHigh));
//MainScene::AddScenario(std::make_unique<scenarios::GhoulEnrage>());
dynamic_cast<EnemyCombat*>(owner)->SetState(EnemyCombat::State::GhoulRage);
SceneLight::PendDistortion(SceneLight::LightDistortionType::RednessBoost);
SL::PendDistortion(SL::LightDistortionType::RednessBoost);
CM::PendScenario(CM::Scenario::GhoulRage);
}
};
class Ghoul_Tear : public Skill
......@@ -84,7 +85,7 @@ public:
{
id = 1000;
valLow = 15.0f;
valHigh = 35.0f;
valHigh = 30.0f;
succChance = 0.0f;
type = AbilityType::Attack;
};
......
......@@ -85,14 +85,14 @@ void PlayerManager::Reset()
isDead = false;
}
void PlayerManager::SufferPhysicalDamage(size_t incDmg)
bool PlayerManager::SufferPhysicalDamage(size_t incDmg)
{
if (incDmg < HP + block) //if does not kill
{
if (block > incDmg)
if (block >= incDmg)
{
SPI::Play(Sounds::Player_Block, 1.0f, (std::max)(0.1f, (std::min)(0.8f, incDmg*0.1f)));
// MainScene::AddScenario(std::make_unique<scenarios::PlayerBlocking>(incDmg));
return false;
}
else
{
......@@ -101,8 +101,7 @@ void 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);
// MainScene::AddScenario(std::make_unique<scenarios::PlayerSufferDamage>(incDmg));
// MainScene::AddScenario(std::make_unique<scenarios::PlayerBlocking>(block));
return true;
}
}
else
......@@ -110,8 +109,7 @@ void PlayerManager::SufferPhysicalDamage(size_t incDmg)
HP = 0;
OnDeath();
AM::Alert(AM::Event::PlayerLostHP);
//MainScene::AddScenario(std::make_unique<scenarios::PlayerDeath>());
//CombatManager::OnPlayerDeath();
return true;
}
}
......
......@@ -17,7 +17,7 @@ public:
bool ProcessInput(const char input);
void SufferPhysicalDamage(size_t incDmg) override;
bool SufferPhysicalDamage(size_t incDmg) override;
float GetCritMod()const;
......
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