Skip to content

Commit c368cab

Browse files
committed
add invincibility to ifrit hellfire
1 parent 975cc5e commit c368cab

File tree

10 files changed

+90
-35
lines changed

10 files changed

+90
-35
lines changed

data/actions/IfritNormal.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,7 @@
8080
"nextCombo": [],
8181
"aggroModifier": 1.0,
8282
"statuses": {
83-
"caster": [
84-
{
85-
"id": 325,
86-
"duration": 8000,
87-
"modifiers": [
88-
{
89-
"modifier": "DamageTakenPercent",
90-
"value": -100
91-
}
92-
]
93-
}
94-
],
83+
"caster": [],
9584
"target": []
9685
}
9786
},

data/encounterTimelines/IfritNormal.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@
290290
"startTime": 0,
291291
"type": "bNpcFlags"
292292
},
293+
{
294+
"data": {
295+
"actionTimelineId": 140,
296+
"actorName": "Ifrit"
297+
},
298+
"description": "",
299+
"startTime": 2000,
300+
"type": "actionTimeline"
301+
},
293302
{
294303
"data": {
295304
"actorName": "Ifrit",
@@ -306,18 +315,9 @@
306315
"targetType": "self"
307316
},
308317
"description": "",
309-
"startTime": 0,
318+
"startTime": 2100,
310319
"type": "setPos"
311320
},
312-
{
313-
"data": {
314-
"actionTimelineId": 140,
315-
"actorName": "Ifrit"
316-
},
317-
"description": "",
318-
"startTime": 2000,
319-
"type": "actionTimeline"
320-
},
321321
{
322322
"data": {
323323
"actionTimelineId": 141,

src/scripts/action/mobs/family/Ifrit/ActionHellfire.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ class ActionHellfire : public Sapphire::ScriptAPI::ActionScript
2323

2424
static constexpr auto Potency = 300;
2525

26+
virtual void onStart( Sapphire::World::Action::Action& action ) override
27+
{
28+
auto pChara = action.getSourceChara();
29+
30+
// todo: should just put the modifier in the status script?
31+
std::vector< World::Action::StatusModifier > modifiers = {
32+
{ { Common::ParamModifier::DamageTakenPercent, -100 } }
33+
};
34+
35+
auto pEffect = std::make_shared< Sapphire::StatusEffect::StatusEffect >(
36+
325, pChara, pChara, 8000, modifiers, 0, 3000
37+
);
38+
39+
pChara->addStatusEffect( pEffect );
40+
}
41+
2642
void onExecute( Sapphire::World::Action::Action& action ) override
2743
{
2844
auto pSource = action.getSourceChara();

src/scripts/action/mobs/family/Ifrit/ActionVulcanBurst.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class ActionVulcanBurst : public Sapphire::ScriptAPI::ActionScript
4444
pActionBuilder->damage( pSource, pTarget, dmg.first, dmg.second );
4545

4646
// todo:
47-
//if( dmg.first > 0 )
48-
// pTarget->knockback( pSource->getPos(), 20.f );
47+
if( dmg.first > 0 )
48+
pTarget->knockback( pSource->getPos(), 20.f );
4949
}
5050
}
5151
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <Script/NativeScriptApi.h>
2+
#include <ScriptObject.h>
3+
#include "StatusEffect/StatusEffect.h"
4+
5+
#include <Action/CommonAction.h>
6+
#include <Actor/Chara.h>
7+
8+
#include "Common.h"
9+
10+
using namespace Sapphire;
11+
using namespace Sapphire::World::Action;
12+
13+
class StatusEffectInvincibility : public Sapphire::ScriptAPI::StatusEffectScript
14+
{
15+
public:
16+
StatusEffectInvincibility() : Sapphire::ScriptAPI::StatusEffectScript( 325 )
17+
{
18+
}
19+
20+
void onApply( Entity::Chara& actor ) override
21+
{
22+
actor.setInvincibilityType( Common::InvincibilityIgnoreDamage );
23+
}
24+
25+
void onExpire( Entity::Chara& actor ) override
26+
{
27+
actor.setInvincibilityType( Common::InvincibilityNone );
28+
}
29+
};
30+
31+
EXPOSE_SCRIPT( StatusEffectInvincibility );

src/world/Action/Action.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,15 +982,14 @@ void Action::Action::addDefaultActorFilters()
982982
{
983983
switch( m_castType )
984984
{
985-
// todo: figure these out and remove 5/RectangularAOE to own handler
986-
case( Common::CastType ) 5:
987985
case Common::CastType::SingleTarget:
988986
{
989987
auto filter = std::make_shared< World::Util::ActorFilterSingleTarget >( static_cast< uint32_t >( m_targetId ) );
990988
addActorFilter( filter );
991989
break;
992990
}
993-
991+
// todo: what is this CastType::Unknown (5)? seems to be another circular aoe?
992+
case Common::CastType::Unknown:
994993
case Common::CastType::Circle:
995994
{
996995
auto filter = std::make_shared< World::Util::ActorFilterInRange >( m_pos, m_effectRange );

src/world/Actor/BNpc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ void BNpc::notifyPlayerDeaggro( const CharaPtr& pChara )
768768
if( getTriggerOwnerId() == pChara->getId() )
769769
{
770770
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
771-
auto bnpc = *getAsBNpc();
771+
auto& bnpc = *getAsBNpc();
772772
scriptMgr.onTriggerOwnerDeaggro( *tmpPlayer, bnpc );
773773
}
774774
}

src/world/Actor/Chara.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,14 @@ void Chara::takeDamage( uint32_t damage, bool broadcastUpdate )
437437
break;
438438
}
439439
}
440-
else
440+
else if( m_invincibilityType != InvincibilityIgnoreDamage )
441+
{
441442
m_hp -= damage;
443+
}
444+
else
445+
{
446+
damage = 0;
447+
}
442448

443449
if( broadcastUpdate )
444450
{
@@ -548,6 +554,10 @@ void Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEffect )
548554
pEffect->setSlot( nextSlot );
549555
m_statusEffectMap[ nextSlot ] = pEffect;
550556
pEffect->applyStatus();
557+
558+
Network::Util::Packet::sendActorControl( getInRangePlayerIds( isPlayer() ), getId(), StatusEffectGain,
559+
pEffect->getId() );
560+
Network::Util::Packet::sendHudParam( *this );
551561
}
552562

553563
/*! \param StatusEffectPtr to be applied to the actor */
@@ -596,13 +606,13 @@ void Chara::replaceSingleStatusEffect( uint32_t slotId, StatusEffect::StatusEffe
596606
pStatus->applyStatus();
597607
}
598608

599-
void Chara::replaceSingleStatusEffectById( uint32_t id )
609+
void Chara::replaceSingleStatusEffectById( uint32_t id, StatusEffect::StatusEffectPtr pStatus )
600610
{
601611
for( const auto& effectIt : m_statusEffectMap )
602612
{
603613
if( effectIt.second->getId() == id )
604614
{
605-
removeStatusEffect( effectIt.first, false );
615+
replaceSingleStatusEffect( effectIt.first, pStatus );
606616
break;
607617
}
608618
}
@@ -1063,16 +1073,25 @@ void Chara::knockback( const FFXIVARR_POSITION3& origin, float distance, bool ig
10631073
}
10641074
setPos( navPos );
10651075
// speed needs to be reset properly here
1066-
pNav->updateAgentPosition( getAgentId(), getPos(), getRadius(), 1 );
1076+
setAgentId( pNav->updateAgentPosition( getAgentId(), getPos(), getRadius(), pNav->getAgentSpeed( getAgentId() ) ) );
10671077
}
10681078
else
10691079
{
10701080
setPos( kbPos );
10711081
}
10721082
pTeri->updateActorPosition( *this );
1083+
1084+
auto pTransferPacket = makeZonePacket< FFXIVIpcTransfer >( getId() );
1085+
pTransferPacket->data().dir = Common::Util::floatToUInt16Rot( getRot() );
1086+
pTransferPacket->data().pos[ 0 ] = Common::Util::floatToUInt16( kbPos.x );
1087+
pTransferPacket->data().pos[ 1 ] = Common::Util::floatToUInt16( kbPos.y );
1088+
pTransferPacket->data().pos[ 2 ] = Common::Util::floatToUInt16( kbPos.z );
1089+
pTransferPacket->data().duration = 1.0f;
1090+
10731091
// todo: send the correct knockback packet to player
10741092
server().queueForPlayers( getInRangePlayerIds(),
1075-
std::make_shared< MoveActorPacket >( *this, getRotUInt8(), 2, 0, 0, 0x5A / 4 ) );
1093+
pTransferPacket );
1094+
10761095
}
10771096

10781097
void Chara::createAreaObject( uint32_t actionId, uint32_t actionPotency, uint32_t vfxId, float scale,

src/world/Actor/Chara.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ namespace Sapphire::Entity
146146

147147
void replaceSingleStatusEffect( uint32_t slotId, StatusEffect::StatusEffectPtr pStatus );
148148

149-
void replaceSingleStatusEffectById( uint32_t id );
149+
void replaceSingleStatusEffectById( uint32_t id, StatusEffect::StatusEffectPtr pStatus );
150150

151151
void removeSingleStatusEffectById( uint32_t id );
152152

src/world/Encounter/Timepoint.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ namespace Sapphire
539539
if( pBNpc->getAgentId() != -1 )
540540
{
541541
auto pNavi = pTeri->getNaviProvider();
542-
pBNpc->setAgentId( pNavi->updateAgentPosition( pBNpc->getAgentId(), pos, pBNpc->getRadius(), pNavi->getAgentSpeed( pBNpc->getAgentId() ) ) );
542+
if( pNavi )
543+
pBNpc->setAgentId( pNavi->updateAgentPosition( pBNpc->getAgentId(), pos, pBNpc->getRadius(), pNavi->getAgentSpeed( pBNpc->getAgentId() ) ) );
543544
}
544545
pBNpc->setRot( rot );
545546
pBNpc->setPos( pos, true );

0 commit comments

Comments
 (0)