mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 15:17:46 +00:00
Add some actions and statuses for war
This commit is contained in:
parent
aaad18bf7b
commit
b56aab72e5
5 changed files with 127 additions and 1 deletions
|
@ -758,7 +758,12 @@
|
|||
"restorePercentage": 0,
|
||||
"nextCombo": [],
|
||||
"statuses": {
|
||||
"caster": [],
|
||||
"caster": [
|
||||
{
|
||||
"id": 97,
|
||||
"duration": 30000
|
||||
}
|
||||
],
|
||||
"target": []
|
||||
}
|
||||
},
|
||||
|
|
45
src/scripts/action/war/ActionInnerBeast.cpp
Normal file
45
src/scripts/action/war/ActionInnerBeast.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/CommonAction.h>
|
||||
#include <Action/Action.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Action;
|
||||
|
||||
class ActionInnerBeast : public Sapphire::ScriptAPI::ActionScript
|
||||
{
|
||||
public:
|
||||
ActionInnerBeast() : Sapphire::ScriptAPI::ActionScript( 49 )
|
||||
{
|
||||
}
|
||||
|
||||
static constexpr auto Potency = 300;
|
||||
|
||||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto pPlayer = action.getSourceChara()->getAsPlayer();
|
||||
auto pSource = action.getSourceChara();
|
||||
auto pTarget = action.getHitChara();
|
||||
|
||||
if( !pPlayer )
|
||||
return;
|
||||
|
||||
if( !pPlayer->hasStatusEffect( Unchained ) )
|
||||
pPlayer->delModifier( Common::ParamModifier::DamageDealtPercent, -25 );
|
||||
|
||||
auto dmg = action.calcDamage( Potency );
|
||||
action.getEffectbuilder()->damage( pSource, pTarget, dmg.first, dmg.second );
|
||||
action.getEffectbuilder()->heal( pTarget, pSource, dmg.first, Common::ActionHitSeverityType::NormalHeal,
|
||||
Common::ActionEffectResultFlag::EffectOnSource );
|
||||
|
||||
action.applyStatusEffectSelf( InnerBeast );
|
||||
pPlayer->addStatusEffectByIdIfNotExist( InnerBeast, 15000, *pSource,
|
||||
{ StatusModifier{ Common::ParamModifier::DamageTakenPercent, -20 } } );
|
||||
|
||||
if( !pPlayer->hasStatusEffect( Unchained ) )
|
||||
pPlayer->addModifier( Common::ParamModifier::DamageDealtPercent, -25 );
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( ActionInnerBeast );
|
31
src/scripts/action/war/ActionUnchained.cpp
Normal file
31
src/scripts/action/war/ActionUnchained.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/CommonAction.h>
|
||||
#include <Action/Action.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Action;
|
||||
|
||||
class ActionUnchained : public Sapphire::ScriptAPI::ActionScript
|
||||
{
|
||||
public:
|
||||
ActionUnchained() : Sapphire::ScriptAPI::ActionScript( 50 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto pPlayer = action.getSourceChara()->getAsPlayer();
|
||||
|
||||
if( !pPlayer )
|
||||
return;
|
||||
|
||||
pPlayer->delModifier( Common::ParamModifier::DamageDealtPercent, -25 );
|
||||
|
||||
action.applyStatusEffectSelf( Unchained );
|
||||
pPlayer->addStatusEffectByIdIfNotExist( Unchained, 20000, *pPlayer->getAsChara() );
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( ActionUnchained );
|
22
src/scripts/statuseffect/StatusEffectDefiance.cpp
Normal file
22
src/scripts/statuseffect/StatusEffectDefiance.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/CommonAction.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Action;
|
||||
|
||||
class StatusEffectDefiance : public Sapphire::ScriptAPI::StatusEffectScript
|
||||
{
|
||||
public:
|
||||
StatusEffectDefiance() : Sapphire::ScriptAPI::StatusEffectScript( 91 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExpire( Entity::Chara& actor ) override
|
||||
{
|
||||
actor.removeSingleStatusEffectById( Unchained );
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( StatusEffectDefiance );
|
23
src/scripts/statuseffect/StatusEffectUnchained.cpp
Normal file
23
src/scripts/statuseffect/StatusEffectUnchained.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/CommonAction.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Action;
|
||||
|
||||
class StatusEffectUnchained : public Sapphire::ScriptAPI::StatusEffectScript
|
||||
{
|
||||
public:
|
||||
StatusEffectUnchained() : Sapphire::ScriptAPI::StatusEffectScript( 92 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExpire( Entity::Chara& actor ) override
|
||||
{
|
||||
if( actor.hasStatusEffect( Defiance ) )
|
||||
actor.addModifier( Common::ParamModifier::DamageDealtPercent, -25 );
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( StatusEffectUnchained );
|
Loading…
Add table
Reference in a new issue