Combat fixes

Add actor update flag for hotbar to send hotbar changes all at once.
Add script for equipping all actions for a class/job.

Fix multiple script errors.
Fix multiple status flag errors
Fix battle command db errors
Fix error in spawnnpc and yolo.
This commit is contained in:
Yogurt 2019-06-01 21:21:21 -07:00
parent a92ece58c1
commit 3104478263
20 changed files with 149 additions and 48 deletions

View file

@ -61,4 +61,47 @@ TargetFindAOEType =
Circle = 1,
Cone = 2,
Box = 3
}
StatusEffectFlags =
{
None = 0,
--Loss flags - Do we need loseonattacking/caststart? Could just be done with activate flags
LoseOnDeath = bit32.lshift(1, 0), -- effects removed on death
LoseOnZoning = bit32.lshift(1, 1), -- effects removed on zoning
LoseOnEsuna = bit32.lshift(1, 2), -- effects which can be removed with esuna (debuffs)
LoseOnDispel = bit32.lshift(1, 3), -- some buffs which player might be able to dispel from mob
LoseOnLogout = bit32.lshift(1, 4), -- effects removed on logging out
LoseOnAttacking = bit32.lshift(1, 5), -- effects removed when owner attacks another entity
LoseOnCastStart = bit32.lshift(1, 6), -- effects removed when owner starts casting
LoseOnAggro = bit32.lshift(1, 7), -- effects removed when owner gains enmity (swiftsong)
LoseOnClassChange = bit32.lshift(1, 8), --Effect falls off whhen changing class
--Activate flags
ActivateOnCastStart = bit32.lshift(1, 9), --Activates when a cast starts.
ActivateOnCommandStart = bit32.lshift(1, 10), --Activates when a command is used, before iterating over targets. Used for things like power surge, excruciate.
ActivateOnCommandFinish = bit32.lshift(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 = bit32.lshift(1, 12), --Activates after initial rates are calculated for an action against owner
ActivateOnPreactionCaster = bit32.lshift(1, 13), --Activates after initial rates are calculated for an action by owner
ActivateOnDamageTaken = bit32.lshift(1, 14),
ActivateOnHealed = bit32.lshift(1, 15),
--Should these be rolled into DamageTaken?
ActivateOnMiss = bit32.lshift(1, 16), --Activates when owner misses
ActivateOnEvade = bit32.lshift(1, 17), --Activates when owner evades
ActivateOnParry = bit32.lshift(1, 18), --Activates when owner parries
ActivateOnBlock = bit32.lshift(1, 19), --Activates when owner evades
ActivateOnHit = bit32.lshift(1, 20), --Activates when owner hits
ActivateOnCrit = bit32.lshift(1, 21), --Activates when owner crits
--Prevent flags. Sleep/stun/petrify/etc combine these
PreventSpell = bit32.lshift(1, 22), -- effects which prevent using spells, such as silence
PreventWeaponSkill = bit32.lshift(1, 23), -- effects which prevent using weaponskills, such as pacification
PreventAbility = bit32.lshift(1, 24), -- effects which prevent using abilities, such as amnesia
PreventAttack = bit32.lshift(1, 25), -- effects which prevent basic attacks
PreventMovement = bit32.lshift(1, 26), -- effects which prevent movement such as bind, still allows turning in place
PreventTurn = bit32.lshift(1, 27), -- effects which prevent turning, such as stun
PreventUntarget = bit32.lshift(1, 28), -- effects which prevent changing targets, such as fixation
Stance = bit32.lshift(1, 29) -- effects that do not have a timer
}

View file

@ -16,4 +16,5 @@ end;
function onSkillFinish(caster, target, skill, action, actionContainer)
--Need a way to get all targets with hate for player
--target.hateContainer.UpdateHate(caster, -840);
action.DoAction(caster, target, skill, actionContainer);
end;

View file

@ -20,8 +20,7 @@ function onSkillFinish(caster, target, skill, action, actionContainer)
if buff ~= nil then
--30329: Your Raging Strike removes your Raging Strike effect.
local remAction = caster.statusEffects.RemoveStatusEffect(buff, actionContainer, 30329);
actionContainer.AddAction(remAction);
caster.statusEffects.RemoveStatusEffect(buff, actionContainer, 30329);
else
--DoAction handles rates, buffs, dealing damage
action.DoAction(caster, target, skill, actionContainer);

View file

@ -1,5 +1,5 @@
require("global");
require("weaponskill");
require("ability");
function onSkillPrepare(caster, target, skill)
return 0;

View file

@ -0,0 +1,42 @@
require("global");
require("modifiers");
properties = {
permissions = 0,
parameters = "s",
description =
[[
equips all your class and job actions
]],
}
classToActions = {
[2] = { Start = 27100, End = 27119},
[3] = { Start = 27140, End = 27159},
[4] = { Start = 27180, End = 27199},
[7] = { Start = 27220, End = 27239},
[8] = { Start = 27260, End = 27279},
[22] = { Start = 27300, End = 27319},
[23] = { Start = 27340, End = 27359}
}
function onTrigger(player, argc)
local messageId = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "equipactions";
classId = player.GetClass()
if classToActions[classId] then
s = classToActions[classId].Start
e = classToActions[classId].End
print('h')
for i = 0, 30 do
player.UnequipAbility(i, false)
end
for commandid = s, e do
if GetWorldManager():GetBattleCommand(commandid) then
player:EquipAbilityInFirstOpenSlot(player:GetCurrentClassOrJob(), commandid);
end
end
end
end

View file

@ -95,7 +95,6 @@ function onTrigger(player, argc, name, width, height, blockCount)
local sender = "spawnnpc";
if player and (modelIds[name] != nil) then
print("t")
local pos = player:GetPos();
local x = tonumber(pos[0]);
local y = tonumber(pos[1]);
@ -113,11 +112,12 @@ function onTrigger(player, argc, name, width, height, blockCount)
actor.ChangeNpcAppearance(modelIds[name]);
actor.SetMaxHP(5000);
actor.SetHP(5000);
actor.SetMod(modifiersGlobal.HasShield, 1);
actor.SetMod(modifiersGlobal.CanBlock, 1);
actor.SetMod(modifiersGlobal.AttackRange, 3);
actor.SetMod(modifiersGlobal.Speed, 5);
actor.SetMod(modifiersGlobal.MovementSpeed, 5);
actor.SetMobMod(mobModifiersGlobal.Roams, 1);
actor.SetMobMod(mobModifiersGlobal.RoamDelay, 3);
actor.SetMobMod(mobModifiersGlobal.RoamDelay, 10);
actor.charaWork.parameterSave.state_mainSkillLevel = 52;
actor.moveState = 3;
end;
end;

View file

@ -163,11 +163,12 @@ function onTrigger(player, argc, width, height, blockCount)
actor.ChangeNpcAppearance(2200905);
actor.SetMaxHP(5000);
actor.SetHP(5000);
actor.SetMod(modifiersGlobal.HasShield, 1);
actor.SetMod(modifiersGlobal.CanBlock, 1);
actor.SetMod(modifiersGlobal.AttackRange, 3);
actor.SetMod(modifiersGlobal.Speed, 5);
actor.SetMod(modifiersGlobal.MovementSpeed, 5);
actor.SetMobMod(mobModifiersGlobal.Roams, 1);
actor.SetMobMod(mobModifiersGlobal.RoamDelay, 3);
actor.SetMobMod(mobModifiersGlobal.RoamDelay, 10);
actor.charaWork.parameterSave.state_mainSkillLevel = 52;
actor.moveState = 3;
end
end

View file

@ -5,6 +5,7 @@ require("battleutils")
--There isn't really any information on this, but due to the fact it falls off BEFORE the target is hit,
--I'm assuming it increases a spell's accuracy modifier instead of giving actual magic accuracy
function onCommandStart(effect, owner, skill, actionContainer)
print('dark seal')
if skill.GetActionType() == ActionType.Magic then
--50 is random guess.
skill.accuracyModifier = skill.accuracyModifier + 50;

View file

@ -11,7 +11,7 @@ function onPreAction(effect, caster, target, skill, action, actionContainer)
action.hitRate = 0.0;
action.resistRate = 750;
--Remove status and add message
caster.statusEffects.RemoveStatusEffect(effect, actionContainer, 30331, false);
defender.statusEffects.RemoveStatusEffect(effect, actionContainer, 30331, false);
end
end;

View file

@ -10,7 +10,7 @@ function onPreAction(effect, caster, target, skill, action, actionContainer)
action.hitRate = 0.0;
action.resistRate = 400;
--Remove status and add message
caster.statusEffects.RemoveStatusEffect(effect, actionContainer, 30331, false);
defender.statusEffects.RemoveStatusEffect(effect, actionContainer, 30331, false);
end
end;

View file

@ -3,8 +3,8 @@ require("modifiers")
--Battle Voice grants HP_Boost and it sets max hp to 125% normal amount and heals for the difference between current
--This doesn't seem like the correct way to do this. If max HP changes between gainign and losing wont this break?
function onGain(owner, effect, actionContainer)
local newMaxHP = target.GetMaxHP() * 1.25;
local healAmount = newMaxHP - target.GetMaxHP();
local newMaxHP = owner.GetMaxHP() * 1.25;
local healAmount = newMaxHP - owner.GetMaxHP();
owner.SetMaxHP(newMaxHP);
owner.AddHP(healAmount);

View file

@ -11,5 +11,6 @@ function onCommandStart(effect, owner, skill, actionContainer)
end
skill.recastTimeMs = skill.recastTimeMs - (reduction * skill.recastTimeMs);
owner.statusEffects.RemoveStatusEffect(effect, actionContainer, 30331, false);
end
end;

View file

@ -2,7 +2,7 @@ require("modifiers")
require("battleutils")
--Forces crit of a single WS action from rear.
function onMagicCast(caster, effect, skill)
function onMagicCast(effect, caster, skill)
skill.mpCost = skill.mpCost / 2;
end;

View file

@ -4,7 +4,7 @@ require("battleutils")
--Increases range of a single spell, no clue by how much, 25% is a random guess
--It isn't clear if it has an effect on the aoe portion of skills or just the normal range, i've seen people on the OF say both.
--It also increased height of skills
function onMagicCast(caster, effect, skill)
function onMagicCast(effect, caster, skill)
skill.range = skill.range * 1.25;
skill.rangeHeight = skill.rangeHeight * 1.25;
end;

View file

@ -1,8 +1,18 @@
require("modifiers")
require("battleutils")
function onMagicCast(caster, effect, skill)
skill.aoeType = TargetFindAOEType.Circle;
skill.aoeRange = 15;
skill.validTarget = 31
end
--Cure, Cura, Regen, Esuna, Enhancing spells (Hardcoded as Stoneskin and Sanguine since we dont have a good way to check what's an enhancing spell)
supportedSpells = [27346, 27347, 27358, 27357, 27350, 27307]
function onMagicCast(effect, caster, skill)
if supportedSpells[skill.id] then
skill.aoeType = TargetFindAOEType.Circle;
skill.aoeRange = 15;
end
end
function onCommandFinish(effect, owner, skill, actionContainer)
if supportedSpells[skill.id] then
owner.statusEffects.RemoveStatusEffect(effect, actionContainer, 30331, false);
end
end;