Added party to Gridania opening, fixed BattleActionx18 and made it so x18 is used for packets with more than 10 targets. Changed how death works. Added respawn time and roam modifiers. Added TryAggro functions and moved aggroing out of roaming and helpplayers. Fixed high cpu usage in zone's OnUpdate function. Fixed work value in player update

This commit is contained in:
yogurt 2017-12-08 00:58:39 -06:00
parent 520ae7a119
commit 1275c8b5da
61 changed files with 1226 additions and 223 deletions

View file

@ -34,9 +34,10 @@ function allyGlobal.onDespawn(ally)
end
--tryAggro serves the same purpose for now, keeping this around just in case
function allyGlobal.HelpPlayers(ally, contentGroupCharas, pickRandomTarget)
if contentGroupCharas then
for _, chara in pairs(contentGroupCharas) do
if contentGroupCharas and not ally.IsEngaged() then
for chara in contentGroupCharas do
if chara then
-- probably a player, or another ally
-- todo: queue support actions, heal, try pull hate off player etc
@ -44,12 +45,14 @@ function allyGlobal.HelpPlayers(ally, contentGroupCharas, pickRandomTarget)
-- do stuff
if not ally.IsEngaged() then
if chara.IsEngaged() then
allyGlobal.EngageTarget(ally, chara.target, nil)
allyGlobal.EngageTarget(ally, chara.target, nil);
break;
end
end
end
elseif chara.IsMonster() and chara.IsEngaged() then
if not ally.IsEngaged() then
allyGlobal.EngageTarget(ally, chara.target, nil)
allyGlobal.EngageTarget(ally, chara, nil);
break;
end
end
end
@ -57,6 +60,36 @@ function allyGlobal.HelpPlayers(ally, contentGroupCharas, pickRandomTarget)
end
end
--Iterate over characters in contentGroup, if a player is in combat, assist them.
function allyGlobal.tryAggro(ally, contentGroupCharas)
local count = 0;
if contentGroupCharas and not ally.IsEngaged() then
for i = 0, #contentGroupCharas - 1 do
if contentGroupCharas[i] and ally then
if contentGroupCharas[i].IsPlayer() then
-- probably a player, or another ally
-- todo: queue support actions, heal, try pull hate off player etc
if contentGroupCharas[i].target then
if ally.aiContainer:GetTargetFind():CanTarget(contentGroupCharas[i].target) and contentGroupCharas[i].target.IsMonster() and contentGroupCharas[i].target.hateContainer:HasHateForTarget(contentGroupCharas[i]) then
-- do stuff
allyGlobal.EngageTarget(ally, contentGroupCharas[i].target, nil);
break;
end
end
--[[
elseif contentGroupCharas[i].IsMonster() and contentGroupCharas[i].IsEngaged() then
if not ally.IsEngaged() then
print("Engaging monster that is engaged");
allyGlobal.EngageTarget(ally, contentGroupCharas[i], nil);
break;
end]]
end
end
end
end
end
function allyGlobal.HealPlayer(ally, player)
end
@ -67,14 +100,16 @@ end
function allyGlobal.EngageTarget(ally, target, contentGroupCharas)
if contentGroupCharas then
for _, chara in pairs(contentGroupCharas) do
for chara in contentGroupCharas do
if chara.IsMonster() then
if chara.allegiance ~= ally.allegiance then
ally.Engage(chara)
break;
end
end
end
elseif target then
ally.Engage(target)
ally.hateContainer.AddBaseHate(target);
end
end