1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-23 13:17:45 +00:00

Small fixes

Fixed final message for multi-hit attacks.
Fixed self targeting for commands
Made it so player.lua doesn't skip over home points setting, just the quest setitng.
Began adding knockback effect handling
This commit is contained in:
yogurt 2018-06-25 18:20:20 -05:00
parent 79f2edf406
commit ace4dfe58f
8 changed files with 59 additions and 42 deletions

View file

@ -1072,6 +1072,7 @@ namespace FFXIVClassic_Map_Server.Actors
foreach (var chara in targets) foreach (var chara in targets)
{ {
ushort hitCount = 0; ushort hitCount = 0;
ushort totalDamage = 0;
for (int hitNum = 1; hitNum <= command.numHits; hitNum++) for (int hitNum = 1; hitNum <= command.numHits; hitNum++)
{ {
var action = new BattleAction(chara.actorId, command, (byte)GetHitDirection(chara), (byte) hitNum); var action = new BattleAction(chara.actorId, command, (byte)GetHitDirection(chara), (byte) hitNum);
@ -1084,13 +1085,16 @@ namespace FFXIVClassic_Map_Server.Actors
{ {
hitTarget = true; hitTarget = true;
hitCount++; hitCount++;
totalDamage += action.amount;
} }
} }
if (command.numHits > 1) if (command.numHits > 1)
{ {
//You use [command] on [target]. //30442: [hitCount]fold Attack! [chara] takes a total of totalDamage points of damage.
actions.AddAction(new BattleAction(chara.actorId, 30442, 0, 0, (byte)hitCount)); //30450: All attacks miss!
ushort textId = (ushort) (hitTarget ? 30442 : 30450);
actions.AddAction(new BattleAction(chara.actorId, textId, 0, totalDamage, (byte)hitCount));
} }
} }

View file

@ -92,6 +92,7 @@ namespace FFXIVClassic_Map_Server.actors.chara
Regain = 70, //TP regen, should be -90 out of combat, Invigorate sets to 100+ depending on traits Regain = 70, //TP regen, should be -90 out of combat, Invigorate sets to 100+ depending on traits
RegenDown = 71, //Damage over time effects. Separate from normal Regen because of how they are displayed in game RegenDown = 71, //Damage over time effects. Separate from normal Regen because of how they are displayed in game
Stoneskin = 72, //Nullifies damage Stoneskin = 72, //Nullifies damage
MinimumTpLock = 73 MinimumTpLock = 73, //Don't let TP fall below this, used in openings
KnockbackImmune = 74 //Immune to knockback effects when above 0
} }
} }

View file

@ -75,6 +75,21 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
Spell = 4 Spell = 4
} }
public enum KnockbackType : ushort
{
None = 0,
Level1 = 1,
Level2 = 2,
Level3 = 3,
Level4 = 4,
Level5 = 5,
Clockwise1 = 6,
Clockwise2 = 7,
CounterClockwise1 = 8,
CounterClockwise2 = 9,
DrawIn = 10
}
class BattleCommand class BattleCommand
{ {
public ushort id; public ushort id;
@ -121,7 +136,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
public float accuracyModifier; //modifies accuracy public float accuracyModifier; //modifies accuracy
public float bonusCritRate; //extra crit rate public float bonusCritRate; //extra crit rate
public bool isCombo; public bool isCombo;
public bool isRanged; public bool isRanged = false;
public bool actionCrit; //Whether any actions were critical hits, used for Excruciate public bool actionCrit; //Whether any actions were critical hits, used for Excruciate
@ -365,28 +380,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
return targetFind?.GetTargets<Character>(); return targetFind?.GetTargets<Character>();
} }
//Handles setting the correct target for self-targeted spells
public Character GetMainTarget(Character caster, Character target)
{
//If skill can only be used on self
if (mainTarget == ValidTarget.Self)
return caster;
//If skill can only be used on party members and the target is not a party member
else if (((mainTarget & ValidTarget.PartyMember) != 0) && (target.currentParty != caster.currentParty))
return caster;
//If skill can only be used on allys and the target is not an ally
else if (((mainTarget & ValidTarget.Ally) != 0) && (target.allegiance != caster.allegiance))
return caster;
//If skill can only be used on players and the target is not a player
else if (((mainTarget & ValidTarget.Player) != 0) && (!(target is Player)))
return caster;
return target;
}
public ushort GetCommandType() public ushort GetCommandType()
{ {
return (ushort) commandType; return (ushort) commandType;
} }
} }
} }

View file

@ -129,12 +129,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
RoamingSoul = 223111, RoamingSoul = 223111,
Purge = 223112, Purge = 223112,
Spiritsong = 223113, Spiritsong = 223113,
Resonance = 223114, Resonance = 223114, //Old Resonance? Both have the same icons and description
Soughspeak = 223115, Soughspeak = 223115,
PresenceofMind2 = 223116, PresenceofMind2 = 223116,
SanguineRite = 223117, //old effect SanguineRite = 223117, //old effect
PunishingBarbs = 223118, PunishingBarbs = 223118,
DarkSeal = 223119, DarkSeal = 223119, //old effect
Emulate = 223120, Emulate = 223120,
ParadigmShift = 223121, ParadigmShift = 223121,
ConcussiveBlowx1 = 223123, ConcussiveBlowx1 = 223123,
@ -241,7 +241,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
ShroudofSaints = 223226, ShroudofSaints = 223226,
ClericStance = 223227, ClericStance = 223227,
BlissfulMind = 223228, BlissfulMind = 223228,
DarkSeal2 = 223229, DarkSeal2 = 223229, //new effect
Resonance2 = 223230, Resonance2 = 223230,
Excruciate = 223231, Excruciate = 223231,
Necrogenesis = 223232, Necrogenesis = 223232,

