Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.83 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', 'Acc', 'PDT')
  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="Hesychast's Hose +1"}
  54. sets.precast.JA['Boost'] = {hands="Anchorite's Gloves +1"}
  55. sets.precast.JA['Dodge'] = {feet="Anchorite's Gaiters +1"}
  56. sets.precast.JA['Focus'] = {head="Anchorite's Crown +1"}
  57. sets.precast.JA['Counterstance'] = {feet="Hesychast's Gaiters +1"}
  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="Iron Gobbet",
  68. head="Felistris Mask",
  69. body="Anchorite's Cyclas +1",hands="Hesychast's Gloves +1",ring1="Spiral Ring",
  70. back="Iximulew Cape",waist="Caudata Belt",legs="Qaaxo Tights",feet="Thurandaut Boots +1"}
  71.  
  72. -- Waltz set (chr and vit)
  73. sets.precast.Waltz = {ammo="Sonia's Plectrum",
  74. head="Felistris Mask",
  75. body="Otronif Harness +1",hands="Hesychast's Gloves +1",ring1="Spiral Ring",
  76. back="Iximulew Cape",waist="Caudata Belt",legs="Qaaxo Tights",feet="Otronif Boots +1"}
  77.  
  78. -- Don't need any special gear for Healing Waltz.
  79. sets.precast.Waltz['Healing Waltz'] = {}
  80.  
  81. sets.precast.Step = {waist="Chaac Belt"}
  82. sets.precast.Flourish1 = {waist="Chaac Belt"}
  83.  
  84.  
  85. -- Fast cast sets for spells
  86.  
  87. sets.precast.FC = {ammo="Impatiens",head="Haruspex hat",ear2="Loquacious Earring",hands="Thaumas Gloves"}
  88.  
  89. sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Beads"})
  90.  
  91.  
  92. -- Weaponskill sets
  93. -- Default set for any weaponskill that isn't any more specifically defined
  94. sets.precast.WS = {ammo="Thew Bomblet",
  95. head="Whirlpool Mask",neck=gear.ElementalGorget,ear1="Brutal Earring",ear2="Moonshade Earring",
  96. body="Qaaxo Harness",hands="Hesychast's Gloves +1",ring1="Rajas Ring",ring2="Epona's Ring",
  97. back="Atheling Mantle",waist="Caudata Belt",legs="Quiahuiz Trousers",feet="Manibozho Boots"}
  98. sets.precast.WSAcc = {ammo="Honed Tathlum",body="Manibozho Jerkin",back="Letalis Mantle",feet="Qaaxo Leggings"}
  99. sets.precast.WSMod = {ammo="Tantra Tathlum",head="Felistris Mask",legs="Hesychast's Hose +1",feet="Daihanshi Habaki"}
  100. sets.precast.MaxTP = {ear1="Bladeborn Earring",ear2="Steelflash Earring"}
  101. sets.precast.WS.Acc = set_combine(sets.precast.WS, sets.precast.WSAcc)
  102. sets.precast.WS.Mod = set_combine(sets.precast.WS, sets.precast.WSMod)
  103.  
  104. -- Specific weaponskill sets.
  105.  
  106. -- legs={name="Quiahuiz Trousers", augments={'Phys. dmg. taken -2%','Magic dmg. taken -2%','STR+8'}}}
  107.  
  108. sets.precast.WS['Victory Smite'] = {ammo="Ginsen",
  109. head={ name="Herculean Helm", augments={'"Triple Atk."+4','DEX+4','Accuracy+15','Attack+15',}},
  110. body={ name="Ryuo Domaru", augments={'HP+50','"Store TP"+5','"Dbl.Atk."+2',}},
  111. hands={ name="Herculean Gloves", augments={'Attack+7','Weapon skill damage +3%','DEX+13','Accuracy+5',}},
  112. legs="Hiza. Hizayoroi +2",
  113. feet={ name="Herculean Boots", augments={'Attack+24','Weapon skill damage +4%','DEX+1','Accuracy+14',}},
  114. neck="Fotia Gorget",
  115. waist="Fotia Belt",
  116. left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +25',}},
  117. right_ear="Ishvara Earring",
  118. left_ring="Niqmaddu Ring",
  119. right_ring="Rufescent Ring",
  120. back="Buquwik Cape",
  121. }
  122. sets.precast.WS['Shijin Spiral'] = {ammo="Ginsen",
  123. head={ name="Herculean Helm", augments={'"Triple Atk."+4','DEX+4','Accuracy+15','Attack+15',}},
  124. body={ name="Adhemar Jacket", augments={'DEX+10','AGI+10','Accuracy+15',}},
  125. hands={ name="Ryuo Tekko", augments={'DEX+10','Accuracy+20','"Dbl.Atk."+3',}},
  126. legs={ name="Herculean Trousers", augments={'Attack+29','Weapon skill damage +4%','DEX+9','Accuracy+11',}},
  127. feet={ name="Herculean Boots", augments={'Attack+24','Weapon skill damage +4%','DEX+1','Accuracy+14',}},
  128. neck="Fotia Gorget",
  129. waist="Fotia Belt",
  130. left_ear="Mache Earring",
  131. right_ear="Mache Earring",
  132. left_ring="Niqmaddu Ring",
  133. right_ring="Ramuh Ring",
  134. back={ name="Segomo's Mantle", augments={'"Dbl.Atk."+4',}},
  135. }
  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 = {ammo="Staunch Tathlum",
  166. head="Skormoth Mask",
  167. body="Emet Harness +1",
  168. hands={ name="Herculean Gloves", augments={'Accuracy+28','"Triple Atk."+2','DEX+4',}},
  169. legs={ name="Ryuo Hakama", augments={'Accuracy+20','"Store TP"+4','Phys. dmg. taken -3',}},
  170. feet={ name="Herculean Boots", augments={'Accuracy+20 Attack+20','"Triple Atk."+3','Accuracy+4','Attack+14',}},
  171. neck="Twilight Torque",
  172. waist="Moonbow Belt",
  173. left_ear="Hearty Earring",
  174. right_ear="Odnowa Earring +1",
  175. left_ring="Vocane Ring",
  176. right_ring="Defending Ring",
  177. back="Moonbeam Cape",
  178. }
  179.  
  180. sets.idle.Town = {ammo="Staunch Tathlum",
  181. head="Skormoth Mask",
  182. body="Emet Harness +1",
  183. hands={ name="Herculean Gloves", augments={'Accuracy+28','"Triple Atk."+2','DEX+4',}},
  184. legs={ name="Ryuo Hakama", augments={'Accuracy+20','"Store TP"+4','Phys. dmg. taken -3',}},
  185. feet="Herald's Gaiters",
  186. neck="Twilight Torque",
  187. waist="Moonbow Belt",
  188. left_ear="Hearty Earring",
  189. right_ear="Odnowa Earring +1",
  190. left_ring="Vocane Ring",
  191. right_ring="Defending Ring",
  192. back="Moonbeam Cape",
  193. }
  194.  
  195. sets.idle.Weak = {ammo="Thew Bomblet",
  196. head="Felistris Mask",neck="Wiglen Gorget",ear1="Brutal Earring",ear2="Bloodgem Earring",
  197. body="Hesychast's Cyclas",hands="Hesychast's Gloves +1",ring1="Sheltered Ring",ring2="Meridian Ring",
  198. back="Iximulew Cape",waist="Black Belt",legs="Qaaxo Tights",feet="Herald's Gaiters"}
  199.  
  200. -- Defense sets
  201. sets.defense.PDT = {ammo="Staunch Tathlum",
  202. head="Skormoth Mask",
  203. body="Emet Harness +1",
  204. hands={ name="Herculean Gloves", augments={'Accuracy+28','"Triple Atk."+2','DEX+4',}},
  205. legs={ name="Ryuo Hakama", augments={'Accuracy+20','"Store TP"+4','Phys. dmg. taken -3',}},
  206. feet={ name="Herculean Boots", augments={'Accuracy+20 Attack+20','"Triple Atk."+3','Accuracy+4','Attack+14',}},
  207. neck="Twilight Torque",
  208. waist="Moonbow Belt",
  209. left_ear="Hearty Earring",
  210. right_ear="Odnowa Earring +1",
  211. left_ring="Vocane Ring",
  212. right_ring="Defending Ring",
  213. back="Moonbeam Cape",
  214. }
  215.  
  216. sets.defense.HP = {ammo="Iron Gobbet",
  217. head="Uk'uxkaj Cap",neck="Lavalier +1",ear1="Brutal Earring",ear2="Bloodgem Earring",
  218. body="Hesychast's Cyclas",hands="Hesychast's Gloves +1",ring1="K'ayres Ring",ring2="Meridian Ring",
  219. back="Shadow Mantle",waist="Black Belt",legs="Hesychast's Hose +1",feet="Hesychast's Gaiters +1"}
  220.  
  221. sets.defense.MDT = {ammo="Demonry Stone",
  222. head="Uk'uxkaj Cap",neck="Twilight Torque",
  223. body="Otronif Harness +1",hands="Anchorite's Gloves +1",ring1="Defending Ring",ring2="Shadow Ring",
  224. back="Engulfer Cape",waist="Black Belt",legs="Qaaxo Tights",feet="Daihanshi Habaki"}
  225.  
  226. sets.Kiting = {feet="Herald's Gaiters"}
  227.  
  228. sets.ExtraRegen = {head="Ocelomeh Headpiece +1"}
  229.  
  230. -- Engaged sets
  231.  
  232. -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
  233. -- sets if more refined versions aren't defined.
  234. -- If you create a set with both offense and defense modes, the offense mode should be first.
  235. -- EG: sets.engaged.Dagger.Accuracy.Evasion
  236.  
  237. -- Normal melee sets
  238. sets.engaged = {ammo="Ginsen",
  239. head={ name="Herculean Helm", augments={'"Triple Atk."+4','DEX+4','Accuracy+15','Attack+15',}},
  240. body={ name="Adhemar Jacket", augments={'DEX+10','AGI+10','Accuracy+15',}},
  241. hands={ name="Herculean Gloves", augments={'Accuracy+28','"Triple Atk."+2','DEX+4',}},
  242. legs={ name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
  243. feet={ name="Herculean Boots", augments={'Accuracy+20 Attack+20','"Triple Atk."+3','Accuracy+4','Attack+14',}},
  244. neck="Moonbeam Nodowa",
  245. waist="Moonbow Belt",
  246. left_ear="Cessance Earring",
  247. right_ear="Mache Earring",
  248. left_ring="Niqmaddu Ring",
  249. right_ring="Epona's Ring",
  250. back={ name="Segomo's Mantle", augments={'"Dbl.Atk."+4',}},
  251. }
  252. sets.engaged.Acc = {ammo="Ginsen",
  253. head={ name="Herculean Helm", augments={'"Triple Atk."+4','DEX+4','Accuracy+15','Attack+15',}},
  254. body={ name="Adhemar Jacket", augments={'DEX+10','AGI+10','Accuracy+15',}},
  255. hands={ name="Herculean Gloves", augments={'Accuracy+28','"Triple Atk."+2','DEX+4',}},
  256. legs={ name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
  257. feet={ name="Herculean Boots", augments={'Accuracy+20 Attack+20','"Triple Atk."+3','Accuracy+4','Attack+14',}},
  258. neck="Moonbeam Nodowa",
  259. waist="Moonbow Belt",
  260. left_ear="Cessance Earring",
  261. right_ear="Mache Earring",
  262. left_ring="Niqmaddu Ring",
  263. right_ring="Epona's Ring",
  264. back={ name="Segomo's Mantle", augments={'"Dbl.Atk."+4',}},
  265. }
  266. sets.engaged.PDT = {ammo="Staunch Tathlum",
  267. head="Skormoth Mask",
  268. body="Emet Harness +1",
  269. hands={ name="Herculean Gloves", augments={'Accuracy+28','"Triple Atk."+2','DEX+4',}},
  270. legs={ name="Ryuo Hakama", augments={'Accuracy+20','"Store TP"+4','Phys. dmg. taken -3',}},
  271. feet={ name="Herculean Boots", augments={'Accuracy+20 Attack+20','"Triple Atk."+3','Accuracy+4','Attack+14',}},
  272. neck="Twilight Torque",
  273. waist="Moonbow Belt",
  274. left_ear="Hearty Earring",
  275. right_ear="Odnowa Earring +1",
  276. left_ring="Vocane Ring",
  277. right_ring="Defending Ring",
  278. back="Moonbeam Cape",
  279. }
  280.  
  281. -- Defensive melee hybrid sets
  282. sets.engaged.PDT = {ammo="Staunch Tathlum",
  283. head="Skormoth Mask",
  284. body="Emet Harness +1",
  285. hands={ name="Herculean Gloves", augments={'Accuracy+28','"Triple Atk."+2','DEX+4',}},
  286. legs={ name="Ryuo Hakama", augments={'Accuracy+20','"Store TP"+4','Phys. dmg. taken -3',}},
  287. feet={ name="Herculean Boots", augments={'Accuracy+20 Attack+20','"Triple Atk."+3','Accuracy+4','Attack+14',}},
  288. neck="Twilight Torque",
  289. waist="Moonbow Belt",
  290. left_ear="Hearty Earring",
  291. right_ear="Odnowa Earring +1",
  292. left_ring="Vocane Ring",
  293. right_ring="Defending Ring",
  294. back="Moonbeam Cape",
  295. }
  296.  
  297.  
  298. -- Hundred Fists/Impetus melee set mods
  299. sets.engaged.Impetus = {body="Bhikku Cyclas +1"}
  300.  
  301.  
  302. -- Footwork combat form
  303. sets.engaged.Footwork = {ammo="Thew Bomblet",
  304. head="Felistris Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  305. body="Qaaxo Harness",hands="Hesychast's Gloves +1",ring1="Rajas Ring",ring2="Epona's Ring",
  306. back="Atheling Mantle",waist="Windbuffet Belt",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  307. sets.engaged.Footwork.Acc = {ammo="Honed Tathlum",
  308. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  309. body="Otronif Harness +1",hands="Hesychast's Gloves +1",ring1="Rajas Ring",ring2="Epona's Ring",
  310. back="Letalis Mantle",waist="Anguinus Belt",legs="Hesychast's Hose +1",feet="Anchorite's Gaiters +1"}
  311.  
  312. -- Quick sets for post-precast adjustments, listed here so that the gear can be Validated.
  313. sets.impetus_body = {body="Tantra Cyclas +2"}
  314. sets.footwork_kick_feet = {feet="Anchorite's Gaiters +1"}
  315. end
  316.  
  317. -------------------------------------------------------------------------------------------------------------------
  318. -- Job-specific hooks for standard casting events.
  319. -------------------------------------------------------------------------------------------------------------------
  320.  
  321. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  322. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  323. function job_precast(spell, action, spellMap, eventArgs)
  324. -- Don't gearswap for weaponskills when Defense is on.
  325. if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
  326. eventArgs.handled = true
  327. end
  328. end
  329.  
  330. -- Run after the general precast() is done.
  331. function job_post_precast(spell, action, spellMap, eventArgs)
  332. if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
  333. if state.Buff.Impetus and (spell.english == "Ascetic's Fury" or spell.english == "Victory Smite") then
  334. -- Need 6 hits at capped dDex, or 9 hits if dDex is uncapped, for Tantra to tie or win.
  335. if (state.OffenseMode.current == 'Fodder' and info.impetus_hit_count > 5) or (info.impetus_hit_count > 8) then
  336. equip(sets.impetus_body)
  337. end
  338. elseif state.Buff.Footwork and (spell.english == "Dragon's Kick" or spell.english == "Tornado Kick") then
  339. equip(sets.footwork_kick_feet)
  340. end
  341.  
  342. -- Replace Moonshade Earring if we're at cap TP
  343. if player.tp == 3000 then
  344. equip(sets.precast.MaxTP)
  345. end
  346. end
  347. end
  348.  
  349. function job_aftercast(spell, action, spellMap, eventArgs)
  350. if spell.type == 'WeaponSkill' and not spell.interrupted and state.FootworkWS and state.Buff.Footwork then
  351. send_command('cancel Footwork')
  352. end
  353. end
  354.  
  355. -------------------------------------------------------------------------------------------------------------------
  356. -- Job-specific hooks for non-casting events.
  357. -------------------------------------------------------------------------------------------------------------------
  358.  
  359. -- Called when a player gains or loses a buff.
  360. -- buff == buff gained or lost
  361. -- gain == true if the buff was gained, false if it was lost.
  362. function job_buff_change(buff, gain)
  363. -- Set Footwork as combat form any time it's active and Hundred Fists is not.
  364. if buff == 'Footwork' and gain and not buffactive['hundred fists'] then
  365. state.CombatForm:set('Footwork')
  366. elseif buff == "Hundred Fists" and not gain and buffactive.footwork then
  367. state.CombatForm:set('Footwork')
  368. else
  369. state.CombatForm:reset()
  370. end
  371.  
  372. -- Hundred Fists and Impetus modify the custom melee groups
  373. if buff == "Hundred Fists" or buff == "Impetus" then
  374. classes.CustomMeleeGroups:clear()
  375.  
  376. if (buff == "Hundred Fists" and gain) or buffactive['hundred fists'] then
  377. classes.CustomMeleeGroups:append('HF')
  378. end
  379.  
  380. if (buff == "Impetus" and gain) or buffactive.impetus then
  381. classes.CustomMeleeGroups:append('Impetus')
  382. end
  383. end
  384.  
  385. -- Update gear if any of the above changed
  386. if buff == "Hundred Fists" or buff == "Impetus" or buff == "Footwork" then
  387. handle_equipping_gear(player.status)
  388. end
  389. end
  390.  
  391.  
  392. -------------------------------------------------------------------------------------------------------------------
  393. -- User code that supplements standard library decisions.
  394. -------------------------------------------------------------------------------------------------------------------
  395.  
  396. function customize_idle_set(idleSet)
  397. if player.hpp < 75 then
  398. idleSet = set_combine(idleSet, sets.ExtraRegen)
  399. end
  400.  
  401. return idleSet
  402. end
  403.  
  404. -- Called by the 'update' self-command.
  405. function job_update(cmdParams, eventArgs)
  406. update_combat_form()
  407. update_melee_groups()
  408. end
  409.  
  410.  
  411. -------------------------------------------------------------------------------------------------------------------
  412. -- Utility functions specific to this job.
  413. -------------------------------------------------------------------------------------------------------------------
  414.  
  415. function update_combat_form()
  416. if buffactive.footwork and not buffactive['hundred fists'] then
  417. state.CombatForm:set('Footwork')
  418. else
  419. state.CombatForm:reset()
  420. end
  421. end
  422.  
  423. function update_melee_groups()
  424. classes.CustomMeleeGroups:clear()
  425.  
  426. if buffactive['hundred fists'] then
  427. classes.CustomMeleeGroups:append('HF')
  428. end
  429.  
  430. if buffactive.impetus then
  431. classes.CustomMeleeGroups:append('Impetus')
  432. end
  433. end
  434.  
  435.  
  436. -- Select default macro book on initial load or subjob change.
  437. function select_default_macro_book()
  438. -- Default macro set/book
  439. if player.sub_job == 'DNC' then
  440. set_macro_page(8, 1)
  441. elseif player.sub_job == 'NIN' then
  442. set_macro_page(2, 1)
  443. elseif player.sub_job == 'THF' then
  444. set_macro_page(4, 1)
  445. elseif player.sub_job == 'RUN' then
  446. set_macro_page(1, 1)
  447. else
  448. set_macro_page(1, 5)
  449. end
  450. end
  451.  
  452.  
  453. -------------------------------------------------------------------------------------------------------------------
  454. -- Custom event hooks.
  455. -------------------------------------------------------------------------------------------------------------------
  456.  
  457. -- Keep track of the current hit count while Impetus is up.
  458. function on_action_for_impetus(action)
  459. if state.Buff.Impetus then
  460. -- count melee hits by player
  461. if action.actor_id == player.id then
  462. if action.category == 1 then
  463. for _,target in pairs(action.targets) do
  464. for _,action in pairs(target.actions) do
  465. -- Reactions (bitset):
  466. -- 1 = evade
  467. -- 2 = parry
  468. -- 4 = block/guard
  469. -- 8 = hit
  470. -- 16 = JA/weaponskill?
  471. -- If action.reaction has bits 1 or 2 set, it missed or was parried. Reset count.
  472. if (action.reaction % 4) > 0 then
  473. info.impetus_hit_count = 0
  474. else
  475. info.impetus_hit_count = info.impetus_hit_count + 1
  476. end
  477. end
  478. end
  479. elseif action.category == 3 then
  480. -- Missed weaponskill hits will reset the counter. Can we tell?
  481. -- Reaction always seems to be 24 (what does this value mean? 8=hit, 16=?)
  482. -- Can't tell if any hits were missed, so have to assume all hit.
  483. -- Increment by the minimum number of weaponskill hits: 2.
  484. for _,target in pairs(action.targets) do
  485. for _,action in pairs(target.actions) do
  486. -- This will only be if the entire weaponskill missed or was parried.
  487. if (action.reaction % 4) > 0 then
  488. info.impetus_hit_count = 0
  489. else
  490. info.impetus_hit_count = info.impetus_hit_count + 2
  491. end
  492. end
  493. end
  494. end
  495. elseif action.actor_id ~= player.id and action.category == 1 then
  496. -- If mob hits the player, check for counters.
  497. for _,target in pairs(action.targets) do
  498. if target.id == player.id then
  499. for _,action in pairs(target.actions) do
  500. -- Spike effect animation:
  501. -- 63 = counter
  502. -- ?? = missed counter
  503. if action.has_spike_effect then
  504. -- spike_effect_message of 592 == missed counter
  505. if action.spike_effect_message == 592 then
  506. info.impetus_hit_count = 0
  507. elseif action.spike_effect_animation == 63 then
  508. info.impetus_hit_count = info.impetus_hit_count + 1
  509. end
  510. end
  511. end
  512. end
  513. end
  514. end
  515.  
  516. --add_to_chat(123,'Current Impetus hit count = ' .. tostring(info.impetus_hit_count))
  517. else
  518. info.impetus_hit_count = 0
  519. end
  520.  
  521. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement