forked from Outpost-System/Outpost
/
pvp.lua
151 lines (125 loc) · 3.37 KB
/
pvp.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
local pvp = {}
-- Outpost Combat Functionality.
function pvp.setTarget(target_array)
op.targets = target_array
op.target = target_array[1]:title()
e:echo("Targeting: " .. op.target)
if op.target ~= "Nothing" then
send("reject " .. op.target)
send("unally " .. op.target)
send("enemy " .. op.target)
end
if ndb.isenemy(op.target) or op.arena_target then
if GMCP.HasSkill("leprechaun") then
op.balqueue:add("order entourage kill "..op.target)
op.balqueue:add("order "..op.fae.leprechaun.." follow "..op.target)
op.balqueue:add("order "..op.beast.id.." passive") -- Need to find a better way to do this. We do store fae rep numbers but pacifying them individually is spammy.
qm.Check()
else
-- Handle other skillset preliminaries here
end
else
if GMCP.HasSkill("leprechaun") then
op.balqueue:add("faecall")
op.balqueue:add("order entourage passive")
qm.Check()
end
end
if op.mark_target then killTrigger(op.mark_target) end
op.mark_target = tempTrigger(op.target, [[selectString("]] .. op.target .. [[", 1) bg("firebrick") fg("white") resetFormat()]])
if op.leadermode then
op.to_channel("Target: " .. op.target)
op.to_channel("Target: " .. op.target)
op.to_channel("Target: " .. op.target)
else
if op.announce_target then
op.to_channel("Targeting prios set. Next target: " .. op.target)
end
end
end
function pvp.succumb()
if bals.has() then
send("moondance succumb "..op.target)
else
e:warn("Hang on. Waiting on balance!")
end
end
function pvp.bluemoon()
if bals.has() then
if gmcp.Char.Status.fullname == "Moontouched Quixote" then -- Need to find a way to check for the existence of this ability. Have a few ideas, but thoughts?
send("beast order breathe scrambledwave "..op.target) -- It does not show on BEAST INFO. Parse POWERS LIST, maybe?
end
send("moondance bluemoon "..op.target)
else
e:warn("Hang on. Waiting on balance!")
end
end
function pvp.waning()
if bals.has() then
send("moondance waning "..op.target)
else
e:warn("Hang on. Waiting on balance!")
end
end
function pvp.pookaStatus()
return op.pooka_balance and "<firebrick> *[<thistle>POOKA<firebrick>]*" or ""
end
-- Hexes Control :)
function pvp.pushHeap(h, k, v)
assert(v ~= nil, "cannot push nil")
local t = h.nodes
local h = h.heap
local n = #h + 1
local p = (n - n % 2) / 2
h[n] = k
t[k] = v
while n > 1 and t[h[p]] > v do
h[p], h[n] = h[n], h[p]
n = p
p = (n - n % 2) / 2
end
end
function pvp.peekHeap(h)
local t = h.nodes
local h = h.heap
local s = #h
assert(s > 0, "cannot pop from empty heap")
local e = h[1]
local r = t[e]
return e, r
end
function pvp.popHeap(h)
local t = h.nodes
local h = h.heap
local s = #h
assert(s > 0, "cannot pop from empty heap")
local e = h[1]
local r = t[e]
local v = t[h[s]]
h[1] = h[s]
h[s] = nil
t[e] = nil
s = s - 1
local n = 1
local p = 2 * n
if s > p and t[h[p]] > t[h[p + 1]] then
p = 2 * n + 1
end
while s >= p and t[h[p]] < v do
h[p], h[n] = h[n], h[p]
n = p
p = 2 * n
if s > p and t[h[p]] > t[h[p + 1]] then
p = 2 * n + 1
end
end
return e, r
end
local function isempty (h) return h.heap[1] == nil end
function pvp.hexesHeap()
return setmetatable({heap = {}, nodes = {}},
{__index = {push=push, peek=peek, pop=pop, isempty=isempty}})
end
function pvp.chooseNextAttack(target, hp, mp, ego, action)
end
return pvp