1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 07:07:45 +00:00

Pieity bonus applies to mp and vitality to hp now

This commit is contained in:
Mordred 2019-03-21 18:53:32 +01:00
parent df2da68633
commit 3e7950d219
4 changed files with 22 additions and 4 deletions

View file

@ -386,6 +386,11 @@ void Sapphire::Entity::Chara::setCurrentAction( Sapphire::Action::ActionPtr pAct
m_pCurrentAction = std::move( pAction );
}
uint32_t Sapphire::Entity::Chara::getBonusStat( Common::BaseParam bonus ) const
{
return m_bonusStats[ static_cast< uint8_t >( bonus ) ];
}
/*!
Autoattack prototype implementation
TODO: move the check if the autoAttack can be performed to the callee

View file

@ -66,7 +66,7 @@ namespace Sapphire::Entity
} m_baseStats;
// array for bonuses, 80 to have some spare room.
uint32_t m_bonusStats[80];
uint32_t m_bonusStats[ 80 ];
protected:
char m_name[34];
@ -243,6 +243,8 @@ namespace Sapphire::Entity
void setCurrentAction( Action::ActionPtr pAction );
uint32_t getBonusStat( Common::BaseParam bonus ) const;
};
}

View file

@ -239,7 +239,12 @@ void Sapphire::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemP
m_bonusStats[ static_cast< uint8_t >( Common::BaseParam::Defense ) ] += pItem->getDefense();
m_bonusStats[ static_cast< uint8_t >( Common::BaseParam::MagicDefense ) ] += pItem->getDefenseMag();
sendStats();
calculateStats();
if( sendUpdate )
{
sendStats();
sendStatusUpdate();
}
}
@ -270,9 +275,12 @@ void Sapphire::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, Ite
m_bonusStats[ static_cast< uint8_t >( Common::BaseParam::Defense ) ] -= pItem->getDefense();
m_bonusStats[ static_cast< uint8_t >( Common::BaseParam::MagicDefense ) ] -= pItem->getDefenseMag();
calculateStats();
if( sendUpdate )
{
sendStats();
sendStatusUpdate();
}
}

View file

@ -136,8 +136,9 @@ uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer, Sapphire::FrameworkPtr pF
uint8_t level = pPlayer->getLevel();
auto vitMod = pPlayer->getBonusStat( Common::BaseParam::Vitality );
float baseStat = calculateBaseStat( pPlayer );
uint16_t vitStat = pPlayer->getStats().vit;
uint16_t vitStat = pPlayer->getStats().vit + static_cast< uint16_t >( vitMod );
uint16_t hpMod = paramGrowthInfo->hpModifier;
uint16_t jobModHp = classInfo->modifierHitPoints;
float approxBaseHp = 0.0f; // Read above
@ -169,8 +170,10 @@ uint32_t CalcStats::calculateMaxMp( PlayerPtr pPlayer, Sapphire::FrameworkPtr pF
if( !classInfo || !paramGrowthInfo )
return 0;
auto pieMod = pPlayer->getBonusStat( Common::BaseParam::Piety );
float baseStat = calculateBaseStat( pPlayer );
uint16_t piety = pPlayer->getStats().pie;
uint16_t piety = pPlayer->getStats().pie + pieMod;
uint16_t pietyScalar = paramGrowthInfo->mpModifier;
uint16_t jobModMp = classInfo->modifierManaPoints;
uint16_t baseMp = paramGrowthInfo->mpModifier;