Combat additions

Added formulas for base EXP gain and chain experience
Added basic scripts for most player abilities and effects
Added stat gains for some abilities
Changed status flags
Fixed bug with player death
Fixed bug where auto attacks didnt work when not locked on
Added traits
This commit is contained in:
yogurt 2018-04-18 16:06:41 -05:00
parent b8d6a943aa
commit c5ce2ec771
239 changed files with 5125 additions and 1237 deletions

View file

@ -8,13 +8,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MoonSharp.Interpreter;
using FFXIVClassic.Common;
namespace FFXIVClassic_Map_Server.actors.chara.ai
{
enum StatusEffectId : uint
{
RageofHalone = 221021,
Quick = 223001,
Haste = 223002,
Slow = 223003,
@ -99,7 +100,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
Retaliation = 223082,
Foresight = 223083,
Defender = 223084,
Rampage = 223085,
Rampage = 223085, //old effect
Enraged = 223086,
Warmonger = 223087,
Disorientx1 = 223088,
@ -119,10 +120,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
LifeSap = 223102,
Farshot = 223103,
QuellingStrike = 223104,
RagingStrike = 223105,
RagingStrike = 223105, //old effect
HawksEye = 223106,
SubtleRelease = 223107,
Decoy = 223108,
Decoy = 223108, //Untraited
Profundity = 223109,
TranceChant = 223110,
RoamingSoul = 223111,
@ -140,10 +141,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
ConcussiveBlowx2 = 223124,
ConcussiveBlowx3 = 223125,
SkullSunder = 223126,
Bloodletter = 223127,
Bloodletter = 223127, //comboed effect
Levinbolt = 223128,
Protect = 223129,
Shell = 223130,
Protect = 223129, //old Protect
Shell = 223130, //old shell
Reraise = 223131,
ShockSpikes = 223132,
Stoneskin = 223133,
@ -219,8 +220,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
StealthIV = 223204,
Combo = 223205,
GoringBlade = 223206,
Berserk2 = 223207,
Rampage2 = 223208,
Berserk2 = 223207, //new effect
Rampage2 = 223208, //new effect
FistsofFire = 223209,
FistsofEarth = 223210,
FistsofWind = 223211,
@ -249,10 +250,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
Aero = 223235,
Outmaneuver2 = 223236,
Blindside2 = 223237,
Decoy2 = 223238,
Protect2 = 223239,
Decoy2 = 223238, //Traited
Protect2 = 223239, //new Protect
SanguineRite3 = 223240,
Bloodletter2 = 223241,
Bloodletter2 = 223241, //uncomboed effect
FullyBlissfulMind = 223242,
MagicEvasionDown = 223243,
HundredFists = 223244,
@ -327,46 +328,54 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
EvadeProc = 253003,
BlockProc = 253004,
ParryProc = 253005,
MissProc = 253006
MissProc = 253006,
EXPChain = 253007
}
[Flags]
enum StatusEffectFlags : uint
{
None = 0,
Silent = 1 << 0, // dont display effect loss message
Silent = 1 << 0, // dont display effect loss message
//Loss flags
LoseOnDeath = 1 << 1, // effects removed on death
LoseOnZoning = 1 << 2, // effects removed on zoning
LoseOnEsuna = 1 << 3, // effects which can be removed with esuna (debuffs)
LoseOnDispel = 1 << 4, // some buffs which player might be able to dispel from mob
LoseOnLogout = 1 << 5, // effects removed on logging out
LoseOnAttacking = 1 << 6, // effects removed when owner attacks another entity
LoseOnCasting = 1 << 7, // effects removed when owner starts casting
LoseOnDamageTaken = 1 << 8, // effects removed when owner takes damage
LoseOnParry = 1 << 9, // effects removed when owner parries an attack (foresight)
LoseOnEvade = 1 << 10, // effects removed when owner evades an attack (decoy)
LoseOnCrit = 1 << 11, // effects removed when owner deals a critical hit (excruciate)
LoseOnAggro = 1 << 12, // effects removed when owner gains enmity (swiftsong)
LoseOnDeath = 1 << 1, // effects removed on death
LoseOnZoning = 1 << 2, // effects removed on zoning
LoseOnEsuna = 1 << 3, // effects which can be removed with esuna (debuffs)
LoseOnDispel = 1 << 4, // some buffs which player might be able to dispel from mob
LoseOnLogout = 1 << 5, // effects removed on logging out
LoseOnAttacking = 1 << 6, // effects removed when owner attacks another entity
LoseOnCastStart = 1 << 7, // effects removed when owner starts casting
LoseOnAggro = 1 << 8, // effects removed when owner gains enmity (swiftsong)
//Activate flags, do we need the LoseOn flags if we have these? could just remove itself in the activate function
ActivateOnAttack = 1 << 13,
ActivateOnSpell = 1 << 14,
ActivateOnDamageTaken = 1 << 15,
ActivateOnBlock = 1 << 16,
ActivateOnMiss = 1 << 17,
//Activate flags
ActivateOnCastStart = 1 << 9, //Activates when a cast starts.
ActivateOnCommandStart = 1 << 10, //Activates when a command is used, before iterating over targets. Used for things like power surge, excruciate.
ActivateOnCommandFinish = 1 << 11, //Activates when the command is finished, after all targets have been iterated over. Used for things like Excruciate and Resonance falling off.
ActivateOnPreactionTarget = 1 << 12, //Activates after initial rates are calculated for an action against owner
ActivateOnPreactionCaster = 1 << 13, //Activates after initial rates are calculated for an action by owner
ActivateOnDamageTaken = 1 << 14,
ActivateOnHealed = 1 << 15,
//Should these be rolled into DamageTaken?
ActivateOnMiss = 1 << 16, //Activates when owner misses
ActivateOnEvade = 1 << 17, //Activates when owner evades
ActivateOnParry = 1 << 18, //Activates when owner parries
ActivateOnBlock = 1 << 19, //Activates when owner evades
ActivateOnHit = 1 << 20, //Activates when owner hits
ActivateOnCrit = 1 << 21, //Activates when owner crits
//Prevent flags. Sleep/stun/petrify/etc combine these
PreventSpell= 1 << 18, // effects which prevent using spells, such as silence
PreventWeaponSkill = 1 << 19, // effects which prevent using weaponskills, such as pacification
PreventAbility = 1 << 20, // effects which prevent using abilities, such as amnesia
PreventAttack = 1 << 21, // effects which prevent basic attacks
PreventMovement = 1 << 22, // effects which prevent movement such as bind, still allows turning in place
PreventTurn = 1 << 23, // effects which prevent turning such as fixation, still allows movement and actions
PreventSpell = 1 << 22, // effects which prevent using spells, such as silence
PreventWeaponSkill = 1 << 23, // effects which prevent using weaponskills, such as pacification
PreventAbility = 1 << 24, // effects which prevent using abilities, such as amnesia
PreventAttack = 1 << 25, // effects which prevent basic attacks
PreventMovement = 1 << 26, // effects which prevent movement such as bind, still allows turning in place
PreventTurn = 1 << 27, // effects which prevent turning, such as stun
PreventUntarget = 1 << 28, // effects which prevent changing targets, such as fixation
Stealth = 1 << 24, // sneak/invis
Stance = 1 << 25, // effects that do not have a timer
Stealth = 1 << 29, // sneak/invis
Stance = 1 << 30, // effects that do not have a timer
}
enum StatusEffectOverwrite : byte
@ -380,18 +389,18 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
class StatusEffect
{
// todo: probably use get;set;
private Character owner;
private Character source;
private StatusEffectId id;
private string name; // name of this effect
private DateTime startTime; // when was this effect added
private DateTime endTime; // when this status falls off
private DateTime lastTick; // when did this effect last tick
private uint duration; // how long should this effect last in seconds
private uint tickMs; // how often should this effect proc
private UInt64 magnitude; // a value specified by scripter which is guaranteed to be used by all effects
private double magnitude; // a value specified by scripter which is guaranteed to be used by all effects
private byte tier; // same effect with higher tier overwrites this
private UInt64 extra; // optional value
private double extra; // optional value
private StatusEffectFlags flags; // death/erase/dispel etc
private StatusEffectOverwrite overwrite; // how to handle adding an effect with same id (see StatusEfectOverwrite)
private bool silent = false; // do i send a message on losing effect
@ -400,7 +409,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
HitEffect animationEffect;
public StatusEffect(Character owner, uint id, UInt64 magnitude, uint tickMs, uint duration, byte tier = 0)
public StatusEffect(Character owner, uint id, double magnitude, uint tickMs, uint duration, byte tier = 0)
{
this.owner = owner;
this.source = owner;
@ -448,10 +457,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
if (tickMs != 0 && (tick - lastTick).TotalMilliseconds >= tickMs)
{
lastTick = tick;
LuaEngine.CallLuaStatusEffectFunction(this.owner, this, "onTick", this.owner, this);
if (LuaEngine.CallLuaStatusEffectFunction(this.owner, this, "onTick", this.owner, this) > 0)
return true;
}
if (duration != 0xFFFFFFFF && (tick - startTime).TotalSeconds >= duration)
if (duration >= 0 && tick >= endTime)
{
return true;
}
@ -463,6 +473,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
DynValue res = new DynValue();
return lua.LuaEngine.CallLuaStatusEffectFunction(chara, this, functionName, args);
if (!script.Globals.Get(functionName).IsNil())
{
res = script.Call(script.Globals.Get(functionName), args);
@ -470,7 +481,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
return (int)res.Number;
}
return -1;
}
public Character GetOwner()
@ -498,6 +508,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
return startTime;
}
public DateTime GetEndTime()
{
return endTime;
}
public string GetName()
{
return name;
@ -513,7 +528,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
return tickMs;
}
public UInt64 GetMagnitude()
public double GetMagnitude()
{
return magnitude;
}
@ -523,7 +538,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
return tier;
}
public UInt64 GetExtra()
public double GetExtra()
{
return extra;
}
@ -554,6 +569,21 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
this.lastTick = time;
}
public void SetEndTime(DateTime time)
{
endTime = time;
}
//Refresh the status, updating the end time based on the duration of the status and broadcasts the new time
public void RefreshTime()
{
endTime = DateTime.Now.AddSeconds(GetDuration());
int index = Array.IndexOf(owner.charaWork.status, GetStatusId());
if (index >= 0)
owner.statusEffects.SetTimeAtIndex(index, (uint) Utils.UnixTimeStampUTC(endTime));
}
public void SetOwner(Character owner)
{
this.owner = owner;
@ -569,7 +599,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
this.name = name;
}
public void SetMagnitude(UInt64 magnitude)
public void SetMagnitude(double magnitude)
{
this.magnitude = magnitude;
}
@ -589,7 +619,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
this.tier = tier;
}
public void SetExtra(UInt64 val)
public void SetExtra(double val)
{
this.extra = val;
}