Advertisement
Guest User

MNK.lua

a guest
Sep 15th, 2014
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.52 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job. Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- Initialization function for this job file.
  6. function get_sets()
  7. mote_include_version = 2
  8.  
  9. -- Load and initialize the include file.
  10. include('Mote-Include.lua')
  11. end
  12.  
  13.  
  14. -- Setup vars that are user-independent. state.Buff vars initialized here will automatically be tracked.
  15. function job_setup()
  16. state.Buff.Footwork = buffactive.Footwork or false
  17. state.Buff.Impetus = buffactive.Impetus or false
  18.  
  19. state.FootworkWS = M(false, 'Footwork on WS')
  20.  
  21. info.impetus_hit_count = 0
  22. windower.raw_register_event('action', on_action_for_impetus)
  23. end
  24.  
  25.  
  26. -------------------------------------------------------------------------------------------------------------------
  27. -- User setup functions for this job. Recommend that these be overridden in a sidecar file.
  28. -------------------------------------------------------------------------------------------------------------------
  29.  
  30. -- Setup vars that are user-dependent. Can override this function in a sidecar file.
  31. function user_setup()
  32. state.OffenseMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
  33. state.WeaponskillMode:options('Normal', 'SomeAcc', 'Acc', 'Fodder')
  34. state.HybridMode:options('Normal', 'PDT', 'Counter')
  35. state.PhysicalDefenseMode:options('PDT', 'HP')
  36.  
  37. update_combat_form()
  38. update_melee_groups()
  39.  
  40. select_default_macro_book()
  41. end
  42.  
  43.  
  44. -- Define sets and vars used by this job file.
  45. function init_gear_sets()
  46. --------------------------------------
  47. -- Start defining the sets
  48. --------------------------------------
  49.  
  50. -- Precast Sets
  51.  
  52. -- Precast sets to enhance JAs on use
  53. sets.precast.JA['Hundred Fists'] = {legs="Melee Hose +2"}
  54. sets.precast.JA['Boost'] = {hands="Anchorite's Gloves"}
  55. sets.precast.JA['Dodge'] = {feet="Anchorite's Gaiters"}
  56. sets.precast.JA['Focus'] = {head="Anchorite's Crown"}
  57. sets.precast.JA['Counterstance'] = {feet="Melee Gaiters +2"}
  58. sets.precast.JA['Footwork'] = {feet="Tantra Gaiters +2"}
  59. --sets.precast.JA['Formless Strikes'] = {body="Hesychast's Cyclas"}
  60. --sets.precast.JA['Mantra'] = {feet="Hesychast's Gaiters +1"}
  61.  
  62. --sets.precast.JA['Chi Blast'] = {
  63. -- head="Melee Crown +2",
  64. -- body="Otronif Harness +1",hands="Hesychast's Gloves +1",
  65. -- back="Tuilha Cape",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  66.  
  67. sets.precast.JA['Chakra'] = {ammo="Tantra Tathlum",
  68. body="Anchorite's Cyclas",hands="Melee Gloves +2"}
  69.  
  70. -- Waltz set (chr and vit)
  71. --sets.precast.Waltz = {ammo="Sonia's Plectrum",
  72. -- head="Felistris Mask",
  73. -- body="Otronif Harness +1",hands="Hesychast's Gloves +1",ring1="Spiral Ring",
  74. -- back="Iximulew Cape",waist="Caudata Belt",legs="Qaaxo Tights",feet="Otronif Boots +1"}
  75.  
  76. -- Don't need any special gear for Healing Waltz.
  77. --sets.precast.Waltz['Healing Waltz'] = {}
  78.  
  79. --sets.precast.Step = {waist="Chaac Belt"}
  80. --sets.precast.Flourish1 = {waist="Chaac Belt"}
  81.  
  82.  
  83. -- Fast cast sets for spells
  84.  
  85. sets.precast.FC = {ear2="Loquacious Earring"}
  86.  
  87. --sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Beads"})
  88.  
  89.  
  90. -- Weaponskill sets
  91. -- Default set for any weaponskill that isn't any more specifically defined
  92. sets.precast.WS = {ammo="Potestas Bomblet",
  93. head="Espial Cap",neck=gear.ElementalGorget,ear1="Brutal Earring",ear2="Kemas Earring",
  94. body="Hachiryu Haramaki",hands="Espial Bracers",ring1="Epona's Ring",ring2="Rajas Ring",
  95. back="Atheling Mantle",waist="Anguinus Belt",legs="Espial Hose",feet="Espial Socks"}
  96. --sets.precast.WSAcc = {ammo="Honed Tathlum",body="Manibozho Jerkin",back="Letalis Mantle",feet="Qaaxo Leggings"}
  97. --sets.precast.WSMod = {ammo="Tantra Tathlum",head="Felistris Mask",legs="Hesychast's Hose +1",feet="Daihanshi Habaki"}
  98. --sets.precast.MaxTP = {ear1="Bladeborn Earring",ear2="Steelflash Earring"}
  99. --sets.precast.WS.Acc = set_combine(sets.precast.WS, sets.precast.WSAcc)
  100. --sets.precast.WS.Mod = set_combine(sets.precast.WS, sets.precast.WSMod)
  101.  
  102. -- Specific weaponskill sets.
  103.  
  104. -- legs={name="Quiahuiz Trousers", augments={'Phys. dmg. taken -2%','Magic dmg. taken -2%','STR+8'}}}
  105.  
  106. sets.precast.WS['Raging Fists'] = set_combine(sets.precast.WS, {})
  107. --sets.precast.WS['Howling Fist'] = set_combine(sets.precast.WS, {legs="Manibozho Brais",feet="Daihanshi Habaki"})
  108. --sets.precast.WS['Asuran Fists'] = set_combine(sets.precast.WS, {
  109. -- ear1="Bladeborn Earring",ear2="Moonshade Earring",ring2="Spiral Ring",back="Buquwik Cape"})
  110. sets.precast.WS["Ascetic's Fury"] = set_combine(sets.precast.WS, {
  111. ammo="Tantra Tathlum",legs="Byakko's Haidate"})
  112. --sets.precast.WS["Victory Smite"] = set_combine(sets.precast.WS, {neck="Rancor Collar",back="Buquwik Cape",feet="Qaaxo Leggings"})
  113. sets.precast.WS['Shijin Spiral'] = set_combine(sets.precast.WS, {legs="Byakko's Haidate"})
  114. --sets.precast.WS['Dragon Kick'] = set_combine(sets.precast.WS, {feet="Daihanshi Habaki"})
  115. --sets.precast.WS['Tornado Kick'] = set_combine(sets.precast.WS, {ammo="Tantra Tathlum",ring1="Spiral Ring"})
  116. --sets.precast.WS['Spinning Attack'] = set_combine(sets.precast.WS, {
  117. -- head="Felistris Mask",ear1="Bladeborn Earring",ear2="Steelflash Earring"})
  118.  
  119. --[[sets.precast.WS["Raging Fists"].Acc = set_combine(sets.precast.WS["Raging Fists"], sets.precast.WSAcc)
  120. sets.precast.WS["Howling Fist"].Acc = set_combine(sets.precast.WS["Howling Fist"], sets.precast.WSAcc)
  121. sets.precast.WS["Asuran Fists"].Acc = set_combine(sets.precast.WS["Asuran Fists"], sets.precast.WSAcc)
  122. sets.precast.WS["Ascetic's Fury"].Acc = set_combine(sets.precast.WS["Ascetic's Fury"], sets.precast.WSAcc)
  123. sets.precast.WS["Victory Smite"].Acc = set_combine(sets.precast.WS["Victory Smite"], sets.precast.WSAcc)
  124. sets.precast.WS["Shijin Spiral"].Acc = set_combine(sets.precast.WS["Shijin Spiral"], sets.precast.WSAcc)
  125. sets.precast.WS["Dragon Kick"].Acc = set_combine(sets.precast.WS["Dragon Kick"], sets.precast.WSAcc)
  126. sets.precast.WS["Tornado Kick"].Acc = set_combine(sets.precast.WS["Tornado Kick"], sets.precast.WSAcc)
  127.  
  128. sets.precast.WS["Raging Fists"].Mod = set_combine(sets.precast.WS["Raging Fists"], sets.precast.WSMod)
  129. sets.precast.WS["Howling Fist"].Mod = set_combine(sets.precast.WS["Howling Fist"], sets.precast.WSMod)
  130. sets.precast.WS["Asuran Fists"].Mod = set_combine(sets.precast.WS["Asuran Fists"], sets.precast.WSMod)
  131. sets.precast.WS["Ascetic's Fury"].Mod = set_combine(sets.precast.WS["Ascetic's Fury"], sets.precast.WSMod)
  132. sets.precast.WS["Victory Smite"].Mod = set_combine(sets.precast.WS["Victory Smite"], sets.precast.WSMod)
  133. sets.precast.WS["Shijin Spiral"].Mod = set_combine(sets.precast.WS["Shijin Spiral"], sets.precast.WSMod)
  134. sets.precast.WS["Dragon Kick"].Mod = set_combine(sets.precast.WS["Dragon Kick"], sets.precast.WSMod)
  135. sets.precast.WS["Tornado Kick"].Mod = set_combine(sets.precast.WS["Tornado Kick"], sets.precast.WSMod)
  136.  
  137.  
  138. sets.precast.WS['Cataclysm'] = {
  139. head="Wayfarer Circlet",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
  140. body="Wayfarer Robe",hands="Otronif Gloves",ring1="Acumen Ring",ring2="Demon's Ring",
  141. back="Toro Cape",waist="Thunder Belt",legs="Nahtirah Trousers",feet="Qaaxo Leggings"}
  142.  
  143.  
  144. -- Midcast Sets
  145. sets.midcast.FastRecast = {
  146. head="Whirlpool Mask",ear2="Loquacious Earring",
  147. body="Otronif Harness +1",hands="Thaumas Gloves",
  148. waist="Black Belt",feet="Otronif Boots +1"}
  149.  
  150. -- Specific spells
  151. sets.midcast.Utsusemi = {
  152. head="Whirlpool Mask",ear2="Loquacious Earring",
  153. body="Otronif Harness +1",hands="Thaumas Gloves",
  154. waist="Black Belt",legs="Qaaxo Tights",feet="Otronif Boots +1"}]]--
  155.  
  156.  
  157. -- Sets to return to when not performing an action.
  158.  
  159. -- Resting sets
  160. sets.resting = {head="Ocelomeh Headpiece +1",neck="Wiglen Gorget",
  161. body="Hesychast's Cyclas",ring1="Sheltered Ring",ring2="Paguroidea Ring"}
  162.  
  163.  
  164. -- Idle sets
  165. sets.idle = {neck="Orochi Nodowa",body="Melee Cyclas"}
  166.  
  167. sets.idle.Town = {ammo="Potestas Bomblet",
  168. head="Espial Cap",neck="Orochi Nodowa",ear1="Brutal Earring",ear2="Ethereal Earring",
  169. body="Melee Cyclas",hands="Espial Bracers",ring1="Epona's Ring",ring2="Rajas Ring",
  170. back="Atheling Mantle",waist="Black Belt",legs="Espial Hose",feet="Espial Socks"}
  171.  
  172. --[[sets.idle.Weak = {ammo="Potestas Bomblet",
  173. head="Felistris Mask",neck="Wiglen Gorget",ear1="Brutal Earring",ear2="Bloodgem Earring",
  174. body="Hesychast's Cyclas",hands="Hesychast's Gloves +1",ring1="Sheltered Ring",ring2="Meridian Ring",
  175. back="Iximulew Cape",waist="Black Belt",legs="Qaaxo Tights",feet="Herald's Gaiters"}]]--
  176.  
  177. -- Defense sets
  178. sets.defense.PDT = {ammo="Potestas Bomblet",
  179. head="Arhat's Jinpachi",neck="Twilight Torque",
  180. body="Arhat's Gi",hands="Melaco mittens",ring1="Jelly Ring",waist="Black Belt"}
  181.  
  182. --[[sets.defense.HP = {ammo="Iron Gobbet",
  183. head="Uk'uxkaj Cap",neck="Lavalier +1",ear1="Brutal Earring",ear2="Bloodgem Earring",
  184. body="Hesychast's Cyclas",hands="Hesychast's Gloves +1",ring1="K'ayres Ring",ring2="Meridian Ring",
  185. back="Shadow Mantle",waist="Black Belt",legs="Hesychast's Hose +1",feet="Hesychast's Gaiters +1"}]]--
  186.  
  187. sets.defense.MDT = {neck="Twilight Torque"}
  188.  
  189. --sets.Kiting = {feet="Herald's Gaiters"}
  190.  
  191. --sets.ExtraRegen = {head="Ocelomeh Headpiece +1"}
  192.  
  193. -- Engaged sets
  194.  
  195. -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
  196. -- sets if more refined versions aren't defined.
  197. -- If you create a set with both offense and defense modes, the offense mode should be first.
  198. -- EG: sets.engaged.Dagger.Accuracy.Evasion
  199.  
  200. -- Normal melee sets
  201. sets.engaged = {ammo="Jukukik Feather",
  202. head="Espial Cap",neck="Dakatsu-no-nodowa",ear1="Brutal Earring",ear2="Ethereal Earring",
  203. body="Espial Gambison",hands="Espial Bracers",ring1="Rajas Ring",ring2="Cho'j Band",
  204. back="Atheling Mantle",waist="Brown Belt",legs="Espial Hose",feet="Espial Socks"}
  205. --[[sets.engaged.SomeAcc = {ammo="Honed Tathlum",
  206. head="Whirlpool Mask",neck="Ej Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  207. body="Qaaxo Harness",hands="Hesychast's Gloves +1",ring1="Rajas Ring",ring2="Epona's Ring",
  208. back="Atheling Mantle",waist="Anguinus Belt",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  209. sets.engaged.Acc = {ammo="Honed Tathlum",
  210. head="Whirlpool Mask",neck="Ej Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  211. body="Otronif Harness +1",hands="Hesychast's Gloves +1",ring1="Patricius Ring",ring2="Epona's Ring",
  212. back="Letalis Mantle",waist="Anguinus Belt",legs="Manibozho Brais",feet="Qaaxo Leggings"}
  213. sets.engaged.Mod = {ammo="Thew Bomblet",
  214. head="Felistris Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  215. body="Qaaxo Harness",hands="Anchorite's Gloves +1",ring1="Rajas Ring",ring2="Epona's Ring",
  216. back="Atheling Mantle",waist="Windbuffet Belt",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  217.  
  218. -- Defensive melee hybrid sets
  219. sets.engaged.PDT = {ammo="Thew Bomblet",
  220. head="Uk'uxkaj Cap",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  221. body="Otronif Harness +1",hands="Otronif Gloves",ring1="Patricius Ring",ring2="Epona's Ring",
  222. back="Iximulew Cape",waist="Windbuffet Belt",legs="Hesychast's Hose +1",feet="Otronif Boots +1"}
  223. sets.engaged.SomeAcc.PDT = {ammo="Honed Tathlum",
  224. head="Whirlpool Mask",neck="Ej Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  225. body="Qaaxo Harness",hands="Hesychast's Gloves +1",ring1="Patricius Ring",ring2="Epona's Ring",
  226. back="Atheling Mantle",waist="Anguinus Belt",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  227. sets.engaged.Acc.PDT = {ammo="Honed Tathlum",
  228. head="Whirlpool Mask",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  229. body="Otronif Harness +1",hands="Otronif Gloves",ring1="Patricius Ring",ring2="Epona's Ring",
  230. back="Letalis Mantle",waist="Anguinus Belt",legs="Qaaxo Tights",feet="Qaaxo Leggings"}
  231. sets.engaged.Counter = {ammo="Thew Bomblet",
  232. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  233. body="Otronif Harness +1",hands="Otronif Gloves",ring1="K'ayres Ring",ring2="Epona's Ring",
  234. back="Atheling Mantle",waist="Windbuffet Belt",legs="Anchorite's Hose",feet="Otronif Boots +1"}
  235. sets.engaged.Acc.Counter = {ammo="Honed Tathlum",
  236. head="Whirlpool Mask",neck="Ej Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  237. body="Otronif Harness +1",hands="Hesychast's Gloves +1",ring1="Patricius Ring",ring2="Epona's Ring",
  238. back="Letalis Mantle",waist="Anguinus Belt",legs="Anchorite's Hose",feet="Otronif Boots +1"}]]--
  239.  
  240.  
  241. -- Hundred Fists/Impetus melee set mods
  242. sets.engaged.HF = set_combine(sets.engaged)
  243. sets.engaged.HF.Impetus = set_combine(sets.engaged, {body="Tantra Cyclas +2"})
  244. --sets.engaged.Acc.HF = set_combine(sets.engaged.Acc)
  245. --sets.engaged.Acc.HF.Impetus = set_combine(sets.engaged.Acc, {body="Tantra Cyclas +2"})
  246. --sets.engaged.Counter.HF = set_combine(sets.engaged.Counter)
  247. --sets.engaged.Counter.HF.Impetus = set_combine(sets.engaged.Counter, {body="Tantra Cyclas +2"})
  248. --sets.engaged.Acc.Counter.HF = set_combine(sets.engaged.Acc.Counter)
  249. -- sets.engaged.Acc.Counter.HF.Impetus = set_combine(sets.engaged.Acc.Counter, {body="Tantra Cyclas +2"})
  250.  
  251.  
  252. -- Footwork combat form
  253. sets.engaged.Footwork = {ammo="Thew Bomblet",
  254. head="Felistris Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  255. body="Qaaxo Harness",hands="Hesychast's Gloves +1",ring1="Rajas Ring",ring2="Epona's Ring",
  256. back="Atheling Mantle",waist="Windbuffet Belt",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  257. sets.engaged.Footwork.Acc = {ammo="Honed Tathlum",
  258. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  259. body="Otronif Harness +1",hands="Hesychast's Gloves +1",ring1="Rajas Ring",ring2="Epona's Ring",
  260. back="Letalis Mantle",waist="Anguinus Belt",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  261.  
  262. -- Quick sets for post-precast adjustments, listed here so that the gear can be Validated.
  263. sets.impetus_body = {body="Tantra Cyclas +2"}
  264. sets.footwork_kick_feet = {feet="Anchorite's Gaiters +1"}
  265. end
  266.  
  267. -------------------------------------------------------------------------------------------------------------------
  268. -- Job-specific hooks for standard casting events.
  269. -------------------------------------------------------------------------------------------------------------------
  270.  
  271. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  272. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  273. function job_precast(spell, action, spellMap, eventArgs)
  274. -- Don't gearswap for weaponskills when Defense is on.
  275. if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
  276. eventArgs.handled = true
  277. end
  278. end
  279.  
  280. -- Run after the general precast() is done.
  281. function job_post_precast(spell, action, spellMap, eventArgs)
  282. if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
  283. if state.Buff.Impetus and (spell.english == "Ascetic's Fury" or spell.english == "Victory Smite") then
  284. -- Need 6 hits at capped dDex, or 9 hits if dDex is uncapped, for Tantra to tie or win.
  285. if (state.OffenseMode.current == 'Fodder' and info.impetus_hit_count > 5) or (info.impetus_hit_count > 8) then
  286. equip(sets.impetus_body)
  287. end
  288. elseif state.Buff.Footwork and (spell.english == "Dragon's Kick" or spell.english == "Tornado Kick") then
  289. equip(sets.footwork_kick_feet)
  290. end
  291.  
  292. -- Replace Moonshade Earring if we're at cap TP
  293. if player.tp == 3000 then
  294. equip(sets.precast.MaxTP)
  295. end
  296. end
  297. end
  298.  
  299. function job_aftercast(spell, action, spellMap, eventArgs)
  300. if spell.type == 'WeaponSkill' and not spell.interrupted and state.FootworkWS and state.Buff.Footwork then
  301. send_command('cancel Footwork')
  302. end
  303. end
  304.  
  305. -------------------------------------------------------------------------------------------------------------------
  306. -- Job-specific hooks for non-casting events.
  307. -------------------------------------------------------------------------------------------------------------------
  308.  
  309. -- Called when a player gains or loses a buff.
  310. -- buff == buff gained or lost
  311. -- gain == true if the buff was gained, false if it was lost.
  312. function job_buff_change(buff, gain)
  313. -- Set Footwork as combat form any time it's active and Hundred Fists is not.
  314. if buff == 'Footwork' and gain and not buffactive['hundred fists'] then
  315. state.CombatForm:set('Footwork')
  316. elseif buff == "Hundred Fists" and not gain and buffactive.footwork then
  317. state.CombatForm:set('Footwork')
  318. else
  319. state.CombatForm:reset()
  320. end
  321.  
  322. -- Hundred Fists and Impetus modify the custom melee groups
  323. if buff == "Hundred Fists" or buff == "Impetus" then
  324. classes.CustomMeleeGroups:clear()
  325.  
  326. if (buff == "Hundred Fists" and gain) or buffactive['hundred fists'] then
  327. classes.CustomMeleeGroups:append('HF')
  328. end
  329.  
  330. if (buff == "Impetus" and gain) or buffactive.impetus then
  331. classes.CustomMeleeGroups:append('Impetus')
  332. end
  333. end
  334.  
  335. -- Update gear if any of the above changed
  336. if buff == "Hundred Fists" or buff == "Impetus" or buff == "Footwork" then
  337. handle_equipping_gear(player.status)
  338. end
  339. end
  340.  
  341.  
  342. -------------------------------------------------------------------------------------------------------------------
  343. -- User code that supplements standard library decisions.
  344. -------------------------------------------------------------------------------------------------------------------
  345.  
  346. function customize_idle_set(idleSet)
  347. if player.hpp < 75 then
  348. idleSet = set_combine(idleSet, sets.ExtraRegen)
  349. end
  350.  
  351. return idleSet
  352. end
  353.  
  354. -- Called by the 'update' self-command.
  355. function job_update(cmdParams, eventArgs)
  356. update_combat_form()
  357. update_melee_groups()
  358. end
  359.  
  360.  
  361. -------------------------------------------------------------------------------------------------------------------
  362. -- Utility functions specific to this job.
  363. -------------------------------------------------------------------------------------------------------------------
  364.  
  365. function update_combat_form()
  366. if buffactive.footwork and not buffactive['hundred fists'] then
  367. state.CombatForm:set('Footwork')
  368. else
  369. state.CombatForm:reset()
  370. end
  371. end
  372.  
  373. function update_melee_groups()
  374. classes.CustomMeleeGroups:clear()
  375.  
  376. if buffactive['hundred fists'] then
  377. classes.CustomMeleeGroups:append('HF')
  378. end
  379.  
  380. if buffactive.impetus then
  381. classes.CustomMeleeGroups:append('Impetus')
  382. end
  383. end
  384.  
  385.  
  386. -- Select default macro book on initial load or subjob change.
  387. function select_default_macro_book()
  388. -- Default macro set/book
  389. if player.sub_job == 'DNC' then
  390. set_macro_page(8, 1)
  391. elseif player.sub_job == 'NIN' then
  392. set_macro_page(2, 1)
  393. elseif player.sub_job == 'THF' then
  394. set_macro_page(4, 1)
  395. elseif player.sub_job == 'RUN' then
  396. set_macro_page(1, 1)
  397. else
  398. set_macro_page(3, 1)
  399. end
  400. end
  401.  
  402.  
  403. -------------------------------------------------------------------------------------------------------------------
  404. -- Custom event hooks.
  405. -------------------------------------------------------------------------------------------------------------------
  406.  
  407. -- Keep track of the current hit count while Impetus is up.
  408. function on_action_for_impetus(action)
  409. if state.Buff.Impetus then
  410. -- count melee hits by player
  411. if action.actor_id == player.id then
  412. if action.category == 1 then
  413. for _,target in pairs(action.targets) do
  414. for _,action in pairs(target.actions) do
  415. -- Reactions (bitset):
  416. -- 1 = evade
  417. -- 2 = parry
  418. -- 4 = block/guard
  419. -- 8 = hit
  420. -- 16 = JA/weaponskill?
  421. -- If action.reaction has bits 1 or 2 set, it missed or was parried. Reset count.
  422. if (action.reaction % 4) > 0 then
  423. info.impetus_hit_count = 0
  424. else
  425. info.impetus_hit_count = info.impetus_hit_count + 1
  426. end
  427. end
  428. end
  429. elseif action.category == 3 then
  430. -- Missed weaponskill hits will reset the counter. Can we tell?
  431. -- Reaction always seems to be 24 (what does this value mean? 8=hit, 16=?)
  432. -- Can't tell if any hits were missed, so have to assume all hit.
  433. -- Increment by the minimum number of weaponskill hits: 2.
  434. for _,target in pairs(action.targets) do
  435. for _,action in pairs(target.actions) do
  436. -- This will only be if the entire weaponskill missed or was parried.
  437. if (action.reaction % 4) > 0 then
  438. info.impetus_hit_count = 0
  439. else
  440. info.impetus_hit_count = info.impetus_hit_count + 2
  441. end
  442. end
  443. end
  444. end
  445. elseif action.actor_id ~= player.id and action.category == 1 then
  446. -- If mob hits the player, check for counters.
  447. for _,target in pairs(action.targets) do
  448. if target.id == player.id then
  449. for _,action in pairs(target.actions) do
  450. -- Spike effect animation:
  451. -- 63 = counter
  452. -- ?? = missed counter
  453. if action.has_spike_effect then
  454. -- spike_effect_message of 592 == missed counter
  455. if action.spike_effect_message == 592 then
  456. info.impetus_hit_count = 0
  457. elseif action.spike_effect_animation == 63 then
  458. info.impetus_hit_count = info.impetus_hit_count + 1
  459. end
  460. end
  461. end
  462. end
  463. end
  464. end
  465.  
  466. --add_to_chat(123,'Current Impetus hit count = ' .. tostring(info.impetus_hit_count))
  467. else
  468. info.impetus_hit_count = 0
  469. end
  470.  
  471. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement