mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17:45 +00:00
Implement cure 1 proc.
This commit is contained in:
parent
abf71f5dc0
commit
7a7a2f1724
9 changed files with 107 additions and 17 deletions
33
src/scripts/action/whm/ActionCure120.cpp
Normal file
33
src/scripts/action/whm/ActionCure120.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#include <Script/NativeScriptApi.h>
|
||||||
|
#include <ScriptObject.h>
|
||||||
|
#include <Actor/Player.h>
|
||||||
|
#include <Action/Action.h>
|
||||||
|
#include <Math/CalcStats.h>
|
||||||
|
|
||||||
|
#include "StatusEffect/StatusEffect.h"
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
using namespace Sapphire::StatusEffect;
|
||||||
|
|
||||||
|
const uint16_t STATUS_ID_FREECURE = 155;
|
||||||
|
|
||||||
|
class ActionCure120 :
|
||||||
|
public ScriptAPI::ActionScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ActionCure120() :
|
||||||
|
ScriptAPI::ActionScript( 120 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||||
|
{
|
||||||
|
if( action.getSourceChara()->getLevel() >= 30 && Math::CalcStats::getRandomNumber0To99() < 15 )
|
||||||
|
{
|
||||||
|
auto pFreeCure = action.createStatusEffect( STATUS_ID_FREECURE, action.getSourceChara(), action.getSourceChara(), 15000, 3000 );
|
||||||
|
action.getEffectbuilder()->applyStatusEffect( action.getSourceChara(), action.getSourceChara(), pFreeCure );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( ActionCure120 );
|
42
src/scripts/action/whm/ActionCureII135.cpp
Normal file
42
src/scripts/action/whm/ActionCureII135.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#include <Script/NativeScriptApi.h>
|
||||||
|
#include <ScriptObject.h>
|
||||||
|
#include <Actor/Player.h>
|
||||||
|
#include <Action/Action.h>
|
||||||
|
#include <Math/CalcStats.h>
|
||||||
|
|
||||||
|
#include "StatusEffect/StatusEffect.h"
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
using namespace Sapphire::StatusEffect;
|
||||||
|
|
||||||
|
const uint16_t STATUS_ID_FREECURE = 155;
|
||||||
|
|
||||||
|
class ActionCureII135 :
|
||||||
|
public ScriptAPI::ActionScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ActionCureII135() :
|
||||||
|
ScriptAPI::ActionScript( 135 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||||
|
{
|
||||||
|
auto freecure = action.getSourceChara()->getStatusEffectById( STATUS_ID_FREECURE );
|
||||||
|
if( freecure.second )
|
||||||
|
{
|
||||||
|
action.getSourceChara()->removeStatusEffect( freecure.first, true, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onStart( Sapphire::World::Action::Action& action ) override
|
||||||
|
{
|
||||||
|
auto freecure = action.getSourceChara()->getStatusEffectById( STATUS_ID_FREECURE );
|
||||||
|
if( freecure.second )
|
||||||
|
{
|
||||||
|
action.setPrimaryCost( Common::ActionPrimaryCostType::None, 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPOSE_SCRIPT( ActionCureII135 );
|
|
@ -884,6 +884,12 @@ bool Action::Action::isAttackTypeMagical( Common::AttackType attackType )
|
||||||
return attackType == Common::AttackType::Magical;
|
return attackType == Common::AttackType::Magical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Action::Action::setPrimaryCost( Common::ActionPrimaryCostType type, uint16_t cost )
|
||||||
|
{
|
||||||
|
m_primaryCostType = type;
|
||||||
|
m_primaryCost = cost;
|
||||||
|
}
|
||||||
|
|
||||||
Sapphire::StatusEffect::StatusEffectPtr Action::Action::createStatusEffect( uint32_t id, Entity::CharaPtr sourceActor, Entity::CharaPtr targetActor, uint32_t duration, uint32_t tickRate )
|
Sapphire::StatusEffect::StatusEffectPtr Action::Action::createStatusEffect( uint32_t id, Entity::CharaPtr sourceActor, Entity::CharaPtr targetActor, uint32_t duration, uint32_t tickRate )
|
||||||
{
|
{
|
||||||
// workaround to framework access issue in action script
|
// workaround to framework access issue in action script
|
||||||
|
|
|
@ -129,6 +129,8 @@ namespace Sapphire::World::Action
|
||||||
ActionEntry getActionEntry() const;
|
ActionEntry getActionEntry() const;
|
||||||
float getAnimationLock();
|
float getAnimationLock();
|
||||||
|
|
||||||
|
void setPrimaryCost( Common::ActionPrimaryCostType type, uint16_t cost );
|
||||||
|
|
||||||
bool isPhysical() const;
|
bool isPhysical() const;
|
||||||
bool isMagical() const;
|
bool isMagical() const;
|
||||||
|
|
||||||
|
|
|
@ -1733,8 +1733,8 @@ ActionLut::Lut ActionLut::m_actionLut =
|
||||||
|
|
||||||
//Cure, ケアル
|
//Cure, ケアル
|
||||||
//has heal: potency 450
|
//has heal: potency 450
|
||||||
//applies to self: Freecure, ケアルラ効果アップ, duration 15000, param 0
|
//comment: status removed need script
|
||||||
{ 120, { 0, 0, 0, 450, 0, 155, 15000, 0, 0, 0, 0, 0 } },
|
{ 120, { 0, 0, 0, 450, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||||
|
|
||||||
//Aero, エアロ
|
//Aero, エアロ
|
||||||
//has damage: potency 50, combo potency 0, directional potency 0
|
//has damage: potency 50, combo potency 0, directional potency 0
|
||||||
|
|
|
@ -510,13 +510,13 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcAutoA
|
||||||
|
|
||||||
factor = std::floor( factor * speed( chara ) );
|
factor = std::floor( factor * speed( chara ) );
|
||||||
|
|
||||||
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Damage ) > range100( rng ) )
|
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Damage ) > getRandomNumber0To99() )
|
||||||
{
|
{
|
||||||
factor *= criticalHitBonus( chara );
|
factor *= criticalHitBonus( chara );
|
||||||
hitType = Sapphire::Common::ActionHitSeverityType::CritDamage;
|
hitType = Sapphire::Common::ActionHitSeverityType::CritDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > range100( rng ) )
|
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > getRandomNumber0To99() )
|
||||||
{
|
{
|
||||||
factor *= 1.25f;
|
factor *= 1.25f;
|
||||||
hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ?
|
hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ?
|
||||||
|
@ -524,7 +524,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcAutoA
|
||||||
Sapphire::Common::ActionHitSeverityType::DirectHitDamage;
|
Sapphire::Common::ActionHitSeverityType::DirectHitDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
factor *= 1.0f + ( ( range100( rng ) - 50.0f ) / 1000.0f );
|
factor *= 1.0f + ( ( getRandomNumber0To99() - 50.0f ) / 1000.0f );
|
||||||
|
|
||||||
for( auto const& entry : chara.getStatusEffectMap() )
|
for( auto const& entry : chara.getStatusEffectMap() )
|
||||||
{
|
{
|
||||||
|
@ -603,13 +603,13 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
||||||
auto factor = calcDamageBaseOnPotency( chara, ptc, wepDmg );
|
auto factor = calcDamageBaseOnPotency( chara, ptc, wepDmg );
|
||||||
Sapphire::Common::ActionHitSeverityType hitType = Sapphire::Common::ActionHitSeverityType::NormalDamage;
|
Sapphire::Common::ActionHitSeverityType hitType = Sapphire::Common::ActionHitSeverityType::NormalDamage;
|
||||||
|
|
||||||
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Damage ) > range100( rng ) )
|
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Damage ) > getRandomNumber0To99() )
|
||||||
{
|
{
|
||||||
factor *= criticalHitBonus( chara );
|
factor *= criticalHitBonus( chara );
|
||||||
hitType = Sapphire::Common::ActionHitSeverityType::CritDamage;
|
hitType = Sapphire::Common::ActionHitSeverityType::CritDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > range100( rng ) )
|
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > getRandomNumber0To99() )
|
||||||
{
|
{
|
||||||
factor *= 1.25f;
|
factor *= 1.25f;
|
||||||
hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ?
|
hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ?
|
||||||
|
@ -617,7 +617,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
||||||
Sapphire::Common::ActionHitSeverityType::DirectHitDamage;
|
Sapphire::Common::ActionHitSeverityType::DirectHitDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
factor *= 1.0f + ( ( range100( rng ) - 50.0f ) / 1000.0f );
|
factor *= 1.0f + ( ( getRandomNumber0To99() - 50.0f ) / 1000.0f );
|
||||||
|
|
||||||
Common::ActionTypeFilter actionTypeFilter = Common::ActionTypeFilter::Unknown;
|
Common::ActionTypeFilter actionTypeFilter = Common::ActionTypeFilter::Unknown;
|
||||||
if( World::Action::Action::isAttackTypePhysical( attackType ) )
|
if( World::Action::Action::isAttackTypePhysical( attackType ) )
|
||||||
|
@ -685,13 +685,13 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
||||||
auto factor = calcHealBaseOnPotency( chara, ptc, wepDmg );
|
auto factor = calcHealBaseOnPotency( chara, ptc, wepDmg );
|
||||||
Sapphire::Common::ActionHitSeverityType hitType = Sapphire::Common::ActionHitSeverityType::NormalHeal;
|
Sapphire::Common::ActionHitSeverityType hitType = Sapphire::Common::ActionHitSeverityType::NormalHeal;
|
||||||
|
|
||||||
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Heal ) > range100( rng ) )
|
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Heal ) > getRandomNumber0To99() )
|
||||||
{
|
{
|
||||||
factor *= criticalHitBonus( chara );
|
factor *= criticalHitBonus( chara );
|
||||||
hitType = Sapphire::Common::ActionHitSeverityType::CritHeal;
|
hitType = Sapphire::Common::ActionHitSeverityType::CritHeal;
|
||||||
}
|
}
|
||||||
|
|
||||||
factor *= 1.0f + ( ( range100( rng ) - 50.0f ) / 1000.0f );
|
factor *= 1.0f + ( ( getRandomNumber0To99() - 50.0f ) / 1000.0f );
|
||||||
|
|
||||||
for( auto const& entry : chara.getStatusEffectMap() )
|
for( auto const& entry : chara.getStatusEffectMap() )
|
||||||
{
|
{
|
||||||
|
@ -755,3 +755,8 @@ float CalcStats::calcAbsorbHP( Sapphire::Entity::CharaPtr pChara, float damage,
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t CalcStats::getRandomNumber0To99()
|
||||||
|
{
|
||||||
|
return range100( rng );
|
||||||
|
}
|
|
@ -148,9 +148,7 @@ namespace Sapphire::Math
|
||||||
|
|
||||||
static float calcAbsorbHP( Sapphire::Entity::CharaPtr pChara, float damage, Sapphire::Common::ActionTypeFilter filter );
|
static float calcAbsorbHP( Sapphire::Entity::CharaPtr pChara, float damage, Sapphire::Common::ActionTypeFilter filter );
|
||||||
|
|
||||||
static std::random_device dev;
|
static uint32_t getRandomNumber0To99();
|
||||||
static std::mt19937 rng;
|
|
||||||
static std::uniform_int_distribution< std::mt19937::result_type > range100;
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -159,6 +157,10 @@ namespace Sapphire::Math
|
||||||
* @param attackPower The magic/physical attack power value.
|
* @param attackPower The magic/physical attack power value.
|
||||||
*/
|
*/
|
||||||
static float calcAttackPower( const Sapphire::Entity::Chara& chara, uint32_t attackPower );
|
static float calcAttackPower( const Sapphire::Entity::Chara& chara, uint32_t attackPower );
|
||||||
|
|
||||||
|
static std::random_device dev;
|
||||||
|
static std::mt19937 rng;
|
||||||
|
static std::uniform_int_distribution< std::mt19937::result_type > range100;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,11 +73,11 @@ std::pair< uint8_t, uint32_t > Sapphire::StatusEffect::StatusEffect::getTickEffe
|
||||||
case Common::StatusEffectType::Dot:
|
case Common::StatusEffectType::Dot:
|
||||||
{
|
{
|
||||||
auto value = m_value;
|
auto value = m_value;
|
||||||
if( m_cachedSourceCrit > Sapphire::Math::CalcStats::range100( Sapphire::Math::CalcStats::rng ) )
|
if( m_cachedSourceCrit > Sapphire::Math::CalcStats::getRandomNumber0To99() )
|
||||||
{
|
{
|
||||||
value *= m_cachedSourceCritBonus;
|
value *= m_cachedSourceCritBonus;
|
||||||
}
|
}
|
||||||
value *= 1.0f + ( ( Sapphire::Math::CalcStats::range100( Sapphire::Math::CalcStats::rng ) - 50.0f ) / 1000.0f );
|
value *= 1.0f + ( ( Sapphire::Math::CalcStats::getRandomNumber0To99() - 50.0f ) / 1000.0f );
|
||||||
m_currTickEffect = std::make_pair( 1, value );
|
m_currTickEffect = std::make_pair( 1, value );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -85,11 +85,11 @@ std::pair< uint8_t, uint32_t > Sapphire::StatusEffect::StatusEffect::getTickEffe
|
||||||
case Common::StatusEffectType::Hot:
|
case Common::StatusEffectType::Hot:
|
||||||
{
|
{
|
||||||
auto value = m_value;
|
auto value = m_value;
|
||||||
if( m_cachedSourceCrit > Sapphire::Math::CalcStats::range100( Sapphire::Math::CalcStats::rng ) )
|
if( m_cachedSourceCrit > Sapphire::Math::CalcStats::getRandomNumber0To99() )
|
||||||
{
|
{
|
||||||
value *= m_cachedSourceCritBonus;
|
value *= m_cachedSourceCritBonus;
|
||||||
}
|
}
|
||||||
value *= 1.0f + ( ( Sapphire::Math::CalcStats::range100( Sapphire::Math::CalcStats::rng ) - 50.0f ) / 1000.0f );
|
value *= 1.0f + ( ( Sapphire::Math::CalcStats::getRandomNumber0To99() - 50.0f ) / 1000.0f );
|
||||||
m_currTickEffect = std::make_pair( 2, value );
|
m_currTickEffect = std::make_pair( 2, value );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue