vm0d

vmod_SCH

Jun 16th, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 46.27 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job.  Generally should not be modified.
  3. -- Modified JUL 01 2018
  4. -------------------------------------------------------------------------------------------------------------------
  5.  
  6. --[[
  7.         Custom commands:
  8.  
  9.         Shorthand versions for each strategem type that uses the version appropriate for
  10.         the current Arts.
  11.  
  12.                                         Light Arts              Dark Arts
  13.  
  14.         gs c scholar light              Light Arts/Addendum
  15.         gs c scholar dark                                       Dark Arts/Addendum
  16.         gs c scholar cost               Penury                  Parsimony
  17.         gs c scholar speed              Celerity                Alacrity
  18.         gs c scholar aoe                Accession               Manifestation
  19.         gs c scholar power              Rapture                 Ebullience
  20.         gs c scholar duration           Perpetuance
  21.         gs c scholar accuracy           Altruism                Focalization
  22.         gs c scholar enmity             Tranquility             Equanimity
  23.         gs c scholar skillchain                                 Immanence
  24.         gs c scholar addendum           Addendum: White         Addendum: Black
  25. --]]
  26.  
  27.  
  28.  
  29. -- Initialization function for this job file.
  30. function get_sets()
  31.     mote_include_version = 2
  32.  
  33.     -- Load and initialize the include file.
  34.     include('Mote-Include.lua')
  35. end
  36.  
  37. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  38. function job_setup()
  39.     state.Buff['Sublimation: Activated'] = buffactive['Sublimation: Activated'] or false
  40.     state.Buff['Aurorastorm'] = buffactive['Aurorastorm'] or false
  41.     state.Buff['Reive Mark'] = buffactive['Reive Mark'] or false
  42.  
  43.     info.addendumNukes = S{"Stone IV", "Water IV", "Aero IV", "Fire IV", "Blizzard IV", "Thunder IV",
  44.         "Stone V", "Water V", "Aero V", "Fire V", "Blizzard V", "Thunder V"}
  45.  
  46.     update_active_strategems()
  47. end
  48.  
  49. -------------------------------------------------------------------------------------------------------------------
  50. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  51. -------------------------------------------------------------------------------------------------------------------
  52.  
  53. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  54. function user_setup()
  55.     state.MagicBurst = M(false, 'Burst')
  56.     state.Skillchain = M(false, 'Chainbound')
  57.     state.CastingMode:options('Normal', 'Resistant')
  58.     state.IdleMode:options('Normal', 'PDT', 'Stun')
  59.     state.OffenseMode:options('None', 'Normal')
  60.  
  61. --  info.low_nukes = S{"Stone", "Water", "Aero", "Fire", "Blizzard", "Thunder",
  62. --                      "Stone II", "Water II", "Aero II", "Fire II", "Blizzard II", "Thunder II",
  63. --                      "Stonega", "Waterga", "Aeroga", "Firaga", "Blizzaga", "Thundaga"}
  64. --  info.high_nukes = S{"Stonega II", "Waterga II", "Aeroga II",
  65. --                      "Stone III", "Water III", "Aero III", "Fire III", "Blizzard III", "Thunder III",
  66. --                      "Stone IV", "Water IV", "Aero IV", "Fire IV", "Blizzard IV", "Thunder IV",
  67. --                      "Stone V", "Water V", "Aero V", "Fire V", "Blizzard V", "Thunder V"}
  68.  
  69.     select_default_macro_book()
  70.  
  71.     -- Gear Definitions
  72.     gear.DarkRing = {name="Dark Ring"}
  73.     gear.Reive = {name="Ygnas's Resolve +1"}
  74.     gear.JPcape = {name="Mecistopins Mantle"}
  75.     gear.HasteBelt = {name="Witful Belt"}
  76.  
  77.     -- Artifact set
  78.     -- Artifact Head has MAB, M.Acc, aug: sublimation
  79.     gear.AFHead = {name="Academic's Mortarboard +1"}
  80.     -- Artifact Body has aug: dark arts
  81.     gear.AFBody = {name="Academic's Gown +1"}
  82.     -- Artifact Hands have fast cast, conserve mp
  83.     gear.AFHands = {name="Academic's Bracers +1"}
  84.     -- Artifact Legs have aug: light arts
  85.     gear.AFLegs = {name="Academic's Pants +1"}
  86.     -- Artifact Feet have grimoire: fast cast
  87.     gear.AFFeet = {name="Academic's Loafers +1"}
  88.  
  89.     -- Relic set
  90.     -- Relic Head has grimoire: fast cast, aug: altruism, focalization
  91.     gear.RHead = {name="Pedagogy Mortarboard +1"}
  92.     -- Relic Body has aug: sublimation, enlightenment
  93.     gear.RBody = {name="Pedagogy Gown +1"}
  94.     -- Relic Hands have aug: tranquility, equanamity
  95.     gear.RHands = {name="Pedagogy Bracers +2"}
  96.     -- Relic Legs have aug: tabula rasa
  97.     gear.RLegs = {name="Pedagogy Pants +1"}
  98.     -- Relic Feet have fast cast, aug: stormsurge, weather: celerity, alacrity
  99.     gear.RFeet = {name="Pedagogy Loafers +2"}
  100.  
  101.     -- Empyrean set
  102.     -- Empyrean set has a unique set bonus which applies with as little as 2 pieces.
  103.     -- This entire set should be acquired and +2.
  104.     -- Empyrean Head is for regen potency, aug: rapture, ebullience
  105.     gear.EmpHead = {name="Arbatel Bonnet +1"}
  106.     -- Empyrean Body is for aug: addendum white/black
  107.     gear.EmpBody = {name="Arbatel Gown +1"}
  108.     -- Empyrean Hands are for aug: perpetuance, immanence
  109.     gear.EmpHands = {name="Arbatel Bracers +1"}
  110.     -- Empyrean Legs are for grimoire: M.Acc, aug: penury, parsimony
  111.     gear.EmpLegs = {name="Arbatel Pants +1"}
  112.     -- Empyrean Feet are for aug: klimaform
  113.     gear.EmpFeet = {name="Arbatel Loafers +1"}
  114.  
  115.     -- Gendewitha Set
  116.     -- This entire set should be acquired and aug for DT, either NQ or +1
  117.     -- Gendewitha head is for DT, Cure potency
  118.     -- Best aug is cure potency
  119.     gear.GHead = {name="Gendewitha Caubeen +1"}
  120.     -- Gendewitha body is for DT
  121.     gear.GBody = {name="Gendewitha Bliaut +1"}
  122.     -- Gendewitha hands is for DT, Precast fast cast, Midcast recast
  123.     gear.GHands = {name="Gendewitha Gages +1"}
  124.     -- Gendewitha legs is for DT, Precast song cast
  125.     gear.GLegs = {name="Gendewitha Spats +1"}
  126.     -- Gendewitha feet is for DT, cursna
  127.     gear.GFeet = {name="Gendewitha Galoshes +1"}
  128.  
  129.     -- Hagondes Set
  130.     -- Hagondes head is for MAB
  131.     gear.HagHead = {name="Hagondes Hat +1"}
  132.     -- Hagondes body is for MAB, refresh
  133.     gear.HagBody = {name="Hagondes Coat +1"}
  134.     -- Hagondes hands is for M.Acc
  135.     gear.HagHands = {name="Hagondes Cuffs +1"}
  136.     -- Hagondes legs is for MAB, M.Dmg
  137.     gear.HagLegs = {name="Hagondes Pants +1"}
  138.     -- Hagondes feet is for Avatar: MAB
  139.     gear.HagFeet = {name="Hagondes Sabots +1"}
  140.  
  141.     -- Telchine set
  142.     -- Many augs are available for this set, multiple sets are an option
  143.     -- This set assumes max Fast Cast and Enhancing duration augs on all pieces
  144.     -- Telchine head is for M.Acc
  145.     gear.THeadEnh = {name="Telchine Cap", augments={'Enh. Mag. eff. dur. +10'}}
  146.     -- Telchine body is for Enhancing skill+12, Regen duration +12
  147.     gear.TBodyEnh = {name="Telchine Chasuble", augments={'Enh. Mag. eff. dur. +10'}}
  148.     -- Telchine hands is for cure potency
  149.     gear.THandsEnh = {name="Telchine Gloves", augments={'Enh. Mag. eff. dur. +10'}}
  150.     -- Telchine legs is for MAB+15, DA+3
  151.     gear.TLegsEnh = {name="Telchine Braconi", augments={'Enh. Mag. eff. dur. +10'}}
  152.     -- Telchine feet is for precast song cast
  153.     gear.TFeetEnh = {name="Telchine Pigaches", augments={'Enh. Mag. eff. dur. +10'}}
  154.  
  155.     -- Helios set
  156.     -- Many augs are available for this set, multiple sets are an option
  157.     -- Helios head is for M.acc, MAB, conserve mp
  158.     gear.HelHead = {name="Helios Band"}
  159.     -- Helios body is for Acc, M.Acc, fast cast
  160.     gear.HelBody = {name="Helios Jacket"}
  161.     -- Helios hands is for MAB, enm-
  162.     gear.HelHands = {name="Helios Gloves"}
  163.     -- Helios legs is for Avatar: M.Acc, BP dmg
  164.     gear.HelLegs = {name="Helios Spats"}
  165.     -- Helios feet is for M.Acc, enm-
  166.     gear.HelFeet = {name="Helios Boots"}
  167.  
  168.     -- Vanya set
  169.     -- Vanya head is for conserve mp, cure pot, mdt-
  170.     gear.VHead = {name="Vanya Hood"}
  171.     -- Vanya body is for m.acc, divine skill, enfeebling skill, dt-
  172.     gear.VBody = {name="Vanya Robe"}
  173.     -- Vanya hands is for singing skill
  174.     gear.VHands = {name="Vanya Cuffs"}
  175.     -- Vanya legs is for m.acc, conserve mp
  176.     gear.VLegs = {name="Vanya Slops"}
  177.     -- Vanya feet is for healing skill, cure pot, cursna
  178.     gear.VFeet = {name="Vanya Clogs"}
  179.  
  180.     -- Psycloth set
  181.     -- Psycloth head is for
  182.     gear.PsyHead = {name="Psycloth Tiara"}
  183.     -- Psycloth body is for
  184.     gear.PsyBody = {name="Psycloth Vest"}
  185.     -- Psycloth hands is for macc, mab, ele skill, avatar: macc
  186.     gear.PsyHands = {name="Psycloth Manillas"}
  187.     -- Psycloth legs is for
  188.     gear.PsyLegs = {name="Psycloth Lappas"}
  189.     -- Psycloth feet is for
  190.     gear.PsyFeet = {name="Psycloth Boots"}
  191.  
  192.     -- Chironic set
  193.     -- Chironic head is for
  194.     gear.ChiHead = {name="Chironic Hat"}
  195.     -- Chironic body is for
  196.     --gear.ChiBody = {name="Chironic Doublet"}
  197.     -- Chironic hands is for
  198.     gear.ChiHands = {name="Chironic Gloves"}
  199.     -- Chironic legs is for macc, enf skill, cure pot, immunobreak
  200.     gear.ChiLegs = {name="Chironic Hose"}
  201.     -- Chironic feet is for atk, mab, div skill, enm-, pdt
  202.     gear.ChiFeet = {name="Chironic Slippers"}
  203.  
  204.     -- Merlinic set
  205.     -- Merlinic head is for macc, mab, fc
  206.     gear.MerHead = {name="Merlinic Hood"}
  207.     -- Merlinic body is for
  208.     --gear.MerBody = {name="Merlinic Jubbah"}
  209.     -- Merlinic hands is for avatar: atk, mab, enm+, bpdmg
  210.     gear.MerHands = {name="Merlinic Dastanas"}
  211.     -- Merlinic legs is for macc, mdmg, mab, enm-
  212.     gear.MerLegs = {name="Merlinic Shalwar"}
  213.     -- Merlinic feet is for
  214.     gear.MerFeet = {name="Merlinic Crackows"}
  215.  
  216.     -- Kaykaus set
  217.     -- Kaykaus head is for m.acc, healing skill, cure pot, mdt
  218.     gear.KHead = {name="Kaykaus Mitra"}
  219.     -- Kaykaus body is for acc, m.acc, refresh, cure potII
  220.     gear.KBody = {name="Kaykaus Bliaut"}
  221.     -- Kaykaus hands is for m.acc, enfeebling skill, enm-, cure pot
  222.     gear.KHands = {name="Kaykaus Cuffs"}
  223.     -- Kaykaus legs is for m.atk, divine skill, fc, cure pot
  224.     gear.KLegs = {name="Kaykaus Tights"}
  225.     -- Kaykaus feet is for enhancing skill, enm-, conserve mp, cure pot
  226.     gear.KFeet = {name="Kaykaus Boots"}
  227.  
  228.     -- Jhakri set
  229.     -- Jhakri head is for
  230.     gear.JhaHead = {name="Jhakri Coronal"}
  231.     -- Jhakri body is for
  232.     gear.JhaBody = {name="Jhakri Robe"}
  233.     -- Jhakri hands is for
  234.     gear.JhaHands = {name="Jhakri Cuffs"}
  235.     -- Jhakri legs is for
  236.     gear.JhaLegs = {name="Jhakri Slops"}
  237.     -- Jhakri feet is for
  238.     gear.JhaFeet = {name="Jhakri Pigaches"}
  239.  
  240.     -- Additional local binds
  241.     -- F10, F11, F12 are occupied by default as follows:
  242.     -- f10 reset DefenseMode
  243.     -- ^f10 DefenseMode Physical
  244.     -- !f10 DefenseMode Magical
  245.     -- f11 toggle CP
  246.     -- ^f11 toggle Kiting
  247.     -- f11 EquipStop
  248.     -- f12 update user
  249.     -- ^f12 IdleMode
  250.     send_command('bind f9 gs c cycle CastingMode')
  251.     send_command('bind ^f9 gs c toggle MagicBurst')
  252.     send_command('bind !f9 gs c toggle Skillchain')
  253.  
  254.     send_command('bind ^` input /ma "Stun" <t>')
  255. end
  256.  
  257. function user_unload()
  258.     send_command('unbind ^`')
  259. end
  260.  
  261.  
  262. -- Define sets and vars used by this job file.
  263. function init_gear_sets()
  264.     --------------------------------------
  265.     -- Special sets (required by rules)
  266.     --------------------------------------
  267.     sets.Kiting = {feet="Herald's Gaiters"}
  268.     sets.CP = {back=gear.JPcape}
  269.  
  270.     -- vm0d's Custom Sets
  271.     -- Sets to augment the Idle set
  272.     sets.latent_refresh = {waist="Fucho-no-obi"}
  273.     sets.DayRefresh = {head="Befouled Crown",body=gear.GBody,legs="Assiduity Pants +1",feet="Serpentes Sabots"}
  274.     sets.NightRefresh = {head="Befouled Crown",body=gear.GBody,legs="Assiduity Pants +1",hands="Serpentes Cuffs"}
  275.     sets.ExtraRegen = {neck="Sanctity Necklace",ring1="Sheltered Ring",ring2="Paguroidea Ring"}
  276.     sets.ExtraRefresh = {head="Befouled Crown",body=gear.GBody,legs="Assiduity Pants +1"}
  277.     sets.SelfRefresh = {back="Grapevine Cape",waist="Gishdubar Sash"}
  278.     sets.Sanction = {ring1="Balrahn's Ring"}
  279.     sets.Roll = {ring1="Roller's Ring"}
  280.     sets.poison = {back="Taster's Cape"}
  281.     sets.Aries = {back="Aries Mantle"}
  282.     sets.ProSh = {ring1="Sheltered Ring"}
  283.     sets.ObiCure = {back="Twilight Cape",waist="Hachirin-no-Obi"}
  284.     -- Sets that augment various sets
  285.     --sets.GrimFC_Head = {head=gear.RHead}
  286.     --sets.GrimFC_Feet = {feet=gear.AFFeet}
  287.     sets.Burst = {neck="Mizukage-no-Kubikazari",hands="Amalric Gages +1"}
  288.     -- prefer telchine for duration
  289.     --sets.LAenh = {legs=gear.AFLegs}
  290.     --sets.LowMP = {body="Seidr Cotehardie",neck="Sanctity Necklace"}
  291.     sets.Moonshade = {ear2="Moonshade Earring"}
  292.  
  293.     -- Buff sets: Gear that needs to be worn to enhance an active player buff.
  294.     sets.buff['Ebullience'] = {head=gear.EmpHead}
  295.     sets.buff['Rapture'] = {head=gear.EmpHead}
  296.     sets.buff['Perpetuance'] = {hands=gear.EmpHands}
  297.     -- Empyrean hands provide SC dmg bonus
  298.     sets.buff['Immanence'] = {hands=EmpHands}
  299.     sets.buff['Penury'] = {legs=gear.EmpLegs}
  300.     sets.buff['Parsimony'] = {legs=gear.EmpLegs}
  301.     sets.buff['Celerity'] = {feet=gear.RFeet}
  302.     sets.buff['Alacrity'] = {feet=gear.RFeet}
  303.     sets.buff['Klimaform'] = {feet=gear.EmpFeet}
  304.     sets.buff.FullSublimation = {head=gear.AFHead,ear2="Savant's Earring",body=gear.RBody}
  305.     sets.buff.PDTSublimation = {ear2="Savant's Earring"}
  306.     -- perfect set includes chatoyant, at the expense of losing tp
  307.     sets.buff['Reive Mark'] = {neck=gear.Reive}
  308.  
  309.  
  310.     --------------------------------------
  311.     -- Precast sets
  312.     --------------------------------------
  313.  
  314.     -- Precast sets to enhance JAs
  315.     sets.precast.JA['Tabula Rasa'] = {legs=gear.RLegs}
  316.  
  317.  
  318.     -- Fast cast sets for spells
  319.     -- Relic head and Artifact feet reduce casting time if an arts effect is active and Celerity/Alacrity/Accession/Manifestation are not active
  320.     sets.precast.FC = {ammo="Impatiens",
  321.         head=gear.VHead,neck="Orunmila's Torque",ear1="Enchanter Earring +1",ear2="Loquacious Earring",
  322.         body="Anhur Robe",hands=gear.GHands,ring1="Kishar Ring",ring2="Veneficium Ring",
  323.         back="Perimede Cape",waist=gear.HasteBelt,legs=gear.TLegsEnh,feet=gear.RFeet}
  324.  
  325.     sets.precast['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  326.  
  327.     sets.precast['Elemental Magic'] = set_combine(sets.precast.FC, {ear1="Barkarole earring"})
  328.  
  329.     sets.precast.Stun = set_combine(sets.precast.FC, {})
  330.  
  331.     sets.precast.Impact = set_combine(sets.precast.FC['Elemental Magic'], {head=empty,body="Twilight Cloak"})
  332.  
  333.     sets.precast.Meteor = set_combine(sets.precast.FC['Elemental Magic'], {body="Onca Suit",hands=empty,legs=empty,feet=empty})
  334.  
  335.  
  336.     -- Weaponskill sets
  337.  
  338.     -- Myrkr: 20% MP recovered @ 1000TP, 40% @ 2000TP, 60% @ 3000TP
  339.     -- MP returned is based on current MP, use MP+ gear
  340.     -- any IL119 armor is fine and add any MP+ accessories you carry
  341.     sets.precast.WS['Myrkr'] = {ammo="Incantor Stone",
  342.         head=gear.THeadEnh,neck="Fotia Gorget",ear1="Andoaa Earring",ear2="Loquacious Earring",
  343.         body=gear.TBodyEnh,hands=gear.THandsEnh,ring1="Metamorph Ring +1",ring2="Zodiac Ring",
  344.         back="Twilight Cape",waist="Fotia Belt",legs=gear.TLegsEnh,feet=gear.TFeetEnh}
  345.  
  346.  
  347.     --------------------------------------
  348.     -- Midcast Sets
  349.     --------------------------------------
  350.  
  351.     -- Recast
  352.  
  353.     -- set for fast recast, used by default for spells without a defined set and spells mapped to "no skill"
  354.     -- Relic head and Artifact feet reduce recast time if an arts effect is active and Celerity/Alacrity/Accession/Manifestation are not active
  355.     sets.midcast.FastRecast = {ammo="Incantor Stone",
  356.         head=gear.VHead,neck="Orunmila's Torque",ear1="Enchanter Earring +1",ear2="Loquacious Earring",
  357.         body="Shango Robe",hands=gear.THandsEnh,ring1="Kishar Ring",ring2="Prolix Ring",
  358.         back="Lugh's Cape",waist=gear.HasteBelt,legs=gear.TLegsEnh,feet=gear.RFeet}
  359.  
  360.     -- Healing Magic
  361.  
  362.     -- achieve 50% potency without main, back, waist for weather equipment
  363.     sets.midcast.Cure = set_combine(sets.midcast.FastRecast, {
  364.         head=gear.GHead,neck="Incanter's Torque",
  365.         body=gear.GBody,hands=gear.THandsEnh,ring1="Sirona's Ring",ring2="Haoma's Ring",
  366.         back="Lugh's Cape",waist=gear.HasteBelt,legs=gear.ChiLegs,feet="Skaoi Boots"})
  367.  
  368.     sets.midcast.Cursna = set_combine(sets.midcast.FastRecast, {ring2="Haoma's Ring",back="Oretania's Cape +1",feet=gear.GFeet})
  369.  
  370.     -- Enhancing Magic
  371.  
  372.     -- SCH base skill 350. Active Light Arts skill 420.
  373.     -- base set with only enhancing duration
  374.     sets.midcast['Enhancing Magic'] = set_combine(sets.midcast.FastRecast, {main="Gada",sub="Chanter's Shield",
  375.         head=gear.THeadEnh,body=gear.TBodyEnh,hands=gear.THandsEnh,legs=gear.TLegsEnh,feet=gear.TFeetEnh})
  376.  
  377.     -- SCH base skill 350. base MND ~75.
  378.     -- If ((Enhancing Magic Skill ÷ 3) + MND) ≥ 130 [base sch stats: 350/3 + 75 = 191 and 191 > 130],
  379.     -- then (Enhancing Magic Skill + 3×MND - 190) = Stoneskin strength [base sch stats: (350 + 3x75 - 190) = 385 Stoneskin strength]
  380.     -- Stoneskin caps at 350 HP absorbed, therefore SCH need only use Stoneskin enhancing gear.
  381.     sets.midcast.Stoneskin = set_combine(sets.midcast['Enhancing Magic'], {ear1="Earthcry Earring",neck="Stone Gorget",waist="Siegel Sash",legs="Haven Hose"})
  382.  
  383.     -- Aquaveil prevents 2 interruptions at 355+ skill that would be caused by damage.
  384.     -- Aquaveil will not prevent spell interruption from status effects (e.g. Paralyze) or from player movement during casting.
  385.     -- SCH base skill 350. LA skill 420. therefore SCH with 3+ enhancing skill merits need only use Aquaveil enhancing gear.
  386.     sets.midcast['Aquaveil'] = set_combine(sets.midcast['Enhancing Magic'], {head=gear.ChiHead,waist="Emphatikos Rope"})
  387.  
  388.     -- caps at 500 skill, will require some skill gear even after merits and gifts
  389.     sets.midcast.Embrava = set_combine(sets.midcast['Enhancing Magic'], {ammo="Savant's Treatise",
  390.         neck="Incanter's Torque",ear1="Augmenting Earring",ear2="Andoaa Earring",ring2="Stikini Ring",back="Perimede Cape",waist="Olympus Sash"})
  391.  
  392.     -- caps at 500 skill, will require some skill gear even after merits and gifts
  393.     sets.midcast.Phalanx = set_combine(sets.midcast['Enhancing Magic'], {ammo="Savant's Treatise",
  394.         neck="Incanter's Torque",ear1="Augmenting Earring",ear2="Andoaa Earring",ring2="Stikini Ring",back="Perimede Cape",waist="Olympus Sash"})
  395.  
  396.     -- caps at 500 skill, will require some skill gear even after merits and gifts
  397.     sets.midcast.BarElement = set_combine(sets.midcast['Enhancing Magic'], {ammo="Savant's Treatise",
  398.         neck="Incanter's Torque",ear1="Augmenting Earring",ear2="Andoaa Earring",ring2="Stikini Ring",back="Perimede Cape",waist="Olympus Sash"})
  399.  
  400.     -- caps at 500 skill, will require some skill gear even after merits and gifts
  401.     sets.midcast.BarStatus = set_combine(sets.midcast['Enhancing Magic'], {ammo="Savant's Treatise",
  402.         neck="Incanter's Torque",ear1="Augmenting Earring",ear2="Andoaa Earring",ring2="Stikini Ring",back="Perimede Cape",waist="Olympus Sash"})
  403.  
  404.     -- Gives single weather effect to the target(s).
  405.     -- Stormsurge effect: Elements add +7 to their respective stat, except Dark which adds +3 to all stats.
  406.     -- If equipped while the storm spell is cast, augmented Relic Feet will give +12/+6 to each stat.
  407.     -- The same boost is received for both T1 and T2 storms.
  408.     sets.midcast.Storm = set_combine(sets.midcast['Enhancing Magic'], {feet=gear.RFeet})
  409.  
  410.     -- Any potency/duration gear
  411.     sets.midcast.Regen = set_combine(sets.midcast['Enhancing Magic'], {back="Lugh's Cape"})
  412.  
  413.     sets.midcast.Protect = set_combine(sets.midcast['Enhancing Magic'], {ring2="Sheltered Ring"})
  414.  
  415.     sets.midcast.Shell = set_combine(sets.midcast['Enhancing Magic'], {ring2="Sheltered Ring"})
  416.  
  417.     -- Currently, these spells have no augmenting gear, therefore need not be defined individually
  418.     --sets.midcast.Refresh = set_combine(sets.midcast['Enhancing Magic'], {})
  419.     --sets.midcast.Haste = set_combine(sets.midcast['Enhancing Magic'], {})
  420.     --sets.midcast.Flurry = set_combine(sets.midcast['Enhancing Magic'], {})
  421.     --sets.midcast.Adloquium = set_combine(sets.midcast['Enhancing Magic'], {})
  422.     --sets.midcast['Animus Augeo'] = set_combine(sets.midcast['Enhancing Magic'], {})
  423.     --sets.midcast['Animus Minuo'] = set_combine(sets.midcast['Enhancing Magic'], {})
  424.  
  425.     -- Various Enfeebling Magic
  426.  
  427.     -- INT, Enfeebling Magic, Magic Accuracy
  428.     -- merlinic hands have no native m.acc, so chironic hands are used instead
  429.     -- merlinic feet have no native m.acc, so skaoi boots are slightly better
  430.     sets.midcast.IntEnfeebles = {ammo="Pemphredo Tathlum",
  431.         head=gear.MerHead,neck="Imbodla Necklace",ear1="Gwati Earring",ear2="Barkarole Earring",
  432.         body="Shango Robe",hands=gear.ChiHands,ring1="Kishar Ring",ring2="Metamorph Ring +1",
  433.         back="Lugh's Cape",waist="Ovate Rope",legs=gear.MerLegs,feet="Skaoi Boots"}
  434.  
  435.     sets.midcast.IntEnfeebles.Resistant = set_combine(sets.midcast.IntEnfeebles, {})
  436.  
  437.     -- MND, Enfeebling Magic, Magic Accuracy
  438.     -- chironic feet have no native m.acc, so skaoi boots are slightly better
  439.     sets.midcast.MndEnfeebles = {ammo="Hydrocera",
  440.         head=gear.ChiHead,neck="Imbodla Necklace",ear1="Gwati Earring",ear2="Barkarole Earring",
  441.         body="Shango Robe",hands=gear.ChiHands,ring1="Kishar Ring",ring2="Metamorph Ring +1",
  442.         back="Lugh's Cape",waist="Ovate Rope",legs=gear.ChiLegs,feet="Skaoi Boots"}
  443.  
  444.     sets.midcast.MndEnfeebles.Resistant = set_combine(sets.midcast.MndEnfeebles, {})
  445.  
  446.     -- Poison II Damage Over Time potency is based on Enfeebling Magic Skill. Effect has no known cap.
  447.     -- Enfeebling Magic, Magic Accuracy
  448.     sets.midcast.Poison = set_combine(sets.midcast.IntEnfeebles, {})
  449.  
  450.     -- Elemental Debuffs stat reduction and DoT correspond directly to the caster's INT
  451.     -- Caps at 150 INT, 2-3 Ilevel armors will cap this
  452.     -- INT, Magic Accuracy
  453.     sets.midcast.ElementalEnfeeble = {ammo="Pemphredo Tathlum",
  454.         head=gear.MerHead,neck="Sanctity Necklace",ear1="Gwati Earring",ear2="Barkarole Earring",
  455.         body=gear.JhaBody,hands=gear.MerHands,ring1="Kishar Ring",ring2="Metamorph Ring +1",
  456.         back="Lugh's Cape",waist="Ovate Rope",legs=gear.MerLegs,feet=gear.MerFeet}
  457.  
  458.     -- Helix damage is greatly affected by weather.
  459.     -- Accuracy depends on caster's Elemental Magic skills; Damage is based on INT and Magic Attack Bonus
  460.     -- Zodiac Ring will not work with luminohelix or noctohelix; Archon Ring is used for noctohelix instead
  461.     -- JA Modus Veritas does not allow the DoT effect to surpass the 9,999 damage cap.
  462.     sets.midcast.Helix = {ammo="Pemphredo Tathlum",
  463.         head=gear.MerHead,neck="Imbodla Necklace",ear1="Friomisi Earring",ear2="Barkarole Earring",
  464.         body=gear.JhaBody,hands=gear.MerHands,ring1="Shiva Ring +1",ring2="Metamorph Ring +1",
  465.         back="Lugh's Cape",waist="Refoccilation Stone",legs=gear.MerLegs,feet=gear.MerFeet}
  466.  
  467.     sets.midcast['Noctohelix'] = {ammo="Pemphredo Tathlum",
  468.         head=gear.MerHead,neck="Imbodla Necklace",ear1="Friomisi Earring",ear2="Barkarole Earring",
  469.         body=gear.JhaBody,hands=gear.MerHands,ring1="Shiva Ring +1",ring2="Archon Ring",
  470.         back="Lugh's Cape",waist="Refoccilation Stone",legs=gear.MerLegs,feet=gear.MerFeet}
  471.  
  472.     sets.midcast.Helix.Resistant = {ammo="Pemphredo Tathlum",
  473.         head=gear.MerHead,neck="Sanctity Necklace",ear1="Strophadic Earring",ear2="Barkarole Earring",
  474.         body=gear.JhaBody,hands=gear.MerHands,ring1="Shiva Ring +1",ring2="Metamorph Ring +1",
  475.         back="Lugh's Cape",waist="Eschan Stone",legs=gear.MerLegs,feet=gear.MerFeet}
  476.  
  477.     sets.midcast['Dark Magic'] = {ammo="Incantor Stone",
  478.         head=gear.MerHead,neck="Erra Pendant",ear1="Gwati Earring",ear2="Barkarole Earring",
  479.         body="Shango Robe",hands=gear.MerHands,ring1="Sangoma Ring",ring2="Metamorph Ring +1",
  480.         back="Bookworm's Cape",waist="Ovate Rope",legs=gear.MerLegs,feet=gear.MerFeet}
  481.  
  482.     -- Klimaform is a dark magic buff, but, like the enhancing magic spell Haste, the buff is the same regardless of skill
  483. --  sets.midcast.Klimaform = set_combine(sets.midcast.FastRecast, {})
  484.  
  485.     -- Kaustra unresisted duration is approximately 1 + (Dark Magic Skill)/11 ticks (or three times that in seconds)
  486.     -- Base damage depends on the main level (Lv), not on the level difference, dINT is caster's INT vs. target INT and caps at 300
  487.     -- Other multipliers, such as darkness elemental potency and Magic Attack Bonus, are applied on top of the base damage normally
  488.     sets.midcast.Kaustra = {ammo="Pemphredo Tathlum",
  489.         head=gear.MerHead,neck="Incanter's Torque",ear1="Friomisi Earring",ear2="Barkarole Earring",
  490.         body="Shango Robe",hands=gear.MerHands,ring1="Shiva Ring +1",ring2="Archon Ring",
  491.         back="Lugh's Cape",waist="Refoccilation Stone",legs=gear.MerLegs,feet=gear.MerFeet}
  492.  
  493.     -- Drain and Aspir potency is directly associated with dark magic skill
  494.     sets.midcast.Drain = set_combine(sets.midcast.FastRecast, {neck="Erra Pendant",waist="Fucho-no-obi"})
  495.  
  496.     sets.midcast.Aspir = set_combine(sets.midcast.Drain, {})
  497.  
  498.     sets.midcast.Stun = set_combine(sets.midcast.FastRecast, {})
  499.  
  500.     sets.midcast.Stun.Resistant = set_combine(sets.midcast.Stun, {})
  501.  
  502.  
  503.     -- Elemental Magic sets
  504.  
  505.     -- Generic non-MB Sets
  506.     -- MAB|Mdmg>INT>M.acc
  507.     sets.midcast['Elemental Magic'] = {ammo="Pemphredo Tathlum",
  508.         head=gear.MerHead,neck="Saevus Pendant +1",ear1="Friomisi Earring",ear2="Barkarole Earring",
  509.         body=gear.EmpBody,hands=gear.MerHands,ring1="Shiva Ring +1",ring2="Metamorph Ring +1",
  510.         back="Lugh's Cape",waist="Refoccilation Stone",legs=gear.MerLegs,feet=gear.MerFeet}
  511.  
  512.     -- INT>M.acc>Mdmg>MAB
  513.     sets.midcast['Elemental Magic'].Resistant = {ammo="Pemphredo Tathlum",
  514.         head=gear.MerHead,neck="Sanctity Necklace",ear1="Strophadic Earring",ear2="Barkarole Earring",
  515.         body=gear.EmpBody,hands=gear.MerHands,ring1="Shiva Ring +1",ring2="Metamorph Ring +1",
  516.         back="Lugh's Cape",waist="Eschan Stone",legs=gear.MerLegs,feet=gear.MerFeet}
  517.  
  518.     -- Differentiated non-MB Sets
  519.     -- Low-tier nukes, I/II/gaI
  520.     -- benefit more from mdmg than MAB
  521.     --sets.midcast['Elemental Magic'].LowTierNuke = set_combine(sets.midcast['Elemental Magic'], {ammo="Ghastly Tathlum",
  522.     --  ear1="Crematio Earring",waist="Tengu-no-obi"})
  523.  
  524.     -- Likely not used outside MB, could be the same as MB sets
  525.     --sets.midcast['Elemental Magic'].HighTierNuke = set_combine(sets.midcast['Elemental Magic'], {ammo="Pemphredo Tathlum"})
  526.  
  527.     --sets.midcast['Elemental Magic'].HighTierNuke.Resistant = set_combine(sets.midcast['Elemental Magic'].Resistant, {ammo="Pemphredo Tathlum"})
  528.  
  529.     -- Skillchain bonus set, only used with state.Skillchain = 'Chainbound'
  530.     -- Chainbound state lasts for one spell, enable chainbound mode with alt-F9 or /console gs c toggle Skillchain
  531.     -- Macro Format Below (Example: 1st spell for Fragmentation SC):
  532.     --      /ma "Water" <t>
  533.     --      /p SCH Skillchain Start! <wait 1>
  534.     --      /console gs c toggle Skillchain
  535.     --sets.midcast['Elemental Magic'].Chainbound = set_combine(sets.midcast['Elemental Magic'], {
  536.     --  head="Jhakri Coronal +2",hands=gear.EmpHands,ring2="Mujin Band",back="Lugh's Cape",legs="Amalric Slops +1"})
  537.  
  538.     -- Magic Burst set, only used with state.MagicBurst = 'Burst'
  539.     -- Burst state lasts for one spell, enable burst mode with ctrl-F9 or /console gs c toggle MagicBurst
  540.     -- Macro Format Below (Example: 2nd spell for Fragmentation SC):
  541.     --      /console gs c toggle Skillchain
  542.     --      /ma "Water" <t>
  543.     --      /p  MB Fragmentation! <wait 1>
  544.     sets.midcast['Elemental Magic'].Burst = set_combine(sets.midcast['Elemental Magic'], {
  545.         neck="Mizukage-no-Kubikazari",hands="Amalric Gages +1"})
  546.  
  547.     -- Critical magic exists
  548.     --sets.midcast['Elemental Magic'].HighTierNuke.Critical = set_combine(sets.midcast['Elemental Magic'].HighTierNuke, {
  549.     --  neck="Nefarious Collar +1",ear1="Hecate's Earring",body="Count's Garb",ring1="Locus Ring",waist="Tengu-no-obi"})
  550.  
  551.     -- Impact: Elemental Magic skill
  552.     -- Debuffs do not decay or get resisted, but the 3 minute duration can be resisted.
  553.     sets.midcast.Impact = {ammo="Savant's Treatise",
  554.         head=empty,neck="Incanter's Torque",ear1="Strophadic Earring",ear2="Barkarole Earring",
  555.         body="Twilight Cloak",hands=gear.MerHands,ring1="Sangoma Ring",ring2="Archon Ring",
  556.         back="Lugh's Cape",waist="Refoccilation Stone",legs=gear.MerLegs,feet=gear.MerFeet}
  557.  
  558.     -- Meteor damage is non-elemental magic damage and is not affected positively or negatively by any weather/day effects or any damage or accuracy affinity staves.
  559.     -- Unlike other nukes, elemental magic skill contributes directly to Meteor base damage, and the damage is independent of the enemy's INT.
  560.     -- Excluding MDB and MDT effects, each BLM's base damage can be approximated as: (1+MAB/100)*floor(INT + Elemental Magic Skill/6)*3.5
  561.     sets.midcast.Meteor = {ammo="Pemphredo Tathlum",
  562.         head=gear.MerHead,neck="Sanctity Necklace",ear1="Strophadic Earring",ear2="Barkarole Earring",
  563.         body="Onca Suit",hands=empty,ring1="Shiva Ring +1",ring2="Metamorph Ring +1",
  564.         back="Lugh's Cape",waist="Eschan Stone",legs=empty,feet=empty}
  565.  
  566.  
  567.     --------------------------------------
  568.     -- Idle/resting/defense sets
  569.     --------------------------------------
  570.     -- body="Anhur Robe"
  571.     -- body=gear.GBody
  572.     sets.idle = {main="Akademos",sub="Enki Strap",ammo="Homiliary",
  573.         head=gear.GHead,neck="Loricate Torque +1",ear1="Ethereal Earring",ear2="Sanare Earring",
  574.         body=gear.GBody,hands=gear.GHands,ring1=gear.DarkRing,ring2="Defending Ring",
  575.         back="Solemnity Cape",waist="Slipor Sash",legs=gear.GLegs,feet="Herald's Gaiters"}
  576.  
  577.     sets.idle.PDT = set_combine(sets.idle, {})
  578.  
  579.     sets.idle.Town = set_combine(sets.idle, {})
  580.  
  581.     sets.idle.Stun = {ammo="Incantor Stone",
  582.         head=gear.VHead,neck="Orunmila's Torque",ear1="Enchanter Earring +1",ear2="Loquacious Earring",
  583.         body="Anhur Robe",hands=gear.GHands,ring1="Prolix Ring",ring2="Defending Ring",
  584.         back="Lugh's Cape",waist=gear.HasteBelt,legs=gear.TLegsEnh,feet=gear.RFeet}
  585.  
  586.     sets.idle.Weak = set_combine(sets.idle, {})
  587.  
  588.     -- Defense sets
  589.  
  590.     sets.defense.PDT = set_combine(sets.idle, {})
  591.  
  592.     sets.defense.MDT = set_combine(sets.idle, {})
  593.  
  594.     -- Resting sets
  595.     sets.resting = set_combine(sets.idle, sets.ExtraRefresh)
  596.  
  597.     --------------------------------------
  598.     -- Engaged sets
  599.     --------------------------------------
  600.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  601.     -- sets if more refined versions aren't defined.
  602.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  603.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  604.  
  605.     -- Normal melee group
  606.     sets.engaged = {
  607.         head=gear.THeadEnh,
  608.         body=gear.TBodyEnh,hands=gear.THandsEnh,
  609.         waist=gear.HasteBelt,legs=gear.TLegsEnh,feet=gear.TFeetEnh}
  610. end
  611.  
  612. -------------------------------------------------------------------------------------------------------------------
  613. -- Job-specific hooks for standard casting events.
  614. -------------------------------------------------------------------------------------------------------------------
  615. -- Run after the general precast() is done.
  616. function job_post_precast(spell, action, spellMap, eventArgs)
  617. -- commented out until these pieces are significantly better than the default gear
  618. --  if spell.action_type == 'Magic' then
  619. --      if (buffactive['Light Arts'] or buffactive['Dark Arts'] or buffactive['Addendum: White'] or buffactive['Addendum: Black'])
  620. --          and not (buffactive['Alacrity'] or buffactive['Manifestation'] or buffactive['Celerity'] or buffactive['Accession']) then
  621. --              if spell.english == 'Impact' then
  622. --                  equip(sets.GrimFC_Feet)
  623. --              elseif spell.english == 'Meteor' then
  624. --                  equip(sets.GrimFC_Head)
  625. --              else
  626. --                  equip(sets.GrimFC_Head)
  627. --                  equip(sets.GrimFC_Feet)
  628. --              end
  629. --      elseif buffactive['Alacrity'] and (spell.element == world.weather_element or spell_element == world.day_element) then
  630. --          equip(sets.buff['Alacrity'])
  631. --      elseif buffactive['Celerity'] and (spell.element == world.weather_element or spell_element == world.day_element) then
  632. --          equip(sets.buff['Celerity'])
  633. --      end
  634. --  end
  635. -- only this part of the previous function is relevant
  636.     if spell.action_type == 'Magic' then
  637.         if buffactive['Alacrity'] and (spell.element == world.weather_element or spell_element == world.day_element) then
  638.             equip(sets.buff['Alacrity'])
  639.         elseif buffactive['Celerity'] and (spell.element == world.weather_element or spell_element == world.day_element) then
  640.             equip(sets.buff['Celerity'])
  641.         end
  642.     end
  643.     if spell.type:lower() == 'weaponskill' then
  644.         if (player.tp > 1749 and player.tp < 2000) or (player.tp > 2749 and player.tp < 3000) then
  645.             equip(sets.Moonshade)
  646.         end
  647.     end
  648. end
  649.  
  650. -- Run after the general midcast() is done.
  651. function job_post_midcast(spell, action, spellMap, eventArgs)
  652.     if spell.action_type == 'Magic' then
  653. -- Not used for now, as Vanya Hood is best in all situations except capped haste
  654. -- Relic Feet are best with both uncapped haste and celerity with matching spell/weather bonus
  655. -- Relic head and Artifact feet are best for non-celerity/alacrity casts with capped haste ONLY
  656. --      if (buffactive['light arts'] or buffactive['dark arts'] or buffactive['addendum: white'] or buffactive['addendum: black']) then
  657. --          if not (buffactive['Alacrity'] or buffactive['Manifestation'] or buffactive['Celerity'] or buffactive['Accession']) then
  658. --              gear.FC_Head = {gear.RHead}
  659. --              gear.FC_Feet = {gear.AFFeet}
  660. --          elseif buffactive['Alacrity'] and (spell.element == world.weather_element or spell_element == world.day_element) then
  661. --              -- sets.buff['Alacrity'] = {feet=gear.RFeet}
  662. --              gear.FC_Feet = {gear.RFeet}
  663. --          elseif buffactive['Celerity'] and (spell.element == world.weather_element or spell_element == world.day_element) then
  664. --              -- sets.buff['Celerity'] = {feet=gear.RFeet}
  665. --              gear.FC_Feet = {gear.RFeet}
  666. --          else
  667. --              gear.FC_Head = {gear.VHead}
  668. --              gear.FC_Feet = {gear.RFeet}
  669. --          end
  670. --      end
  671.         if spell.skill == 'Elemental Magic' and spellMap ~= 'ElementalEnfeeble' and spell.english ~= 'Impact' and spell.english ~= 'Meteor' then
  672.             if buffactive['Immanence'] then
  673.                 if state.Skillchain.value ~= nil then
  674.                 equip(sets.midcast['Elemental Magic'].Chainbound)
  675.                 -- Turns off Chainbound
  676.                 -- comment out the reset line if you prefer to toggle Skillchain mode manually
  677.                 state.Skillchain:reset()
  678.             -- Equip Fast Recast for a standard Immanence cast
  679.                 else
  680.                     equip(sets.midcast.FastRecast)
  681.                 end
  682.             -- Equip a special set for SC bonus Immanence cast
  683.             elseif not buffactive['Immanence'] then
  684.                 if state.CastingMode.value ~= 'Resistant' then
  685.                     if spell.element == world.day_element or spell.element == world.weather_element then
  686.                         equip({waist="Hachirin-no-Obi"})
  687.                     end
  688.                     -- Equip a special set for MB
  689.                     if state.MagicBurst.value ~= nil then
  690.                         equip(sets.midcast['Elemental Magic'].Burst)
  691.                     end
  692.                     -- Turns off Burst
  693.                     -- comment out the reset line if you prefer to toggle MagicBurst mode manually
  694.                     state.MagicBurst:reset()
  695.                     -- Ebullience: Gives a 20% damage bonus to your next Black Magic.
  696.                     -- Empyrean head further increases the damage bonus
  697.                     if buffactive['Ebullience'] then
  698.                         equip(sets.buff['Ebullience'])
  699.                     end
  700.                     -- Klimaform: Increases the magic accuracy for spells of the same element as the current weather (not day).
  701.                     -- Empyrean feet increases magic damage of spells of the same element as the current weather by 10%
  702.                     -- (in a separate term from, and in addition to, the normal weather damage bonus)
  703.                     if buffactive['Klimaform'] and spell.element == world.weather_element then
  704.                         equip(sets.buff['Klimaform'])
  705.                     end
  706.                 end
  707.             end
  708.         end
  709.         -- Perpetuance: Increases the enhancement effect duration of your next white magic enhancing magic spell.
  710.         -- Empyrean hands further increase the duration
  711.         if buffactive['Perpetuance'] and spell.type =='WhiteMagic' and spell.skill == 'Enhancing Magic' then
  712.             equip(sets.buff['Perpetuance'])
  713.         end
  714.         -- Penury: Reduces the MP cost of your next White Magic spell by 50%
  715.         -- Empyrean legs force a Conserve MP proc on top of this ability.
  716.         if state.Buff.Penury then
  717.             equip(sets.buff['Penury'])
  718.         end
  719.         -- Parsimony: Reduces the MP cost of your next Black Magic spell by 50%
  720.         -- Empyrean legs force a Conserve MP proc on top of this ability.
  721.         if state.Buff.Parsimony then
  722.             equip(sets.buff['Parsimony'])
  723.         end
  724.         if spellMap == 'Cure' then
  725.             if buffactive['Aurorastorm'] or world.weather_element == 'Light' or world.day_element == 'Light' then
  726.                 equip(sets.ObiCure)
  727.             end
  728.             -- Rapture: Gives a potency boost to Healing Magic.
  729.             -- Empyrean head further increases the potency
  730.             if buffactive['Rapture'] then
  731.                 equip(sets.buff['Rapture'])
  732.             end
  733.         end
  734.         if spellMap == 'Refresh' and spell.target.type == 'SELF' then
  735.             equip(sets.SelfRefresh)
  736.         end
  737.     end
  738. end
  739.  
  740. -------------------------------------------------------------------------------------------------------------------
  741. -- Job-specific hooks for non-casting events.
  742. -------------------------------------------------------------------------------------------------------------------
  743.  
  744. -- Called when a player gains or loses a buff.
  745. -- buff == buff gained or lost
  746. -- gain == true if the buff was gained, false if it was lost.
  747. function job_buff_change(buff, gain)
  748.     if buff == "Sublimation: Activated" then
  749.         handle_equipping_gear(player.status)
  750.     end
  751.  
  752.     -- Check if we're in a Reive
  753.     if buff == "Reive Mark" then
  754.         if player.inventory[sets.buff['Reive Mark']] or player.wardrobe[sets.buff['Reive Mark']] or player.wardrobe2[sets.buff['Reive Mark']] or player.wardrobe3[sets.buff['Reive Mark']] or player.wardrobe4[sets.buff['Reive Mark']] then
  755.             if gain then
  756.                 equip(sets.buff['Reive Mark'])
  757.                 disable('neck')
  758.             elseif not gain then
  759.                 enable('neck')
  760.                 status_change(player.status)
  761.             end
  762.         end
  763.     end
  764. end
  765.  
  766. -- Handle notifications of general user state change.
  767. function job_state_change(stateField, newValue, oldValue)
  768.     if stateField == 'Idle Mode' then
  769.         if newValue == 'Stun' then
  770.             equip(sets.idle.Stun)
  771.             disable('head','body','hands','legs','feet')
  772.         else
  773.             enable('head','body','hands','legs','feet')
  774.         end
  775.     end
  776.     -- Lock gear that affects TP
  777.     if stateField == 'Offense Mode' then
  778.         if newValue == 'Normal' then
  779.             equip(sets.Offense)
  780.             disable('main','sub','range')
  781.         else
  782.             enable('main','sub','range')
  783.         end
  784.     end
  785.     -- Equip capacity point gear
  786.     if stateField == 'CP' then
  787.         if newValue ~= false then
  788.             equip(sets.CP)
  789.             disable('back','ring1')
  790.         else
  791.             enable('back','ring1')
  792.         end
  793.     end
  794. end
  795.  
  796. -------------------------------------------------------------------------------------------------------------------
  797. -- User code that supplements standard library decisions.
  798. -------------------------------------------------------------------------------------------------------------------
  799.  
  800. -- Custom spell mapping.
  801. function job_get_spell_map(spell, default_spell_map)
  802.     if spell.action_type == 'Magic' then
  803. --      if spell.skill == 'Elemental Magic' then
  804. --          if info.low_nukes:contains(spell.english) then
  805. --              return 'LowTierNuke'
  806. --          elseif info.high_nukes:contains(spell.english) then
  807. --              return 'HighTierNuke'
  808. --          end
  809. --      elseif spell.skill == "Enfeebling Magic" then
  810.         if spell.skill == "Enfeebling Magic" then
  811.             if spell.type == "WhiteMagic" then
  812.                 return "MndEnfeebles"
  813.             else
  814.                 return "IntEnfeebles"
  815.             end
  816.         end
  817.     end
  818. end
  819.  
  820. -- Called any time we attempt to handle automatic gear equips (ie: engaged or idle gear).
  821. function job_handle_equipping_gear(playerStatus, eventArgs)
  822. end
  823.  
  824. function customize_idle_set(idleSet)
  825.     if state.Buff['Sublimation: Activated'] then
  826.         if state.IdleMode.value == 'Normal' then
  827.             idleSet = set_combine(idleSet, sets.buff.FullSublimation)
  828.         elseif state.IdleMode.value == 'PDT' then
  829.             idleSet = set_combine(idleSet, sets.buff.PDTSublimation)
  830.         end
  831.     end
  832.  
  833.     if player.hpp < 80 then
  834.         idleSet = set_combine(idleSet, sets.ExtraRegen)
  835.     end
  836.  
  837.     if player.mpp < 86 then
  838.         if world.time >= (18*60) or world.time <= (6*60) then
  839.             idleSet = set_combine(idleSet, sets.NightRefresh)
  840.         else
  841.             idleSet = set_combine(idleSet, sets.DayRefresh)
  842.         end
  843.     end
  844.  
  845.     if areas.TOAU:contains(world.area) then
  846.         idleSet = set_combine(idleSet, sets.Sanction)
  847.     end
  848.  
  849.     if buffactive['Poison'] then
  850.         idleSet = set_combine(idleSet, sets.poison)
  851.     end
  852.  
  853.     if player.mpp < 51 then
  854.         idleSet = set_combine(idleSet, sets.latent_refresh)
  855.     end
  856.  
  857.     if buffactive["Dancer's Roll"] or buffactive["Evoker's Roll"] or buffactive["Corsair's Roll"] or buffactive["Bolter's Roll"] then
  858.         idleSet = set_combine(idleSet, sets.Roll)
  859.     end
  860.    
  861.     if buffactive["Fighter's Roll"] or buffactive["Rogue's Roll"] or buffactive["Hunter's Roll"] or buffactive["Chaos Roll"] then
  862.         idleSet = set_combine(idleSet, sets.Roll)
  863.     end
  864.    
  865.     if buffactive["Wizard's Roll"] or buffactive["Warlock's Roll"] or buffactive["Caster's Roll"] or buffactive["Courser's Roll"] then
  866.         idleSet = set_combine(idleSet, sets.Roll)
  867.     end
  868.    
  869.     if buffactive["Samurai Roll"] or buffactive["Blitzer's Roll"] or buffactive["Tactician's Roll"] or buffactive["Miser's Roll"] then
  870.         idleSet = set_combine(idleSet, sets.Roll)
  871.     end
  872.  
  873.     if not buffactive['Protect'] or not buffactive['Shell'] then
  874.         idleSet = set_combine(idleSet, sets.ProSh)
  875.     end
  876.  
  877.     return idleSet
  878. end
  879.  
  880. --function customize_melee_set(melee_set)
  881. --  return melee_set
  882. --end
  883.  
  884. -- Called by the 'update' self-command.
  885. function job_update(cmdParams, eventArgs)
  886.     if cmdParams[1] == 'user' and not (buffactive['light arts'] or buffactive['dark arts'] or buffactive['addendum: white'] or buffactive['addendum: black']) then
  887.         if state.IdleMode.value == 'Stun' then
  888.             send_command('@input /ja "Dark Arts" <me>')
  889.         else
  890.             send_command('@input /ja "Light Arts" <me>')
  891.         end
  892.     end
  893.  
  894.     update_active_strategems()
  895.     update_sublimation()
  896. end
  897.  
  898. -- Function to display the current relevant user state when doing an update.
  899. -- Return true if display was handled, and you don't want the default info shown.
  900. function display_current_job_state(eventArgs)
  901.     local msg = 'Scholar'
  902.  
  903.     if state.CombatForm.has_value then
  904.         msg = msg .. ' (' .. state.CombatForm.value .. ')'
  905.     end
  906.  
  907.     msg = msg .. ', Magic: ' .. state.CastingMode.value
  908.  
  909.     msg = msg .. ', Offense: ' .. state.OffenseMode.value
  910.  
  911.     if state.DefenseMode.value ~= 'None' then
  912.         msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
  913.     end
  914.  
  915.     if state.MagicBurst.value == true then
  916.         msg = msg .. ', Burst ON'
  917.     end
  918.  
  919.     if state.Skillchain.value == true then
  920.         msg = msg .. ', SC Damage ON'
  921.     end
  922.  
  923.     if state.Kiting.value == true then
  924.         msg = msg .. ', Kiting ON'
  925.     end
  926.  
  927.     if state.CP.value == true then
  928.         msg = msg .. ', CP ON'
  929.     end
  930.  
  931.     add_to_chat(122, msg)
  932.  
  933.     eventArgs.handled = true
  934. end
  935.  
  936. -------------------------------------------------------------------------------------------------------------------
  937. -- User code that supplements self-commands.
  938. -------------------------------------------------------------------------------------------------------------------
  939.  
  940. -- Called for direct player commands.
  941. function job_self_command(cmdParams, eventArgs)
  942.     if cmdParams[1]:lower() == 'scholar' then
  943.         handle_strategems(cmdParams)
  944.         eventArgs.handled = true
  945.     end
  946. end
  947.  
  948.  
  949. -------------------------------------------------------------------------------------------------------------------
  950. -- Utility functions specific to this job.
  951. -------------------------------------------------------------------------------------------------------------------
  952.  
  953. -- Reset the state vars tracking strategems.
  954. function update_active_strategems()
  955.     state.Buff['Ebullience'] = buffactive['Ebullience'] or false
  956.     state.Buff['Rapture'] = buffactive['Rapture'] or false
  957.     state.Buff['Perpetuance'] = buffactive['Perpetuance'] or false
  958.     state.Buff['Immanence'] = buffactive['Immanence'] or false
  959.     state.Buff['Penury'] = buffactive['Penury'] or false
  960.     state.Buff['Parsimony'] = buffactive['Parsimony'] or false
  961.     state.Buff['Celerity'] = buffactive['Celerity'] or false
  962.     state.Buff['Alacrity'] = buffactive['Alacrity'] or false
  963.  
  964.     state.Buff['Klimaform'] = buffactive['Klimaform'] or false
  965. end
  966.  
  967. function update_sublimation()
  968.     state.Buff['Sublimation: Activated'] = buffactive['Sublimation: Activated'] or false
  969. end
  970.  
  971.  
  972. -- General handling of strategems in an Arts-agnostic way.
  973. -- Format: gs c scholar <strategem>
  974. function handle_strategems(cmdParams)
  975.     -- cmdParams[1] == 'scholar'
  976.     -- cmdParams[2] == strategem to use
  977.  
  978.     if not cmdParams[2] then
  979.         add_to_chat(123,'Error: No strategem command given.')
  980.         return
  981.     end
  982.     local strategem = cmdParams[2]:lower()
  983.  
  984.     if strategem == 'light' then
  985.         if buffactive['light arts'] then
  986.             send_command('input /ja "Addendum: White" <me>')
  987.         elseif buffactive['addendum: white'] then
  988.             add_to_chat(122,'Error: Addendum: White is already active.')
  989.         else
  990.             send_command('input /ja "Light Arts" <me>')
  991.         end
  992.     elseif strategem == 'dark' then
  993.         if buffactive['dark arts'] then
  994.             send_command('input /ja "Addendum: Black" <me>')
  995.         elseif buffactive['addendum: black'] then
  996.             add_to_chat(122,'Error: Addendum: Black is already active.')
  997.         else
  998.             send_command('input /ja "Dark Arts" <me>')
  999.         end
  1000.     elseif buffactive['light arts'] or buffactive['addendum: white'] then
  1001.         if strategem == 'cost' then
  1002.             send_command('input /ja Penury <me>')
  1003.         elseif strategem == 'speed' then
  1004.             send_command('input /ja Celerity <me>')
  1005.         elseif strategem == 'aoe' then
  1006.             send_command('input /ja Accession <me>')
  1007.         elseif strategem == 'power' then
  1008.             send_command('input /ja Rapture <me>')
  1009.         elseif strategem == 'duration' then
  1010.             send_command('input /ja Perpetuance <me>')
  1011.         elseif strategem == 'accuracy' then
  1012.             send_command('input /ja Altruism <me>')
  1013.         elseif strategem == 'enmity' then
  1014.             send_command('input /ja Tranquility <me>')
  1015.         elseif strategem == 'skillchain' then
  1016.             add_to_chat(122,'Error: Light Arts does not have a skillchain strategem.')
  1017.         elseif strategem == 'addendum' then
  1018.             send_command('input /ja "Addendum: White" <me>')
  1019.         else
  1020.             add_to_chat(123,'Error: Unknown strategem ['..strategem..']')
  1021.         end
  1022.     elseif buffactive['dark arts'] or buffactive['addendum: black'] then
  1023.         if strategem == 'cost' then
  1024.             send_command('input /ja Parsimony <me>')
  1025.         elseif strategem == 'speed' then
  1026.             send_command('input /ja Alacrity <me>')
  1027.         elseif strategem == 'aoe' then
  1028.             send_command('input /ja Manifestation <me>')
  1029.         elseif strategem == 'power' then
  1030.             send_command('input /ja Ebullience <me>')
  1031.         elseif strategem == 'duration' then
  1032.             add_to_chat(122,'Error: Dark Arts does not have a duration strategem.')
  1033.         elseif strategem == 'accuracy' then
  1034.             send_command('input /ja Focalization <me>')
  1035.         elseif strategem == 'enmity' then
  1036.             send_command('input /ja Equanimity <me>')
  1037.         elseif strategem == 'skillchain' then
  1038.             send_command('input /ja Immanence <me>')
  1039.         elseif strategem == 'addendum' then
  1040.             send_command('input /ja "Addendum: Black" <me>')
  1041.         else
  1042.             add_to_chat(123,'Error: Unknown strategem ['..strategem..']')
  1043.         end
  1044.     else
  1045.         add_to_chat(123,'No arts has been activated yet.')
  1046.     end
  1047. end
  1048.  
  1049.  
  1050. -- Gets the current number of available strategems based on the recast remaining
  1051. -- and the level of the sch.
  1052. function get_current_strategem_count()
  1053.     -- returns recast in seconds.
  1054.     local allRecasts = windower.ffxi.get_ability_recasts()
  1055.     local stratsRecast = allRecasts[231]
  1056.  
  1057.     local maxStrategems = (player.main_job_level + 10) / 20
  1058.  
  1059.     local fullRechargeTime = 4*60
  1060.  
  1061.     local currentCharges = math.floor(maxStrategems - maxStrategems * stratsRecast / fullRechargeTime)
  1062.  
  1063.     return currentCharges
  1064. end
  1065.  
  1066. -- Select default macro book on initial load or subjob change.
  1067. function select_default_macro_book()
  1068.     set_macro_page(1, 17)
  1069. end
Advertisement
Add Comment
Please, Sign In to add comment