mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17:45 +00:00
create actual functions for buff stacks
This commit is contained in:
parent
b55e44c0db
commit
8262ebd4e9
2 changed files with 29 additions and 6 deletions
|
@ -261,6 +261,21 @@ void Sapphire::StatusEffect::StatusEffect::setParam( uint16_t param )
|
||||||
m_param = param;
|
m_param = param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::StatusEffect::StatusEffect::setStacks( uint8_t stacks )
|
||||||
|
{
|
||||||
|
if( ( m_param & 0x00FF ) != 0x00FF )
|
||||||
|
{
|
||||||
|
m_param = stacks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Sapphire::StatusEffect::StatusEffect::getStacks()
|
||||||
|
{
|
||||||
|
if( ( m_param & 0x00FF ) == 0x00FF )
|
||||||
|
return 0;
|
||||||
|
return static_cast< uint8_t >( m_param & 0x00FF );
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& Sapphire::StatusEffect::StatusEffect::getName() const
|
const std::string& Sapphire::StatusEffect::StatusEffect::getName() const
|
||||||
{
|
{
|
||||||
return m_name;
|
return m_name;
|
||||||
|
@ -300,12 +315,14 @@ void Sapphire::StatusEffect::StatusEffect::onBeforeActionStart( Sapphire::World:
|
||||||
if( m_effectEntry.effectValue1 > 0 )
|
if( m_effectEntry.effectValue1 > 0 )
|
||||||
{
|
{
|
||||||
// if stacks equal to remaining uses, assume it is synced
|
// if stacks equal to remaining uses, assume it is synced
|
||||||
if( m_effectEntry.effectValue1 == m_param )
|
if( m_effectEntry.effectValue1 == getStacks() )
|
||||||
{
|
{
|
||||||
m_param--;
|
m_effectEntry.effectValue1--;
|
||||||
|
setStacks( m_effectEntry.effectValue1 );
|
||||||
m_targetActor->sendStatusEffectUpdate();
|
m_targetActor->sendStatusEffectUpdate();
|
||||||
}
|
}
|
||||||
m_effectEntry.effectValue1--;
|
else
|
||||||
|
m_effectEntry.effectValue1--;
|
||||||
if( m_effectEntry.effectValue1 == 0 )
|
if( m_effectEntry.effectValue1 == 0 )
|
||||||
{
|
{
|
||||||
markToRemove();
|
markToRemove();
|
||||||
|
@ -330,12 +347,14 @@ void Sapphire::StatusEffect::StatusEffect::onBeforeActionStart( Sapphire::World:
|
||||||
if( m_effectEntry.effectValue1 > 0 )
|
if( m_effectEntry.effectValue1 > 0 )
|
||||||
{
|
{
|
||||||
// if stacks equal to remaining uses, assume it is synced
|
// if stacks equal to remaining uses, assume it is synced
|
||||||
if( m_effectEntry.effectValue1 == m_param )
|
if( m_effectEntry.effectValue1 == getStacks() )
|
||||||
{
|
{
|
||||||
m_param--;
|
m_effectEntry.effectValue1--;
|
||||||
|
setStacks( m_effectEntry.effectValue1 );
|
||||||
m_targetActor->sendStatusEffectUpdate();
|
m_targetActor->sendStatusEffectUpdate();
|
||||||
}
|
}
|
||||||
m_effectEntry.effectValue1--;
|
else
|
||||||
|
m_effectEntry.effectValue1--;
|
||||||
if( m_effectEntry.effectValue1 == 0 )
|
if( m_effectEntry.effectValue1 == 0 )
|
||||||
{
|
{
|
||||||
markToRemove();
|
markToRemove();
|
||||||
|
|
|
@ -47,6 +47,10 @@ public:
|
||||||
|
|
||||||
void setParam( uint16_t param );
|
void setParam( uint16_t param );
|
||||||
|
|
||||||
|
void setStacks( uint8_t stacks );
|
||||||
|
|
||||||
|
uint8_t getStacks();
|
||||||
|
|
||||||
void registerTickEffect( uint8_t type, uint32_t param );
|
void registerTickEffect( uint8_t type, uint32_t param );
|
||||||
|
|
||||||
std::pair< uint8_t, uint32_t > getTickEffect();
|
std::pair< uint8_t, uint32_t > getTickEffect();
|
||||||
|
|
Loading…
Add table
Reference in a new issue