View file

@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
this.skill = Server.GetWorldManager().GetBattleCommand(skillId); this.skill = Server.GetWorldManager().GetBattleCommand(skillId);
var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "ability", "onAbilityPrepare", owner, target, skill); var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "ability", "onAbilityPrepare", owner, target, skill);
this.target = skill.GetMainTarget(owner, target); this.target = target != null ? target : owner;
if (returnCode == 0) if (returnCode == 0)
{ {

View file

@ -26,7 +26,15 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
this.spell = Server.GetWorldManager().GetBattleCommand(spellId); this.spell = Server.GetWorldManager().GetBattleCommand(spellId);
var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicPrepare", owner, target, spell); var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicPrepare", owner, target, spell);
this.target = spell.GetMainTarget(owner, target); //Modify spell based on status effects. Need to do it here because they can modify cast times
List<StatusEffect> effects = owner.statusEffects.GetStatusEffectsByFlag((uint)(StatusEffectFlags.ActivateOnCastStart));
//modify skill based on status effects
//Do this here to allow buffs like Resonance to increase range before checking CanCast()
foreach (var effect in effects)
lua.LuaEngine.CallLuaStatusEffectFunction(owner, effect, "onMagicCast", owner, effect, spell);
this.target = target != null ? target : owner;
if (returnCode == 0 && owner.CanCast(this.target, spell)) if (returnCode == 0 && owner.CanCast(this.target, spell))
{ {
@ -65,13 +73,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
spell.isCombo = true; spell.isCombo = true;
} }
//Modify spell based on status effects. Need to do it here because they can modify cast times
List<StatusEffect> effects = owner.statusEffects.GetStatusEffectsByFlag((uint) (StatusEffectFlags.ActivateOnCastStart));
//modify skill based on status effects
foreach (var effect in effects)
lua.LuaEngine.CallLuaStatusEffectFunction(owner, effect, "onMagicCast", owner, effect, spell);
if (!spell.IsInstantCast()) if (!spell.IsInstantCast())
{ {
// command casting duration // command casting duration

View file

@ -50,6 +50,21 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
{ HitType.Crit, HitEffect.Crit } { HitType.Crit, HitEffect.Crit }
}; };
public static Dictionary<KnockbackType, HitEffect> KnockbackEffects = new Dictionary<KnockbackType, HitEffect>()
{
{ KnockbackType.None, 0 },
{ KnockbackType.Level1, HitEffect.KnockbackLv1 },
{ KnockbackType.Level2, HitEffect.KnockbackLv2 },
{ KnockbackType.Level3, HitEffect.KnockbackLv3 },
{ KnockbackType.Level4, HitEffect.KnockbackLv4 },
{ KnockbackType.Level5, HitEffect.KnockbackLv5 },
{ KnockbackType.Clockwise1, HitEffect.KnockbackClockwiseLv1 },
{ KnockbackType.Clockwise2, HitEffect.KnockbackClockwiseLv2 },
{ KnockbackType.CounterClockwise1, HitEffect.KnockbackCounterClockwiseLv1 },
{ KnockbackType.CounterClockwise2, HitEffect.KnockbackCounterClockwiseLv2 },
{ KnockbackType.DrawIn, HitEffect.DrawIn }
};
public static Dictionary<byte, ushort> ClassExperienceTextIds = new Dictionary<byte, ushort>() public static Dictionary<byte, ushort> ClassExperienceTextIds = new Dictionary<byte, ushort>()
{ {
{ 2, 33934 }, //Pugilist { 2, 33934 }, //Pugilist

View file

@ -1,24 +1,24 @@
require("global");
local initClassItems, initRaceItems; local initClassItems, initRaceItems;
function onBeginLogin(player) function onBeginLogin(player)
--New character, set the initial quest --New character, set the initial quest
--[[
if (player:GetPlayTime(false) == 0) then if (player:GetPlayTime(false) == 0) then
initialTown = player:GetInitialTown(); initialTown = player:GetInitialTown();
if (initialTown == 1 and player:HasQuest(110001) == false) then if (initialTown == 1 and player:HasQuest(110001) == false) then
player:AddQuest(110001); --player:AddQuest(110001);
player:SetHomePoint(1280001); player:SetHomePoint(1280001);
elseif (initialTown == 2 and player:HasQuest(110005) == false) then elseif (initialTown == 2 and player:HasQuest(110005) == false) then
player:AddQuest(110005); --player:AddQuest(110005);
player:SetHomePoint(1280061); player:SetHomePoint(1280061);
elseif (initialTown == 3 and player:HasQuest(110009) == false) then elseif (initialTown == 3 and player:HasQuest(110009) == false) then
player:AddQuest(110009); --player:AddQuest(110009);
player:SetHomePoint(1280031); player:SetHomePoint(1280031);
end end
end end
]]
--For Opening. Set Director and reset position incase d/c --For Opening. Set Director and reset position incase d/c
if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then
director = player:GetZone():CreateDirector("OpeningDirector", false); director = player:GetZone():CreateDirector("OpeningDirector", false);