mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-27 11:57:45 +00:00
more clean up
This commit is contained in:
parent
f7ca365c8d
commit
a6daa4ea8e
3 changed files with 25 additions and 12 deletions
|
@ -804,14 +804,24 @@ Data::ActionPtr Action::Action::getActionData() const
|
|||
|
||||
bool Action::Action::isPhysical() const
|
||||
{
|
||||
return m_actionData->attackType == -1 ||
|
||||
m_actionData->attackType == 1 ||
|
||||
m_actionData->attackType == 2 ||
|
||||
m_actionData->attackType == 3 ||
|
||||
m_actionData->attackType == 4;
|
||||
return isAttackTypePhysical( m_actionData->attackType );
|
||||
}
|
||||
|
||||
bool Action::Action::isMagic() const
|
||||
bool Action::Action::isMagical() const
|
||||
{
|
||||
return m_actionData->attackType == 5;
|
||||
return isAttackTypeMagical( m_actionData->attackType );
|
||||
}
|
||||
|
||||
bool Action::Action::isAttackTypePhysical( int8_t attackType )
|
||||
{
|
||||
return attackType == -1 ||
|
||||
attackType == 1 ||
|
||||
attackType == 2 ||
|
||||
attackType == 3 ||
|
||||
attackType == 4;
|
||||
}
|
||||
|
||||
bool Action::Action::isAttackTypeMagical( int8_t attackType )
|
||||
{
|
||||
return attackType == 5;
|
||||
}
|
|
@ -121,7 +121,10 @@ namespace Sapphire::World::Action
|
|||
Data::ActionPtr getActionData() const;
|
||||
|
||||
bool isPhysical() const;
|
||||
bool isMagic() const;
|
||||
bool isMagical() const;
|
||||
|
||||
static bool isAttackTypePhysical( int8_t attackType );
|
||||
static bool isAttackTypeMagical( int8_t attackType );
|
||||
|
||||
/*!
|
||||
* @brief Starts the cast. Finishes it immediately if there is no cast time (weaponskills).
|
||||
|
|
|
@ -633,7 +633,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
|||
if( effectEntry.effectType != Sapphire::World::Action::EffectTypeDamageMultiplier )
|
||||
continue;
|
||||
uint8_t actionType = action.isPhysical() ? Sapphire::World::Action::EffectActionTypeFilterPhysical :
|
||||
( action.isMagic() ? Sapphire::World::Action::EffectActionTypeFilterMagical : 0 );
|
||||
( action.isMagical() ? Sapphire::World::Action::EffectActionTypeFilterMagical : 0 );
|
||||
if( effectEntry.effectValue1 & actionType )
|
||||
{
|
||||
factor *= 1.0f + ( effectEntry.effectValue2 / 100.0f );
|
||||
|
@ -653,9 +653,9 @@ float CalcStats::applyDamageReceiveMultiplier( const Sapphire::Entity::Chara& ch
|
|||
if( effectEntry.effectType != Sapphire::World::Action::EffectTypeDamageReceiveMultiplier )
|
||||
continue;
|
||||
uint8_t actionType = 0;
|
||||
if( attackType == -1 || attackType == 1 || attackType == 2 || attackType == 3 || attackType == 4 )
|
||||
if( World::Action::Action::isAttackTypePhysical( attackType ) )
|
||||
actionType = Sapphire::World::Action::EffectActionTypeFilterPhysical;
|
||||
else if( attackType == 5 )
|
||||
else if( World::Action::Action::isAttackTypeMagical( attackType ) )
|
||||
actionType = Sapphire::World::Action::EffectActionTypeFilterMagical;
|
||||
if( effectEntry.effectValue1 & actionType )
|
||||
{
|
||||
|
@ -699,7 +699,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
|
|||
if( effectEntry.effectType != Sapphire::World::Action::EffectTypeHealCastMultiplier )
|
||||
continue;
|
||||
|
||||
if( action.getActionData()->actionCategory == 2 ) // must be a "cast"
|
||||
if( static_cast< Common::ActionCategory >( action.getActionData()->actionCategory ) == Common::ActionCategory::Spell ) // must be a "cast"
|
||||
{
|
||||
factor *= 1.0f + ( effectEntry.effectValue2 / 100.0f );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue