From 968e58bc5038f03d94730949d1bc65e6c0ade286 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 27 Apr 2014 04:39:56 +0000 Subject: [PATCH] Priest: Add shadow script based on SimC profile. Implement a hidden buff for SimC's shadow_word_death_reset_cooldown that is added whenever the priest casts Shadow Word: Death and fails to kill the target. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1339 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Ovale.toc | 1 + OvaleShadowWordDeath.lua | 96 ++++++++++++++++ OvaleSimulationCraft.lua | 18 ++- scripts/files.xml | 2 + scripts/ovale_priest.lua | 229 +++++++++++++++++++++++++++++++++++++++ scripts/ovale_priest_spells.lua | 91 ++++++++++++++++ 6 files changed, 433 insertions(+), 4 deletions(-) create mode 100644 OvaleShadowWordDeath.lua create mode 100644 scripts/ovale_priest.lua create mode 100644 scripts/ovale_priest_spells.lua diff --git a/Ovale.toc b/Ovale.toc index 9c5e9a8..9790818 100644 --- a/Ovale.toc +++ b/Ovale.toc @@ -61,6 +61,7 @@ OvaleEclipse.lua OvaleEnemies.lua OvaleRecount.lua OvaleRunes.lua +OvaleShadowWordDeath.lua OvaleSkada.lua OvaleSpellDamage.lua OvaleSteadyFocus.lua diff --git a/OvaleShadowWordDeath.lua b/OvaleShadowWordDeath.lua new file mode 100644 index 0000000..6d44de0 --- /dev/null +++ b/OvaleShadowWordDeath.lua @@ -0,0 +1,96 @@ +--[[-------------------------------------------------------------------- + Ovale Spell Priority + Copyright (C) 2014 Johnny C. Lam + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License in the LICENSE + file accompanying this program. +--]]------------------------------------------------------------------- + +local _, Ovale = ... +local OvaleShadowWordDeath = Ovale:NewModule("OvaleShadowWordDeath", "AceEvent-3.0") +Ovale.OvaleShadowWordDeath = OvaleShadowWordDeath + +--[[ + Shadow Word: Death description from wowhead.com: + + If the target does not die, the cooldown is reset, but this additional + Shadow Word: Death does not grant a Shadow Orb. This effect has a 9 second + cooldown. + + Add a hidden buff when the player casts Shadow Word: Death and the target does + not die. +--]] + +-- +-- Forward declarations for module dependencies. +local OvaleAura = nil + +local API_GetTime = GetTime +local API_UnitClass = UnitClass +local API_UnitGUID = UnitGUID + +-- Player's class. +local _, self_class = API_UnitClass("player") +-- Player's GUID. +local self_guid = nil + +-- Shadow Word: Death spell IDs. +local SHADOW_WORD_DEATH = { + [ 32379] = true, + [129176] = true, +} +-- + +-- +OvaleShadowWordDeath.name = "Shadow Word: Death Reset Cooldown" +OvaleShadowWordDeath.spellId = 157218 -- spell ID to use for the hidden buff +OvaleShadowWordDeath.start = 0 +OvaleShadowWordDeath.ending = 0 +OvaleShadowWordDeath.duration = 9 +OvaleShadowWordDeath.stacks = 0 +-- + +-- +function OvaleShadowWordDeath:OnInitialize() + -- Resolve module dependencies. + OvaleAura = Ovale.OvaleAura +end + +function OvaleShadowWordDeath:OnEnable() + if self_class == "OvaleShadowWordDeath" then + self_guid = API_UnitGUID("player") + self:RegisterMessage("Ovale_SpecializationChanged") + end +end + +function OvaleShadowWordDeath:OnDisable() + if self_class == "OvaleShadowWordDeath" then + self:UnregisterMessage("Ovale_SpecializationChanged") + end +end + +function OvaleShadowWordDeath:Ovale_SpecializationChanged(event, specialization, previousSpecialization) + if specialization == "shadow" then + self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + else + self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + end +end + +function OvaleShadowWordDeath:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, cleuEvent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...) + local arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23 = ... + if sourceGUID == self_guid then + if cleuEvent == "SPELL_DAMAGE" then + local spellId, overkill = arg12, arg16 + if SHADOW_WORD_DEATH[spellId] and not (overkill and overkill > 0) then + local now = API_GetTime() + self.start = atTime + self.ending = atTime + self.duration + self.stacks = 1 + OvaleAura:GainedAuraOnGUID(self_guid, self.start, self.spellId, self_guid, "HELPFUL", nil, nil, self.stacks, nil, self.duration, self.ending, nil, self.name, nil, nil, nil) + end + end + end +end +-- diff --git a/OvaleSimulationCraft.lua b/OvaleSimulationCraft.lua index 41e8011..a8e7d29 100644 --- a/OvaleSimulationCraft.lua +++ b/OvaleSimulationCraft.lua @@ -274,6 +274,11 @@ do ["guardian_of_ancient_kings"] = "guardian_of_ancient_kings_melee", }, }, + priest = { + shadow = { + ["arcane_torrent"] = "arcane_torrent_mana", + }, + }, shaman = { elemental = { ["ascendance"] = "ascendance_caster", @@ -450,6 +455,7 @@ do or scriptLine.sync or action == "focus_fire" and scriptLine.five_stacks == 1 or action == "kill_command" + or action == "mind_flay_insanity" or action == "stance" and scriptLine.choose or scriptLine.weapon then @@ -483,15 +489,19 @@ do end tinsert(scriptLine, "BuffStacks(frenzy_buff any=1) == 5") needAnd = true - end - if action == "kill_command" then + elseif action == "kill_command" then if needAnd then tinsert(scriptLine, "and") end tinsert(scriptLine, "pet.Present()") needAnd = true - end - if action == "stance" and scriptLine.choose then + elseif action == "mind_flay_insanity" then + if needAnd then + tinsert(scriptLine, "and") + end + tinsert(scriptLine, "target.DebuffPresent(devouring_plague_debuff)") + needAnd = true + elseif action == "stance" and scriptLine.choose then if needAnd then tinsert(scriptLine, "and") end diff --git a/scripts/files.xml b/scripts/files.xml index f9b7dd0..24c6070 100644 --- a/scripts/files.xml +++ b/scripts/files.xml @@ -10,6 +10,8 @@