From 0903f0d2f1abc8628b2361ddf535ecb8198cb66b Mon Sep 17 00:00:00 2001 From: collett Date: Wed, 5 Feb 2020 17:21:57 +0900 Subject: [PATCH] pld oath gauge --- src/common/Common.h | 2 +- src/world/Action/Action.cpp | 28 ++++++++++++++++++++++++++++ src/world/Actor/Player.cpp | 13 +++++++++++++ src/world/Actor/Player.h | 3 +++ 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/common/Common.h b/src/common/Common.h index a8f8b7af..f78a7a67 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -586,7 +586,7 @@ namespace Sapphire::Common // DRKGauge = 25, // AetherflowStack = 30, // Status = 32, -// PLDGauge = 41, + PLDGauge = 41, // RDMGaugeBoth = 74, //// RDMGaugeBlack = 75, // not right? // DRGGauge3Eyes = 76, diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index 09a6a4fe..eb03c670 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -483,6 +483,17 @@ void Action::Action::buildEffects() actor->onActionHostile( m_pSource ); dmg.first = actor->applyShieldProtection( dmg.first ); m_effectBuilder->damage( actor, actor, dmg.first, dmg.second, dmg.first == 0 ? Common::ActionEffectResultFlag::Absorbed : Common::ActionEffectResultFlag::None ); + + if( m_isAutoAttack && m_pSource->isPlayer() ) + { + if( auto player = m_pSource->getAsPlayer() ) + { + if( player->getClass() == Common::ClassJob::Paladin ) + { + player->gaugePldSetOath( std::min( 100, player->gaugePldGetOath() + 5 ) ); + } + } + } } auto reflectDmg = Math::CalcStats::calcDamageReflect( m_pSource, actor, dmg.first, @@ -737,6 +748,23 @@ bool Action::Action::primaryCostCheck( bool subtractCosts ) return false; } + case Common::ActionPrimaryCostType::PLDGauge: + { + auto pPlayer = m_pSource->getAsPlayer(); + if( pPlayer ) + { + auto oath = pPlayer->gaugePldGetOath(); + if( oath >= m_primaryCost ) + { + if( subtractCosts ) + pPlayer->gaugePldSetOath( oath - m_primaryCost ); + + return true; + } + } + return false; + } + // free casts, likely just pure ogcds case Common::ActionPrimaryCostType::None: { diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 5473c2d1..20fe1e12 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -2203,6 +2203,19 @@ void Sapphire::Entity::Player::gaugeWarSetIb( uint8_t value ) } uint8_t Sapphire::Entity::Player::gaugeWarGetIb() +{ + return gaugeGet( 0 ); +} + +void Sapphire::Entity::Player::gaugePldSetOath( uint8_t value ) +{ + auto oldValue = gaugePldGetOath(); + gaugeSet( 0, value ); + if( oldValue != value ) + sendActorGauge(); +} + +uint8_t Sapphire::Entity::Player::gaugePldGetOath() { return gaugeGet( 0 ); } \ No newline at end of file diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 43758ce7..f9a13136 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -983,6 +983,9 @@ namespace Sapphire::Entity void gaugeWarSetIb( uint8_t value ); uint8_t gaugeWarGetIb(); + void gaugePldSetOath( uint8_t value ); + uint8_t gaugePldGetOath(); + ////////////////////////////////////////////////////////////////////////////////////////////////////// Common::HuntingLogEntry& getHuntingLogEntry( uint8_t index );