AoE rewrite and bug fixes

Rewrote aoe checks for cone and line aoes and added minimum distance values
Added height checks for commands
Fixed combo effects repeating for every target hit by AoE attacks
Fixed teleport sometimes not raising (I think)
Fixed gear checks in some command scripts
This commit is contained in:
yogurt
2018-07-02 00:45:06 -05:00
parent 8c5375f609
commit cf30eef39e
34 changed files with 483 additions and 330 deletions

View File

@@ -47,7 +47,20 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
}
else
{
//owner.LookAt(target);
if (!skill.IsInstantCast())
{
float castTime = skill.castTimeMs;
// command casting duration
if (owner is Player)
{
// todo: modify spellSpeed based on modifiers and stuff
((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime)));
}
owner.SendChant(0xf, 0x0);
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1));
}
}
}
@@ -66,7 +79,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
// todo: check weapon delay/haste etc and use that
var actualCastTime = skill.castTimeMs;
if ((tick - startTime).Milliseconds >= skill.castTimeMs)
if ((tick - startTime).TotalMilliseconds >= skill.castTimeMs)
{
OnComplete();
return true;
@@ -88,6 +101,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnComplete()
{
owner.LookAt(target);
bool hitTarget = false;
skill.targetFind.FindWithinArea(target, skill.validTarget, skill.aoeTarget);
@@ -130,6 +144,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void Cleanup()
{
owner.SendChant(0, 0);
owner.aiContainer.UpdateLastActionTime(skill.animationDurationSeconds);
}
}

View File

@@ -104,7 +104,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
//List<BattleAction> actions = new List<BattleAction>();
BattleActionContainer actions = new BattleActionContainer();
target.SetMod((uint) Modifier.MinimumHpLock, 0);
var i = 0;
for (int hitNum = 0; hitNum < 1 /* owner.GetMod((uint) Modifier.HitCount)*/; hitNum++)
@@ -123,7 +122,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
BattleAction error = null;// new BattleAction(0, null, 0, 0);
//owner.DoActions(null, actions.GetList(), ref error);
//owner.OnAttack(this, actions[0], ref errorResult);
owner.DoBattleAction(22104, 0x19001000, actions.GetList());
var anim = (uint)(17 << 24 | 1 << 12);
owner.DoBattleAction(22104, anim, actions.GetList());
}
public override void TryInterrupt()
@@ -161,6 +161,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
{
return false;
}
if (!owner.IsFacing(target))
{
return false;
}
// todo: shouldnt need to check if owner is dead since all states would be cleared
if (owner.IsDead() || target.IsDead())
{
@@ -179,7 +184,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
{
if (owner is Player)
{
((Player)owner).SendGameMessage(Server.GetWorldManager().GetActor(), 32539, 0x20);
//The target is too far away
((Player)owner).SendGameMessage(Server.GetWorldManager().GetActor(), 32537, 0x20);
}
return false;
}

View File

@@ -61,18 +61,21 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
// todo: check within attack range
float[] baseCastDuration = { 1.0f, 0.25f };
//There are no positional spells, so just check onCombo, need to check first because certain spells change aoe type/accuracy
//If owner is a player and the spell being used is part of the current combo
if (owner is Player p && p.GetClass() == spell.job)
{
if (spell.comboStep == 1 || ((p.playerWork.comboNextCommandId[0] == spell.id || p.playerWork.comboNextCommandId[1] == spell.id)))
{
lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onCombo", owner, target, spell);
spell.isCombo = true;
}
}
//Check combo stuff here because combos can impact spell cast times
float spellSpeed = spell.castTimeMs;
//There are no positional spells, so just check onCombo, need to check first because certain spells change aoe type/accuracy
//If owner is a player and the spell being used is part of the current combo
if (spell.comboStep == 1 || ((owner is Player p) && (p.playerWork.comboNextCommandId[0] == spell.id || p.playerWork.comboNextCommandId[1] == spell.id)))
{
lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onCombo", owner, target, spell);
spell.isCombo = true;
}
if (!spell.IsInstantCast())
{
// command casting duration

View File

@@ -46,7 +46,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
}
else
{
owner.LookAt(target);
hitDirection = owner.GetHitDirection(target);
//Do positionals and combo effects first because these can influence accuracy and amount of targets/numhits, which influence the rest of the steps
@@ -76,6 +75,21 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
skill.isCombo = true;
}
}
if (!skill.IsInstantCast())
{
float castTime = skill.castTimeMs;
// command casting duration
if (owner is Player)
{
// todo: modify spellSpeed based on modifiers and stuff
((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime)));
}
owner.SendChant(0xf, 0x0);
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1));
}
}
}
}
@@ -95,7 +109,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
// todo: check weapon delay/haste etc and use that
var actualCastTime = skill.castTimeMs;
if ((tick - startTime).Milliseconds >= skill.castTimeMs)
if ((tick - startTime).TotalMilliseconds >= skill.castTimeMs)
{
OnComplete();
return true;
@@ -117,6 +131,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnComplete()
{
owner.LookAt(target);
skill.targetFind.FindWithinArea(target, skill.validTarget, skill.aoeTarget);
isCompleted = true;