1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-28 20:27:46 +00:00

Merge branch 'action_data_update_pr' into develop_c

This commit is contained in:
collett 2020-01-14 17:39:45 +09:00
commit b6286da75e
6 changed files with 25 additions and 14 deletions

View file

@ -1037,6 +1037,7 @@ namespace Sapphire::Common
DamageReceiveTrigger = 8,
DamageDealtTrigger = 9,
Shield = 10,
MPRestore = 11,
};
enum class ActionTypeFilter : int32_t

View file

@ -2369,9 +2369,8 @@ ActionLut::Lut ActionLut::m_actionLut =
{ 7538, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
//Reprisal, リプライザル
//has damage: potency 210, combo potency 0, directional potency 0
//applies to targets: Reprisal, リプライザル, duration 10000, param 0
{ 7535, { 210, 0, 0, 0, 0, 0, 0, 0, 1193, 10000, 0, 0 } },
{ 7535, { 0, 0, 0, 0, 0, 0, 0, 0, 1193, 10000, 0, 0 } },
//Shirk, シャーク
{ 7537, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
@ -3506,4 +3505,7 @@ ActionLut::StatusEffectTable ActionLut::m_statusEffectTable =
//Devilment, 攻めのタンゴ: CritDHRateBonus, Damage, crit 20%, dh 20%
{ 1825, { 7, 1, 20, 20, 0 } },
//Lucid Dreaming, ルーシッドドリーム: MPRestore, value 50
{ 1204, { 11, 50, 0, 0, 0 } },
};

View file

@ -148,12 +148,14 @@ void EffectResult::execute()
case Common::ActionEffectType::ApplyStatusEffect:
{
uint64_t lastTickOverride = 0;
//remove same effect from the same source (refreshing old buff)
for( auto const& entry : m_target->getStatusEffectMap() )
{
auto statusEffect = entry.second;
if( statusEffect->getId() == m_value && statusEffect->getSrcActorId() == m_source->getId() )
{
lastTickOverride = statusEffect->getLastTickMs();
// refreshing does not show "-status" flying text, and we don't send status list now because we are adding a new one
m_target->removeStatusEffect( entry.first, false, false );
break;
@ -161,9 +163,13 @@ void EffectResult::execute()
}
if( m_pPreBuiltStatusEffect )
{
m_pPreBuiltStatusEffect->setLastTick( lastTickOverride );
m_target->addStatusEffect( m_pPreBuiltStatusEffect );
}
else
m_target->addStatusEffectById( m_value, m_value2, *m_source, m_param2 );
m_target->addStatusEffectById( m_value, m_value2, *m_source, m_param2, lastTickOverride );
break;
}

View file

@ -537,25 +537,22 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
sendStatusEffectUpdate(); // although client buff displays correctly without this but retail sends it so we do it as well
}
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param, uint64_t lastTickOverride )
{
auto oldEffect = getStatusEffectById( id );
if( oldEffect.second )
removeStatusEffect( oldEffect.first, false, false );
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
effect->setParam( param );
effect->setLastTick( lastTickOverride );
addStatusEffect( effect );
}
void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source,
uint16_t param )
void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param, uint64_t lastTickOverride )
{
if( getStatusEffectById( id ).second )
return;
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
effect->setParam( param );
effect->setLastTick( lastTickOverride );
addStatusEffect( effect );
}

View file

@ -174,10 +174,10 @@ namespace Sapphire::Entity
const uint32_t* getModelArray() const;
// add a status effect by id
void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 );
void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0, uint64_t lastTickOverride = 0 );
// add a status effect by id if it doesn't exist
void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 );
void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0, uint64_t lastTickOverride = 0 );
/// End Status Effect Functions

View file

@ -64,7 +64,6 @@ void Sapphire::StatusEffect::StatusEffect::registerTickEffect( uint8_t type, uin
std::pair< uint8_t, uint32_t > Sapphire::StatusEffect::StatusEffect::getTickEffect()
{
auto thisTick = m_currTickEffect;
auto statusEffectType = static_cast< Common::StatusEffectType >( m_effectEntry.effectType );
if( statusEffectType == Common::StatusEffectType::Dot )
{
@ -90,7 +89,7 @@ std::pair< uint8_t, uint32_t > Sapphire::StatusEffect::StatusEffect::getTickEffe
{
m_currTickEffect = std::make_pair( 0, 0 );
}
return thisTick;
return m_currTickEffect;
}
void Sapphire::StatusEffect::StatusEffect::onTick()
@ -98,6 +97,12 @@ void Sapphire::StatusEffect::StatusEffect::onTick()
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
m_lastTick = Util::getTimeMs();
pScriptMgr->onStatusTick( m_targetActor, *this );
auto statusEffectType = static_cast< Common::StatusEffectType >( m_effectEntry.effectType );
if( statusEffectType == Common::StatusEffectType::MPRestore )
{
m_targetActor->restoreMP( m_effectEntry.effectValue1 * 10 );
}
}
uint32_t Sapphire::StatusEffect::StatusEffect::getSrcActorId() const