mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 23:27:45 +00:00
Cast interrupting; Skeleton of battle calculation stuff;
This commit is contained in:
parent
edef711afb
commit
71309e3be7
7 changed files with 108 additions and 14 deletions
|
@ -253,16 +253,16 @@ namespace Core {
|
|||
JOB_WARRIOR = 21, // warrior
|
||||
JOB_DRAGON = 22, // dragoon
|
||||
JOB_BARD = 23, // bard
|
||||
JOB_WHITE = 24, // white mage
|
||||
JOB_BLACK = 25, // black mage
|
||||
JOB_WHITEMAGE = 24, // white mage
|
||||
JOB_BLACKMAGE = 25, // black mage
|
||||
CLASS_ARCANIST = 26, // arcanist
|
||||
JOB_SUMMONER = 27, // summoner
|
||||
JOB_SCHOLAR = 28, // scholar
|
||||
CLASS_ROGUE = 29,
|
||||
JOB_NINJA = 30,
|
||||
JOB_MACHINIST = 31, // machinist
|
||||
JOB_DARKKNIGHT = 32, // darknight
|
||||
JOB_ASTROLOGIAN = 33, // astro
|
||||
CLASS_ROGUE = 29, // rogue
|
||||
JOB_NINJA = 30, // ninja
|
||||
JOB_MACHINIST = 31, // machinist
|
||||
JOB_DARKKNIGHT = 32, // darknight
|
||||
JOB_ASTROLOGIAN = 33, // astro
|
||||
JOB_SAMURAI = 34, // sam
|
||||
JOB_REDMAGE = 35, // red mage
|
||||
|
||||
|
|
|
@ -239,8 +239,8 @@ bool Core::Data::ExdData::loadParamGrowInfo()
|
|||
info.piety_scalar = getField< uint16_t >( fields, 3 ); // 3
|
||||
info.mp_const = getField< int32_t >( fields, 4 ); // 4
|
||||
info.base_secondary = getField< int32_t >( fields, 5 );// 5
|
||||
info.hp_mod = getField< uint16_t >( fields, 8 ); // 8
|
||||
info.quest_exp_mod = getField< uint8_t >( fields, 7 ); // 7
|
||||
info.hp_mod = getField< uint16_t >(fields, 8); // 8
|
||||
|
||||
|
||||
m_paramGrowthInfoMap[id] = info;
|
||||
|
|
60
src/servers/Server_Zone/Actor/CalcBattle.cpp
Normal file
60
src/servers/Server_Zone/Actor/CalcBattle.cpp
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include "CalcBattle.h"
|
||||
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
|
||||
#include "Actor.h"
|
||||
#include "Player.h"
|
||||
|
||||
using namespace Core::Entity;
|
||||
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
|
||||
/*
|
||||
Class used for battle-related formulas and calculatio ns.
|
||||
Big thanks to the Theoryjerks group!
|
||||
|
||||
NOTE:
|
||||
Formulas here shouldn't be considered final. It's possible that the formula it was based on is correct but
|
||||
wasn't implemented correctly here, or approximated things due to limited knowledge of how things work in retail.
|
||||
It's also possible that we're using formulas that were correct for previous patches, but not the current version.
|
||||
|
||||
TODO:
|
||||
|
||||
Vitality HP modifier. I can only find values for levels 50~70.
|
||||
HP calculation. Not a lot limiting us here. It should be next.
|
||||
Damage outgoing calculations. This includes auto-attacks, etc.
|
||||
Stats. Will need to align stats from retail with what we have.
|
||||
|
||||
*/
|
||||
|
||||
uint32_t Core::Entity::CalcBattle::measureHp( ActorPtr pActor )
|
||||
{
|
||||
// todo: reduce autos here
|
||||
|
||||
PlayerPtr pPlayer = pActor->getAsPlayer();
|
||||
|
||||
auto classInfoIt = g_exdData.m_classJobInfoMap.find( pPlayer->getClass() );
|
||||
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
|
||||
|
||||
return 10;
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::CalcBattle::measureHeal( ActorPtr pActor, uint32_t potency )
|
||||
{
|
||||
// todo: reduce autos here
|
||||
|
||||
PlayerPtr pPlayer = pActor->getAsPlayer();
|
||||
|
||||
auto classInfoIt = g_exdData.m_classJobInfoMap.find( pPlayer->getClass() );
|
||||
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
|
||||
|
||||
if (classInfoIt == g_exdData.m_classJobInfoMap.end() ||
|
||||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end())
|
||||
return 0;
|
||||
|
||||
|
||||
auto jobModVal = classInfoIt->second;
|
||||
|
||||
// consider 3% variation
|
||||
return potency / 10;
|
||||
}
|
24
src/servers/Server_Zone/Actor/CalcBattle.h
Normal file
24
src/servers/Server_Zone/Actor/CalcBattle.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef _CALCBATTLE_H
|
||||
#define _CALCBATTLE_H
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include "Actor.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Entity {
|
||||
|
||||
class CalcBattle
|
||||
{
|
||||
public:
|
||||
|
||||
static uint32_t measureHp( ActorPtr Player );
|
||||
static uint32_t measureHeal( ActorPtr Player, uint32_t potency );
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -44,6 +44,7 @@
|
|||
#include "src/servers/Server_Zone/Action/EventAction.h"
|
||||
#include "src/servers/Server_Zone/Action/EventItemAction.h"
|
||||
#include "src/servers/Server_Zone/Zone/ZonePosition.h"
|
||||
#include "src/servers/Server_Zone/Actor/CalcBattle.h"
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
extern Core::Logger g_log;
|
||||
|
@ -1465,7 +1466,9 @@ void Core::Entity::Player::autoAttack( ActorPtr pTarget )
|
|||
uint32_t damage = mainWeap->getAutoAttackDmg();
|
||||
uint32_t variation = 0 + rand() % 3;
|
||||
|
||||
if( getClass() == 5 || getClass() == 23 || getClass() == 31 )
|
||||
if (getClass() == JOB_MACHINIST ||
|
||||
getClass() == JOB_BARD ||
|
||||
getClass() == CLASS_ARCHER)
|
||||
{
|
||||
GamePacketNew< FFXIVIpcEffect > effectPacket(getId());
|
||||
effectPacket.data().targetId = pTarget->getId();
|
||||
|
@ -1544,7 +1547,10 @@ void Core::Entity::Player::handleScriptSkill( uint32_t type, uint32_t actionId,
|
|||
|
||||
case Core::Common::HandleSkillType::StdHeal:
|
||||
{
|
||||
uint32_t calculatedHeal = CalcBattle::measureHeal( shared_from_this(), param1 );
|
||||
|
||||
sendDebug( "STD_HEAL" );
|
||||
|
||||
GamePacketNew< FFXIVIpcEffect > effectPacket( getId() );
|
||||
effectPacket.data().targetId = pTarget.getId();
|
||||
effectPacket.data().actionAnimationId = actionId;
|
||||
|
@ -1554,14 +1560,14 @@ void Core::Entity::Player::handleScriptSkill( uint32_t type, uint32_t actionId,
|
|||
effectPacket.data().numEffects = 1;
|
||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( getRotation() );
|
||||
effectPacket.data().effectTarget = pTarget.getId();
|
||||
effectPacket.data().effects[0].param1 = param1;
|
||||
effectPacket.data().effects[0].param1 = calculatedHeal;
|
||||
effectPacket.data().effects[0].unknown_1 = 4;
|
||||
effectPacket.data().effects[0].unknown_2 = 1;
|
||||
effectPacket.data().effects[0].unknown_3 = 7;
|
||||
|
||||
sendToInRangeSet( effectPacket, true );
|
||||
|
||||
pTarget.heal( param1 );
|
||||
pTarget.heal( calculatedHeal );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,13 +56,13 @@ void Core::Entity::Player::equipWeapon( Core::ItemPtr pItem )
|
|||
case ItemCategory::ThmWep:
|
||||
case ItemCategory::Thm2Wep:
|
||||
if( currentClass != ClassJob::CLASS_THAUMATURGE &&
|
||||
currentClass != ClassJob::JOB_BLACK )
|
||||
currentClass != ClassJob::JOB_BLACKMAGE )
|
||||
setClassJob( ClassJob::CLASS_THAUMATURGE );
|
||||
break;
|
||||
case ItemCategory::CnjWep:
|
||||
case ItemCategory::Cnj2Wep:
|
||||
if( currentClass != ClassJob::CLASS_CONJURER &&
|
||||
currentClass != ClassJob::JOB_WHITE )
|
||||
currentClass != ClassJob::JOB_WHITEMAGE )
|
||||
setClassJob( ClassJob::CLASS_CONJURER );
|
||||
break;
|
||||
case ItemCategory::ArnWep:
|
||||
|
|
|
@ -106,7 +106,11 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
pPlayer->changeTarget( targetId );
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x69: // Cancel cast
|
||||
{
|
||||
pPlayer->getCurrentAction()->setInterrupted();
|
||||
break;
|
||||
}
|
||||
case 0x133: // Update howtos seen
|
||||
{
|
||||
uint32_t howToId = static_cast< uint32_t >( param1 );
|
||||
|
|
Loading…
Add table
Reference in a new issue