-
Notifications
You must be signed in to change notification settings - Fork 0
/
mnk.lua
228 lines (188 loc) · 8.33 KB
/
mnk.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job. Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------
-- Initialization function for this job file.
function get_sets()
mote_include_version = 2
-- Load and initialize the include file.
include('Mote-Include.lua')
end
-- Setup vars that are user-independent. state.Buff vars initialized here will automatically be tracked.
function job_setup()
state.Buff.Footwork = buffactive.Footwork or false
state.Buff.Impetus = buffactive.Impetus or false
state.FootworkWS = M(false, 'Footwork on WS')
info.impetus_hit_count = 0
windower.raw_register_event('action', on_action_for_impetus)
end
-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job. Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
end
-- Define sets and vars used by this job file.
function init_gear_sets()
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
-- Don't gearswap for weaponskills when Defense is on.
if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
eventArgs.handled = true
end
end
-- Run after the general precast() is done.
function job_post_precast(spell, action, spellMap, eventArgs)
if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
if state.Buff.Impetus and (spell.english == "Ascetic's Fury" or spell.english == "Victory Smite") then
-- Need 6 hits at capped dDex, or 9 hits if dDex is uncapped, for Tantra to tie or win.
if (state.OffenseMode.current == 'Fodder' and info.impetus_hit_count > 5) or (info.impetus_hit_count > 8) then
equip(sets.impetus_body)
end
elseif state.Buff.Footwork and (spell.english == "Dragon's Kick" or spell.english == "Tornado Kick") then
equip(sets.footwork_kick_feet)
end
-- Replace Moonshade Earring if we're at cap TP
if player.tp == 3000 then
equip(sets.precast.MaxTP)
end
end
end
function job_aftercast(spell, action, spellMap, eventArgs)
if spell.type == 'WeaponSkill' and not spell.interrupted and state.FootworkWS and state.Buff.Footwork then
send_command('cancel Footwork')
end
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------
-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
-- Set Footwork as combat form any time it's active and Hundred Fists is not.
if buff == 'Footwork' and gain and not buffactive['hundred fists'] then
state.CombatForm:set('Footwork')
elseif buff == "Hundred Fists" and not gain and buffactive.footwork then
state.CombatForm:set('Footwork')
else
state.CombatForm:reset()
end
-- Hundred Fists and Impetus modify the custom melee groups
if buff == "Hundred Fists" or buff == "Impetus" then
classes.CustomMeleeGroups:clear()
if (buff == "Hundred Fists" and gain) or buffactive['hundred fists'] then
classes.CustomMeleeGroups:append('HF')
end
if (buff == "Impetus" and gain) or buffactive.impetus then
classes.CustomMeleeGroups:append('Impetus')
end
end
-- Update gear if any of the above changed
if buff == "Hundred Fists" or buff == "Impetus" or buff == "Footwork" then
handle_equipping_gear(player.status)
end
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
function customize_idle_set(idleSet)
if player.hpp < 75 then
idleSet = set_combine(idleSet, sets.ExtraRegen)
end
return idleSet
end
-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
update_combat_form()
update_melee_groups()
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
function update_combat_form()
if buffactive.footwork and not buffactive['hundred fists'] then
state.CombatForm:set('Footwork')
else
state.CombatForm:reset()
end
end
function update_melee_groups()
classes.CustomMeleeGroups:clear()
if buffactive['hundred fists'] then
classes.CustomMeleeGroups:append('HF')
end
if buffactive.impetus then
classes.CustomMeleeGroups:append('Impetus')
end
end
-------------------------------------------------------------------------------------------------------------------
-- Custom event hooks.
-------------------------------------------------------------------------------------------------------------------
-- Keep track of the current hit count while Impetus is up.
function on_action_for_impetus(action)
if state.Buff.Impetus then
-- count melee hits by player
if action.actor_id == player.id then
if action.category == 1 then
for _,target in pairs(action.targets) do
for _,action in pairs(target.actions) do
-- Reactions (bitset):
-- 1 = evade
-- 2 = parry
-- 4 = block/guard
-- 8 = hit
-- 16 = JA/weaponskill?
-- If action.reaction has bits 1 or 2 set, it missed or was parried. Reset count.
if (action.reaction % 4) > 0 then
info.impetus_hit_count = 0
else
info.impetus_hit_count = info.impetus_hit_count + 1
end
end
end
elseif action.category == 3 then
-- Missed weaponskill hits will reset the counter. Can we tell?
-- Reaction always seems to be 24 (what does this value mean? 8=hit, 16=?)
-- Can't tell if any hits were missed, so have to assume all hit.
-- Increment by the minimum number of weaponskill hits: 2.
for _,target in pairs(action.targets) do
for _,action in pairs(target.actions) do
-- This will only be if the entire weaponskill missed or was parried.
if (action.reaction % 4) > 0 then
info.impetus_hit_count = 0
else
info.impetus_hit_count = info.impetus_hit_count + 2
end
end
end
end
elseif action.actor_id ~= player.id and action.category == 1 then
-- If mob hits the player, check for counters.
for _,target in pairs(action.targets) do
if target.id == player.id then
for _,action in pairs(target.actions) do
-- Spike effect animation:
-- 63 = counter
-- ?? = missed counter
if action.has_spike_effect then
-- spike_effect_message of 592 == missed counter
if action.spike_effect_message == 592 then
info.impetus_hit_count = 0
elseif action.spike_effect_animation == 63 then
info.impetus_hit_count = info.impetus_hit_count + 1
end
end
end
end
end
end
--add_to_chat(123,'Current Impetus hit count = ' .. tostring(info.impetus_hit_count))
else
info.impetus_hit_count = 0
end
end