mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17:45 +00:00
Dots and hots should tick together one total number per tick.
This commit is contained in:
parent
a8242fcf87
commit
e677ee5ef8
4 changed files with 42 additions and 39 deletions
|
@ -396,6 +396,7 @@ void Sapphire::Entity::BNpc::deaggro( Sapphire::Entity::CharaPtr pChara )
|
|||
|
||||
void Sapphire::Entity::BNpc::onTick()
|
||||
{
|
||||
Chara::onTick();
|
||||
if( m_state == BNpcState::Retreat )
|
||||
{
|
||||
regainHp();
|
||||
|
|
|
@ -709,9 +709,6 @@ void Sapphire::Entity::Chara::updateStatusEffects()
|
|||
{
|
||||
uint64_t currentTimeMs = Util::getTimeMs();
|
||||
|
||||
uint32_t thisTickDmg = 0;
|
||||
uint32_t thisTickHeal = 0;
|
||||
|
||||
for( auto effectIt : m_statusEffectMap )
|
||||
{
|
||||
uint8_t effectIndex = effectIt.first;
|
||||
|
@ -734,41 +731,7 @@ void Sapphire::Entity::Chara::updateStatusEffects()
|
|||
{
|
||||
effect->setLastTick( currentTimeMs );
|
||||
effect->onTick();
|
||||
|
||||
auto thisEffect = effect->getTickEffect();
|
||||
|
||||
switch( thisEffect.first )
|
||||
{
|
||||
|
||||
case 1:
|
||||
{
|
||||
thisTickDmg += thisEffect.second;
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
thisTickHeal += thisEffect.second;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( thisTickDmg != 0 )
|
||||
{
|
||||
takeDamage( thisTickDmg );
|
||||
sendToInRangeSet( makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::Damage ), thisTickDmg ), true );
|
||||
}
|
||||
|
||||
if( thisTickHeal != 0 )
|
||||
{
|
||||
heal( thisTickHeal );
|
||||
sendToInRangeSet( makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::Heal ), thisTickHeal ), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1035,4 +998,43 @@ float Sapphire::Entity::Chara::applyShieldProtection( float damage )
|
|||
sendEffectResultToUpdateShieldValue(); // yes this is the packet to update shield value
|
||||
}
|
||||
return remainingDamage;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Chara::onTick()
|
||||
{
|
||||
uint32_t thisTickDmg = 0;
|
||||
uint32_t thisTickHeal = 0;
|
||||
|
||||
for( auto effectIt : m_statusEffectMap )
|
||||
{
|
||||
auto thisEffect = effectIt.second->getTickEffect();
|
||||
switch( thisEffect.first )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
thisTickDmg += thisEffect.second;
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
thisTickHeal += thisEffect.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( thisTickDmg != 0 )
|
||||
{
|
||||
takeDamage( thisTickDmg );
|
||||
sendToInRangeSet( makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::Damage ), thisTickDmg ), true );
|
||||
}
|
||||
|
||||
if( thisTickHeal != 0 )
|
||||
{
|
||||
heal( thisTickHeal );
|
||||
sendToInRangeSet( makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::Heal ), thisTickHeal ), true );
|
||||
}
|
||||
}
|
|
@ -252,7 +252,7 @@ namespace Sapphire::Entity
|
|||
|
||||
virtual void onActionFriendly( Chara& pSource ) {};
|
||||
|
||||
virtual void onTick() {};
|
||||
virtual void onTick();
|
||||
|
||||
virtual void changeTarget( uint64_t targetId );
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ void Sapphire::Entity::Player::onDeath()
|
|||
// TODO: slightly ugly here and way too static. Needs too be done properly
|
||||
void Sapphire::Entity::Player::onTick()
|
||||
{
|
||||
|
||||
Chara::onTick();
|
||||
// add 3 seconds to total play time
|
||||
m_playTime += 3;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue