2023-03-08 18:07:15 +01:00
|
|
|
#include "Warrior.h"
|
|
|
|
|
|
|
|
#include <Action/CommonAction.h>
|
|
|
|
#include <Action/Action.h>
|
|
|
|
#include <Actor/Player.h>
|
|
|
|
|
|
|
|
using namespace Sapphire;
|
|
|
|
using namespace Sapphire::World::Action;
|
|
|
|
|
|
|
|
void Warrior::onAction( Entity::Player& player, Action& action )
|
|
|
|
{
|
|
|
|
switch( action.getId() )
|
|
|
|
{
|
|
|
|
case Maim:
|
|
|
|
case StormsEye:
|
|
|
|
case StormsPath:
|
|
|
|
case SkullSunder:
|
|
|
|
case ButchersBlock:
|
|
|
|
{
|
|
|
|
if( action.isComboAction() && !action.isCorrectCombo() )
|
|
|
|
break;
|
|
|
|
|
|
|
|
if( player.hasStatusEffect( Defiance ) )
|
|
|
|
handleWrath( player, action );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Warrior::handleWrath( Entity::Player& player, Action& action )
|
|
|
|
{
|
|
|
|
auto effectToApply = Wrath;
|
2023-03-09 00:15:55 +01:00
|
|
|
auto parry = 2;
|
2023-03-08 18:07:15 +01:00
|
|
|
auto asChara = player.getAsChara();
|
|
|
|
|
|
|
|
if( player.hasStatusEffect( Wrath ) )
|
|
|
|
{
|
|
|
|
player.replaceSingleStatusEffectById( Wrath );
|
|
|
|
effectToApply = WrathII;
|
2023-03-09 00:15:55 +01:00
|
|
|
parry += 2;
|
2023-03-08 18:07:15 +01:00
|
|
|
}
|
|
|
|
else if( player.hasStatusEffect( WrathII ) )
|
|
|
|
{
|
|
|
|
player.replaceSingleStatusEffectById( WrathII );
|
|
|
|
effectToApply = WrathIII;
|
2023-03-09 00:15:55 +01:00
|
|
|
parry += 2;
|
2023-03-08 18:07:15 +01:00
|
|
|
}
|
|
|
|
else if( player.hasStatusEffect( WrathIII ) )
|
|
|
|
{
|
|
|
|
player.replaceSingleStatusEffectById( WrathIII );
|
|
|
|
effectToApply = WrathIV;
|
2023-03-09 00:15:55 +01:00
|
|
|
parry += 2;
|
2023-03-08 18:07:15 +01:00
|
|
|
}
|
|
|
|
else if( player.hasStatusEffect( WrathIV ) )
|
|
|
|
{
|
|
|
|
player.replaceSingleStatusEffectById( WrathIV );
|
|
|
|
effectToApply = Infuriated;
|
2023-03-09 00:15:55 +01:00
|
|
|
parry += 2;
|
2023-03-08 18:07:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !player.hasStatusEffect( Infuriated ) )
|
|
|
|
{
|
|
|
|
action.applyStatusEffectSelf( effectToApply );
|
2023-03-09 00:15:55 +01:00
|
|
|
player.addStatusEffectByIdIfNotExist( effectToApply, 30000, *asChara, { StatusModifier{ Common::ParamModifier::ParryPercent, parry } } );
|
2023-03-08 18:07:15 +01:00
|
|
|
}
|
|
|
|
}
|