midash

Orangebear_MNK

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