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

AoE refactor;

This commit is contained in:
Maru 2017-09-24 21:02:29 -03:00
parent a6d7532038
commit c5ea6ec8ac
5 changed files with 52 additions and 59 deletions

View file

@ -228,6 +228,9 @@ global CURRENCY_TOMESTONELORE = 0X0E
////////////////////////////////////////////////////////////
// Skill handle types
////////////////////////////////////////////////////////////
global STD_DAMAGE = 0X00
global STD_HEAL = 0X01
global STD_DOT = 0X02
global STD_DAMAGE = 0X03
global STD_HEAL = 0X04
global STD_MP_LOSS = 0X0A
global STD_MP_GAIN = 0X0B
global STD_TP_LOSS = 0X0C
global STD_TP_GAIN = 0X0D

View file

@ -548,7 +548,7 @@ namespace Core {
Unaspected = 7 // Doesn't imply magical unaspected damage - could be unaspected physical
};
enum struct ActionType : int8_t
enum class ActionType : int8_t
{
WeaponOverride = -1, // Needs more investigation (takes the damage type of the equipped weapon)?
Unknown_0 = 0,
@ -562,7 +562,7 @@ namespace Core {
LimitBreak = 8,
};
enum ActionEffectType : uint8_t
enum class ActionEffectType : uint8_t
{
Nothing = 0,
Miss = 1,
@ -581,7 +581,7 @@ namespace Core {
GpGain = 14
};
enum ActionHitSeverityType : uint8_t
enum class ActionHitSeverityType : uint8_t
{
NormalDamage = 0,
CritHeal = 0,
@ -591,6 +591,18 @@ namespace Core {
CritDirectHitDamage = 3
};
enum class AoeType
{
None,
SingleTarget,
TargetCircle,
Cone,
Line,
Unknown,
Unknown2,
GroundCircle, // for when you set aoe like asylum
};
enum HandleActionType : uint8_t
{
Event,
@ -598,13 +610,6 @@ namespace Core {
Teleport
};
enum HandleSkillType : uint8_t
{
StdDamage,
StdHeal,
StdDot,
};
enum struct PlayerStateFlag : uint8_t
{
NoCombat,

View file

@ -44,9 +44,6 @@ float CalcBattle::calculateBaseStat( PlayerPtr pPlayer )
base = 1.63f * level + 121.02f;
// ARR Base Stat Formula (Off by one in several cases)
else
// Old: base = 0.053f * ( level * level ) + ( 1.022f * level ) - 0.907f + 20;
// V1: base = 0.0523f * ( level * level ) + ( 1.04f * level ) + 19.405f;
// V2: base = 0.05223f * ( level * level ) + ( 1.0405f * level ) + 19.405f;
base = 0.052602f * ( level * level ) + ( 1.0179f * level ) + 19.6f;
return base;
@ -83,7 +80,7 @@ uint32_t CalcBattle::calculateMaxHp( PlayerPtr pPlayer )
else if ( level >= 50 )
approxBaseHp = 1700 + ( ( level - 50 ) * ( 1700 * 1.04325f ) );
else
approxBaseHp = paramGrowthInfoIt->second.mp_const * 0.7596f;
approxBaseHp = paramGrowthInfoIt->second.mp_const * 0.7667f;
uint16_t result = static_cast< uint16_t >( floor( jobModHp * ( approxBaseHp / 100.0f ) ) + floor( hpMod / 100.0f * ( vitStat - baseStat ) ) );

View file

@ -1521,13 +1521,9 @@ void Core::Entity::Player::handleScriptSkill( uint32_t type, uint32_t actionId,
auto actionInfoPtr = g_exdData.getActionInfo( actionId );
switch( type )
{
case Core::Common::HandleSkillType::StdDamage:
{
sendDebug( "STD_DAMAGE" );
sendDebug( actionInfoPtr->name );
if ( actionInfoPtr->is_aoe )
sendDebug( "is aoe: " + std::to_string( actionInfoPtr->is_aoe ) );
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket( getId() );
effectPacket.data().targetId = pTarget.getId();
@ -1538,11 +1534,20 @@ void Core::Entity::Player::handleScriptSkill( uint32_t type, uint32_t actionId,
effectPacket.data().numEffects = 1;
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( getRotation() );
effectPacket.data().effectTarget = pTarget.getId();
effectPacket.data().effects[0].value = static_cast< int16_t >( param1 );
effectPacket.data().effects[0].effectType = ActionEffectType::Damage;
effectPacket.data().effects[0].value = 0;
effectPacket.data().effects[0].effectType = static_cast < ActionEffectType >( type );
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalDamage;
effectPacket.data().effects[0].unknown_3 = 7;
switch ( type )
{
case 3:
{
sendDebug( "STD_DAMAGE" );
effectPacket.data().effects[0].value = static_cast< int16_t >( param1 );
sendToInRangeSet( effectPacket, true );
if ( !pTarget.isAlive() )
@ -1553,25 +1558,15 @@ void Core::Entity::Player::handleScriptSkill( uint32_t type, uint32_t actionId,
break;
}
case Core::Common::HandleSkillType::StdHeal:
case 4:
{
uint32_t calculatedHeal = CalcBattle::calculateHealValue( getAsPlayer(), static_cast< uint32_t >( param1 ) );
sendDebug( "STD_HEAL" );
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket( getId() );
effectPacket.data().targetId = pTarget.getId();
effectPacket.data().actionAnimationId = actionId;
effectPacket.data().unknown_2 = 1; // This seems to have an effect on the "double-cast finish" animation
// effectPacket.data().unknown_3 = 1;
effectPacket.data().actionTextId = actionId;
effectPacket.data().numEffects = 1;
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( getRotation() );
effectPacket.data().effectTarget = pTarget.getId();
effectPacket.data().effects[0].value = calculatedHeal;
effectPacket.data().effects[0].value = static_cast< int16_t >( calculatedHeal );
effectPacket.data().effects[0].effectType = ActionEffectType::Heal;
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalHeal;
effectPacket.data().effects[0].unknown_3 = 7;
sendDebug( "STD_HEAL" );
sendToInRangeSet( effectPacket, true );
@ -1580,9 +1575,10 @@ void Core::Entity::Player::handleScriptSkill( uint32_t type, uint32_t actionId,
// todo: get proper packets: the following was just kind of thrown together from what we know
// also toss AoE to another spot and make it generic
sendDebug( actionInfoPtr->name );
if ( actionInfoPtr->is_aoe )
{
sendDebug( "IS AOE LOL" );
for ( auto pCurAct : m_inRangePlayers )
{
assert( pCurAct );
@ -1591,20 +1587,12 @@ void Core::Entity::Player::handleScriptSkill( uint32_t type, uint32_t actionId,
if ( Math::Util::distance( pTarget.getPos().x, pTarget.getPos().y, pTarget.getPos().z, pCurAct->getPos().x, pCurAct->getPos().y, pCurAct->getPos().z ) <= actionInfoPtr->radius )
{
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket( pCurAct->getId() );
effectPacket.data().targetId = pCurAct->getId();
effectPacket.data().unknown_1 = 1; // the magic trick for getting it to work
effectPacket.data().unknown_2 = 1;
effectPacket.data().unknown_8 = 1;
effectPacket.data().unknown_5 = 1;
effectPacket.data().actionAnimationId = actionId;
effectPacket.data().actionTextId = 0;
effectPacket.data().numEffects = 1;
effectPacket.data().effectTarget = pCurAct->getId();
effectPacket.data().effects[0].value = calculatedHeal;
effectPacket.data().effects[0].effectType = ActionEffectType::Heal;
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalHeal;
effectPacket.data().effects[0].unknown_3 = 7;
pCurAct->sendToInRangeSet( effectPacket, true );
pCurAct->heal( calculatedHeal );

View file

@ -194,13 +194,13 @@ void Core::StatusEffect::StatusEffectContainer::update()
if( thisTickDmg != 0 )
{
m_pOwner->takeDamage( thisTickDmg );
m_pOwner->sendToInRangeSet( ActorControlPacket142( m_pOwner->getId(), HPFloatingText, 0, 3, thisTickDmg ) );
m_pOwner->sendToInRangeSet( ActorControlPacket142( m_pOwner->getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Damage ), thisTickDmg ) );
}
if( thisTickHeal != 0 )
{
m_pOwner->heal( thisTickDmg );
m_pOwner->sendToInRangeSet( ActorControlPacket142( m_pOwner->getId(), HPFloatingText, 0, 4, thisTickHeal ) );
m_pOwner->sendToInRangeSet( ActorControlPacket142( m_pOwner->getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Heal ), thisTickHeal ) );
}
}