mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17:45 +00:00
Merge branch 'action_data_update_pr' into develop_c
This commit is contained in:
commit
b576788cfd
10 changed files with 135 additions and 17 deletions
28
src/scripts/action/whm/ActionBenediction140.cpp
Normal file
28
src/scripts/action/whm/ActionBenediction140.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/Action.h>
|
||||
#include <Math/CalcStats.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
class ActionBenediction140 :
|
||||
public ScriptAPI::ActionScript
|
||||
{
|
||||
public:
|
||||
ActionBenediction140() :
|
||||
ScriptAPI::ActionScript( 140 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto pTarget = action.getHitChara();
|
||||
if( pTarget )
|
||||
{
|
||||
action.getEffectbuilder()->heal( pTarget, pTarget, pTarget->getMaxHp() );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( ActionBenediction140 );
|
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;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
// workaround to framework access issue in action script
|
||||
|
|
|
@ -129,6 +129,8 @@ namespace Sapphire::World::Action
|
|||
ActionEntry getActionEntry() const;
|
||||
float getAnimationLock();
|
||||
|
||||
void setPrimaryCost( Common::ActionPrimaryCostType type, uint16_t cost );
|
||||
|
||||
bool isPhysical() const;
|
||||
bool isMagical() const;
|
||||
|
||||
|
|
|
@ -1733,8 +1733,8 @@ ActionLut::Lut ActionLut::m_actionLut =
|
|||
|
||||
//Cure, ケアル
|
||||
//has heal: potency 450
|
||||
//applies to self: Freecure, ケアルラ効果アップ, duration 15000, param 0
|
||||
{ 120, { 0, 0, 0, 450, 0, 155, 15000, 0, 0, 0, 0, 0 } },
|
||||
//comment: status removed need script
|
||||
{ 120, { 0, 0, 0, 450, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
|
||||
//Aero, エアロ
|
||||
//has damage: potency 50, combo potency 0, directional potency 0
|
||||
|
|
|
@ -514,13 +514,13 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcAutoA
|
|||
|
||||
factor = std::floor( factor * speed( chara ) );
|
||||
|
||||
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Damage ) > range100( rng ) )
|
||||
if( criticalHitProbability( chara, Common::CritDHBonusFilter::Damage ) > getRandomNumber0To99() )
|
||||
{
|
||||
factor *= criticalHitBonus( chara );
|
||||
hitType = Sapphire::Common::ActionHitSeverityType::CritDamage;
|
||||
}
|
||||
|
||||
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > range100( rng ) )
|
||||
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > getRandomNumber0To99() )
|
||||
{
|
||||
factor *= 1.25f;
|
||||
hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ?
|
||||
|
@ -528,7 +528,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcAutoA
|
|||
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() )
|
||||
{
|
||||
|
@ -607,13 +607,13 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
|||
auto factor = calcDamageBaseOnPotency( chara, ptc, wepDmg );
|
||||
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 );
|
||||
hitType = Sapphire::Common::ActionHitSeverityType::CritDamage;
|
||||
}
|
||||
|
||||
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > range100( rng ) )
|
||||
if( directHitProbability( chara, Common::CritDHBonusFilter::Damage ) > getRandomNumber0To99() )
|
||||
{
|
||||
factor *= 1.25f;
|
||||
hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ?
|
||||
|
@ -621,7 +621,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
|||
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;
|
||||
if( World::Action::Action::isAttackTypePhysical( attackType ) )
|
||||
|
@ -689,13 +689,13 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
|||
auto factor = calcHealBaseOnPotency( chara, ptc, wepDmg );
|
||||
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 );
|
||||
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() )
|
||||
{
|
||||
|
@ -759,3 +759,8 @@ float CalcStats::calcAbsorbHP( Sapphire::Entity::CharaPtr pChara, float damage,
|
|||
}
|
||||
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 std::random_device dev;
|
||||
static std::mt19937 rng;
|
||||
static std::uniform_int_distribution< std::mt19937::result_type > range100;
|
||||
static uint32_t getRandomNumber0To99();
|
||||
private:
|
||||
|
||||
/*!
|
||||
|
@ -159,6 +157,10 @@ namespace Sapphire::Math
|
|||
* @param attackPower The magic/physical attack power value.
|
||||
*/
|
||||
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:
|
||||
{
|
||||
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 *= 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 );
|
||||
break;
|
||||
}
|
||||
|
@ -85,11 +85,11 @@ std::pair< uint8_t, uint32_t > Sapphire::StatusEffect::StatusEffect::getTickEffe
|
|||
case Common::StatusEffectType::Hot:
|
||||
{
|
||||
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 *= 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 );
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue