mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
Add job actions for warrior
This commit is contained in:
parent
801fc9da8a
commit
aaad18bf7b
5 changed files with 100 additions and 0 deletions
|
@ -31,6 +31,8 @@
|
||||||
#include <Service.h>
|
#include <Service.h>
|
||||||
#include "WorldServer.h"
|
#include "WorldServer.h"
|
||||||
|
|
||||||
|
#include "Job/Warrior.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network;
|
using namespace Sapphire::Network;
|
||||||
|
@ -604,6 +606,8 @@ void Action::Action::handleAction()
|
||||||
if( m_lutEntry.statuses.caster.size() > 0 || m_lutEntry.statuses.target.size() > 0 )
|
if( m_lutEntry.statuses.caster.size() > 0 || m_lutEntry.statuses.target.size() > 0 )
|
||||||
handleStatusEffects();
|
handleStatusEffects();
|
||||||
|
|
||||||
|
handleJobAction();
|
||||||
|
|
||||||
m_effectBuilder->buildAndSendPackets( m_hitActors );
|
m_effectBuilder->buildAndSendPackets( m_hitActors );
|
||||||
|
|
||||||
// TODO: disabled, reset kills our queued actions
|
// TODO: disabled, reset kills our queued actions
|
||||||
|
@ -643,6 +647,18 @@ void Action::Action::handleStatusEffects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Action::Action::handleJobAction()
|
||||||
|
{
|
||||||
|
switch( m_pSource->getClass() )
|
||||||
|
{
|
||||||
|
case ClassJob::Warrior:
|
||||||
|
{
|
||||||
|
Warrior::onAction( *m_pSource->getAsPlayer(), *this );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Action::Action::preCheck()
|
bool Action::Action::preCheck()
|
||||||
{
|
{
|
||||||
if( auto player = m_pSource->getAsPlayer() )
|
if( auto player = m_pSource->getAsPlayer() )
|
||||||
|
|
|
@ -111,6 +111,8 @@ namespace Sapphire::World::Action
|
||||||
|
|
||||||
void handleStatusEffects();
|
void handleStatusEffects();
|
||||||
|
|
||||||
|
void handleJobAction();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Adds an actor filter to this action.
|
* @brief Adds an actor filter to this action.
|
||||||
* @param filter The ptr to the ActorFilter to add
|
* @param filter The ptr to the ActorFilter to add
|
||||||
|
|
61
src/world/Action/Job/Warrior.cpp
Normal file
61
src/world/Action/Job/Warrior.cpp
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#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;
|
||||||
|
auto asChara = player.getAsChara();
|
||||||
|
|
||||||
|
if( player.hasStatusEffect( Wrath ) )
|
||||||
|
{
|
||||||
|
player.replaceSingleStatusEffectById( Wrath );
|
||||||
|
effectToApply = WrathII;
|
||||||
|
}
|
||||||
|
else if( player.hasStatusEffect( WrathII ) )
|
||||||
|
{
|
||||||
|
player.replaceSingleStatusEffectById( WrathII );
|
||||||
|
effectToApply = WrathIII;
|
||||||
|
}
|
||||||
|
else if( player.hasStatusEffect( WrathIII ) )
|
||||||
|
{
|
||||||
|
player.replaceSingleStatusEffectById( WrathIII );
|
||||||
|
effectToApply = WrathIV;
|
||||||
|
}
|
||||||
|
else if( player.hasStatusEffect( WrathIV ) )
|
||||||
|
{
|
||||||
|
player.replaceSingleStatusEffectById( WrathIV );
|
||||||
|
effectToApply = Infuriated;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !player.hasStatusEffect( Infuriated ) )
|
||||||
|
{
|
||||||
|
action.applyStatusEffectSelf( effectToApply );
|
||||||
|
player.addStatusEffectByIdIfNotExist( effectToApply, 30000, *asChara );
|
||||||
|
}
|
||||||
|
}
|
20
src/world/Action/Job/Warrior.h
Normal file
20
src/world/Action/Job/Warrior.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Common.h>
|
||||||
|
#include "ForwardsZone.h"
|
||||||
|
#include <cstdint>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Sapphire::World::Action
|
||||||
|
{
|
||||||
|
class Warrior
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void onAction( Entity::Player& player, Action& action );
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void handleWrath( Entity::Player& player, Action& action );
|
||||||
|
};
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ file( GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
*.cpp
|
*.cpp
|
||||||
Actor/*.cpp
|
Actor/*.cpp
|
||||||
Action/*.cpp
|
Action/*.cpp
|
||||||
|
Action/Job/*.cpp
|
||||||
ContentFinder/*.cpp
|
ContentFinder/*.cpp
|
||||||
DebugCommand/*.cpp
|
DebugCommand/*.cpp
|
||||||
Event/*.cpp
|
Event/*.cpp
|
||||||
|
|
Loading…
Add table
Reference in a new issue