Skip to content

Commit

Permalink
triggered spell tooltip improvement, add judgement
Browse files Browse the repository at this point in the history
  • Loading branch information
coolmodi committed Nov 20, 2020
1 parent e6f9c49 commit 88990c4
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 19 deletions.
9 changes: 7 additions & 2 deletions UI/tooltip/SCTooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,18 @@ GameTooltip:SetScript("OnTooltipSetSpell", function(self)
local sname = GetSpellInfo(spellID);

if isTriggerEffect then
-- TODO: should be displayed as if it's the 2nd effect
if calcedEffect.spellData[2] ~= nil then
_addon:PrintError("Triggered spell on "..sname.." has 2 effects, this is not supported for tooltips! Please report.");
return;
end
calcedEffect.spellData[2] = calcedEffect.spellData[1];
for _, func in ipairs(tooltipHandler) do
if func(calcedEffect.spellData, 1, isHeal, spellID) then
if func(calcedEffect.spellData, 2, isHeal, spellID) then
isHandled = true;
break;
end
end
calcedEffect.spellData[2] = nil;
elseif dummyHandler[sname] ~= nil then
dummyHandler[sname](calcedSpell, i);
isHandled = true;
Expand Down
1 change: 1 addition & 0 deletions constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ _addon.EFFECT_TYPE = {
--- Defense type (Decides mitigation types used)
---@class SpellDefenseType
_addon.DEF_TYPE = {
NONE = 0,
MAGIC = 1,
MELEE = 2,
RANGED = 3
Expand Down
41 changes: 26 additions & 15 deletions core/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ local function CalcSpell(spellId, calcedSpell, parentSpellData, parentEffCastTim
calcedSpell.meleeMitigation.glancing = glancing;
calcedSpell.meleeMitigation.glancingDmg = glancingDmg;
end
else
elseif spellBaseInfo.defType == DEF_TYPE.RANGED then
local hit, _, _, _, block, hitBonus = meleeCalc:GetMDPGB();
calcedSpell.hitChance = math.min(100, hit + hitBonus);
calcedSpell.hitChanceBase = hit;
Expand All @@ -352,6 +352,9 @@ local function CalcSpell(spellId, calcedSpell, parentSpellData, parentEffCastTim
glancing = 0,
glancingDmg = 0,
};
else
calcedSpell.hitChance = 100;
calcedSpell.hitChanceBase = 100;
end
end

Expand Down Expand Up @@ -521,22 +524,30 @@ local function CalcSpell(spellId, calcedSpell, parentSpellData, parentEffCastTim
-- Handle triggered spell effect
-- TODO: for dmg spells use mitigation (NOT RESIST) values from triggering spell in triggered spell calc

if stats.spellTriggerSpellEffect[spellId] ~= nil then
if stats.spellTriggerSpellEffect[spellId].val > 0 then
_addon:PrintDebug("Add triggered spell "..stats.spellTriggerSpellEffect[spellId].val.." on spell "..spellId);
local triggeredId = _addon:GetHandledSpellID(stats.spellTriggerSpellEffect[spellId].val);
if not triggeredId then
_addon:PrintError("Spell "..spellId.." has added trigger effect "..stats.spellTriggerSpellEffect[spellId].val.." but that spell isn't handled!");
else
local triggeredSpell;
if calcedSpell[2] and calcedSpell[2].effectFlags == SPELL_EFFECT_FLAGS.TRIGGERED_SPELL then
triggeredSpell = calcedSpell[2].spellData;
do
local triggerFromSpell = spellId;
if spellId == _addon.judgementSpell then
triggerFromSpell = _addon.JUDGEMENT_ID;
end

if stats.spellTriggerSpellEffect[triggerFromSpell] ~= nil then
local triggeredSpellId = stats.spellTriggerSpellEffect[triggerFromSpell].val;
if triggeredSpellId > 0 then
_addon:PrintDebug("Add triggered spell "..triggeredSpellId.." on spell "..spellId);
local triggeredId = _addon:GetHandledSpellID(triggeredSpellId);
if not triggeredId then
_addon:PrintError("Spell "..spellId.." has added trigger effect "..triggeredSpellId.." but that spell isn't handled!");
else
local triggeredSpell;
if calcedSpell[2] and calcedSpell[2].effectFlags == SPELL_EFFECT_FLAGS.TRIGGERED_SPELL then
triggeredSpell = calcedSpell[2].spellData;
end
calcedSpell:SetTriggeredSpell(CalcSpell(triggeredId, triggeredSpell, calcedSpell, effCastTime));
end
calcedSpell:SetTriggeredSpell(CalcSpell(triggeredId, triggeredSpell, calcedSpell, effCastTime));
elseif calcedSpell[2] and calcedSpell[2].effectFlags == SPELL_EFFECT_FLAGS.TRIGGERED_SPELL then
_addon:PrintDebug("Remove triggered effect from spell "..spellId);
calcedSpell:UnsetTriggeredSpell();
end
elseif calcedSpell[2] and calcedSpell[2].effectFlags == SPELL_EFFECT_FLAGS.TRIGGERED_SPELL then
_addon:PrintDebug("Remove triggered effect from spell "..spellId);
calcedSpell:UnsetTriggeredSpell();
end
end

Expand Down
21 changes: 21 additions & 0 deletions data/itemSetData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ _addon.itemSetData = {
},
}
},
[217] = {
name = "Judgement Armor",
effects = {
[1] = {
need = 8,
effect = {
effect = _addon.EFFECT_TYPE.TRIGGER_SPELL_EFFECT,
affectSpell = {8388608, 0, 0, 0},
value = 23590,
}
},
}
},
[301] = {
name = "Champion's Earthshaker",
effects = {
Expand Down Expand Up @@ -511,6 +524,14 @@ _addon.setItemData = {
[16949] = 216,
[16947] = 216,
[16946] = 216,
[16952] = 217,
[16951] = 217,
[16958] = 217,
[16955] = 217,
[16956] = 217,
[16954] = 217,
[16957] = 217,
[16953] = 217,
[16519] = 301,
[16518] = 301,
[16522] = 301,
Expand Down
4 changes: 2 additions & 2 deletions tools/spelldata_creator/ItemSetCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ class AuraHandlers
value: "_addon.BUFF_CONDITIONS.EARTHSHATTERER_8PCS"
}
case 22009: // Greater Heal (Renew)
case 23590: // Judgement (Dmg proc)
return {
effect: ADDON_EFFECT_TYPE.TRIGGER_SPELL_EFFECT,
affectSpell: this.getAffectSpell(effect),
value: 22009
value: effect.EffectTriggerSpell
}
case 28839:
// TODO: these
case 23590: // Judgement (Dmg proc)
case 28788: // Your Cleanse spell also heals the target for 200.
case 28815: // Revealed Flaw
return;
Expand Down

0 comments on commit 88990c4

Please sign in to comment.