Skip to content

Commit

Permalink
cap avgresist, add option for real doom value
Browse files Browse the repository at this point in the history
  • Loading branch information
coolmodi committed Oct 23, 2019
1 parent 267dd23 commit 111938d
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 67 deletions.
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,37 @@ A WoW classic addon providing information for spells, like actual damage done, c
## This is very much in an alpha state

* Priest should work fine
* Mage and WL should work, mage 99% untested, WL should be somewhat better off
* All other classes won't work at all!
* Spells from other caster classes should also work, this excludes special spells like seals!
* Warrior, Hunter and Rogue have no support at all

Math and logic may or may not be correct, at all. Currently observed values for priest seem to be correct for me though. Consider using `/console scriptErrors 1` when using (testing) this.

I learned that multiple effect modifiers (e.g. Piercing Ice and Improved Cone of Cold) are multiplicative and not additive. Didn't catch that because priest doesn't really have that (shadow form + darkness works correct already). If that is indeed a rule then some things will be off slightly atm. Need to investigate.
## Features that are supposed to work for magic spells

## Features that are supposed to work
* Spell power scaling.
* Talents that affect supported spells are handled.
* Crit and hit chance based on gear, talents and buffs.
* Average damage resisted or additional miss chance for binary spells.
* Use target or set level difference for hit chance and resistance calculation.
* DPS and HPS values after all of the above.
* DPM, HPM, and done until OOM values after factoring in spirit regen (while casting), MP5 and other mana returns. Additionally can use a set HPS target for heals to show values with casting breaks.
* Can show some values on the action bar.

* Spell power scaling
* Consideres talents that **aren't included** in the tooltip/API by default
* Crit and hit chance based on gear/talents/buffs, uses target level or set level difference
* Average damage resisted, and additional resist (miss) chance for binary spells
* DPS and HPS values after all of the above
* DPM and HPM, also done until OOM values (theoretical, including partial casts!)
* Factors in spirit regen (while casting) and MP5, additionally can use a set HPS target for heals to show values with casting breaks
* Can show some values on the action bar

It should be easy to add/implement missing buffs/items/talents/effects. I just need to know what is missing or wrong.
It should be easy to add/implement missing buffs/items/talents/effects or fix incorrect ones. I just need to know what is missing or wrong.

`/sc` will show a window with all the stats used (intended for debug, it's not pretty)

`/sc debug` will toggle debug output

There is a settings menu in the interface options addons tab.

## Not yet working but planned
* Things that are not a priest, mage or WL
* Maybe use hardcoded values for all spell ranks to not have to use tooltip values at all, preventing all the problems with inconsistent talent/buff behaviour
* Support for melee/ranged spells
* Using target for debuffs (e.g. Shadow Weaving) or things like troll beast dmg, low prio
* Resistance and armor mitigation, very low prio
## Planned
* Special spells like seals and totems.
* More options for actionbar values.
* Better tooltips.
* Support for melee/ranged spells.
* Using target for debuffs (e.g. Shadow Weaving) or things like troll beast dmg, low prio.
* Resistance (custom values can be set) and armor mitigation, very low prio.

## Some examples
![example](images/example1.png)
Expand Down
2 changes: 1 addition & 1 deletion UI/TooltipDisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ local function AppendEfficiency(calcData, effectNum, isHeal, showTime)

if SpellCalc_settings.ttToOom then
if showTime then
GameTooltip:AddLine(("%s: %d (%ds)"):format(L["TT_UNTILOOM_"..unitPart], effectData.doneToOom, calcData.timeToOom), TTCOLOR, TTCOLOR, TTCOLOR);
GameTooltip:AddLine(("%s: %d (%.1fs, %.1f casts)"):format(L["TT_UNTILOOM_"..unitPart], effectData.doneToOom, calcData.timeToOom, calcData.castsToOom), TTCOLOR, TTCOLOR, TTCOLOR);
else
GameTooltip:AddLine(("%s: %d"):format(L["TT_UNTILOOM_"..unitPart], effectData.doneToOom), TTCOLOR, TTCOLOR, TTCOLOR);
end
Expand Down
12 changes: 8 additions & 4 deletions core/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,20 @@ function _addon:CalcSpell(spellId)
end
end

local effMana = stats.mana;
-- TODO: remove this?
calcData.effMana = stats.mana;
if _addon.test_innervate then
-- Need to remove 20 sec of manaReg because we added it with the effective cost
effMana = effMana + (stats.baseManaReg * 80) - (20 * stats.manaReg);
calcData.effMana = calcData.effMana + (stats.baseManaReg * 80) - (20 * stats.manaReg);
end
if _addon.test_manapot then
effMana = effMana + _addon.test_manapot;
calcData.effMana = calcData.effMana + _addon.test_manapot;
end

calcData.castsToOom = effMana / calcData.effectiveCost;
calcData.castsToOom = calcData.effMana / calcData.effectiveCost;
if SpellCalc_settings.useRealToOom then
calcData.castsToOom = math.floor(calcData.castsToOom);
end
calcData.timeToOom = calcData.castsToOom * castTime;
else
-- NYI
Expand Down
7 changes: 5 additions & 2 deletions core/spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function _addon:GetSpellAvgResist(school)
local pLevel = UnitLevel("player");
local baseRes = tData.resistance[school];
local effectiveRes = baseRes + math.max((tData.level - pLevel)*5, 0) - math.min(baseRes, self.stats.spellPen[school].val);
return 0.75 * (effectiveRes / math.max(pLevel * 5, 100));
return math.min(0.75 * (effectiveRes / math.max(pLevel * 5, 100)), 0.75);
end

--- Get level based spell hit chance against the current target
Expand Down Expand Up @@ -219,7 +219,10 @@ function _addon:CalculateSpellDirectEffect(calcData, et, spellRankInfo, effectDa
et.secNoCastTHPS = secondsNoCast;
et.effCostTHPS = calcData.effectiveCost - manaGained;
et.perManaTHPS = et.avgAfterMitigation / et.effCostTHPS;
local ctoTHPS = (calcData.castsToOom * calcData.effectiveCost) / et.effCostTHPS;
local ctoTHPS = calcData.effMana / et.effCostTHPS;
if SpellCalc_settings.useRealToOom then
calcData.castsToOom = math.floor(ctoTHPS);
end
et.timeToOomTHPS = ctoTHPS * (castTime + secondsNoCast);
et.doneToOomTHPS = ctoTHPS * et.avgAfterMitigation;
end
Expand Down
34 changes: 19 additions & 15 deletions i18n/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@ local _addonName, _addon = ...;
local L = _addon:AddLocalization("enUS", true);
if L == nil then return; end

L["SETTINGS_HEAD_TOOLTIP"] = "Tooltip";
L["SETTINGS_HEAD_CALC"] = "Calculation";
L["SETTINGS_CALC_REAL_OOM"] = "Real until OOM";
L["SETTINGS_CALC_REAL_OOM_TT"] = "Show real done until oom value. That means until mana<spellcost instead of 0.";

L["SETTINGS_HEAD_TARGET"] = "Target";
L["SETTINGS_TAR_DEFLEVEL_LABEL"] = "Default level difference";
L["SETTINGS_TT_USECURRENT_LABEL"] = "Use current target";
L["SETTINGS_TT_USECURRENT_TT"] = "If possible use target's level instead.";

L["SETTINGS_HEAD_RESISTANCE"] = "Custom Resistance Values";

L["SETTINGS_TT_FROST_LABEL"] = "Frost";
L["SETTINGS_TT_FIRE_LABEL"] = "Fire";
L["SETTINGS_TT_SHADOW_LABEL"] = "Shadow";
L["SETTINGS_TT_NATURE_LABEL"] = "Nature";
L["SETTINGS_TT_ARCANE_LABEL"] = "Arcane";

L["SETTINGS_TOOLTIP_TITLE"] = "Tooltip";
L["SETTINGS_HEAD_TOOLTIP"] = "Values to show in tooltip";
L["SETTINGS_TT_HITVAL_LABEL"] = "Hit value";
L["SETTINGS_TT_CRIT_LABEL"] = "Critical";
L["SETTINGS_TT_AVG_LABEL"] = "Averages";
Expand All @@ -25,20 +42,7 @@ L["SETTINGS_TT_OOM_LABEL"] = "Done until oom";
L["SETTINGS_TT_BUFFS_LABEL"] = "Show buffs";
L["SETTINGS_TT_BUFFS_TT"] = "Show buffs/gear/talents affecting the spell calculation. This doesn't include things that the addon doesn't need to explicitly handle!";

L["SETTINGS_HEAD_TARGET"] = "Target";

L["SETTINGS_TAR_DEFLEVEL_LABEL"] = "Default level difference";
L["SETTINGS_TT_USECURRENT_LABEL"] = "Use current target";
L["SETTINGS_TT_USECURRENT_TT"] = "Use target's level instead if possible";

L["SETTINGS_HEAD_RESISTANCE"] = "Custom Resistance Values";

L["SETTINGS_TT_FROST_LABEL"] = "Frost";
L["SETTINGS_TT_FIRE_LABEL"] = "Fire";
L["SETTINGS_TT_SHADOW_LABEL"] = "Shadow";
L["SETTINGS_TT_NATURE_LABEL"] = "Nature";
L["SETTINGS_TT_ARCANE_LABEL"] = "Arcane";

L["SETTINGS_AB_TITLE"] = "Actionbar";
L["SETTINGS_AB_HEAD"] = "Actionbar button value";
L["SETTINGS_AB_SHOW"] = "Show values on actionbar";
L["SETTINGS_AB_DIRECT_VALUE"] = "Direct";
Expand Down
57 changes: 32 additions & 25 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ local DEFAULTSETTINGS = {
["firstStart"] = true,
["debug"] = false,

["useRealToOom"] = false,

["ttHit"] = true,
["ttCrit"] = true,
["ttAverages"] = true,
Expand Down Expand Up @@ -84,33 +86,11 @@ function _addon:SetupSettings()

local settings = _addon:GetSettingsBuilder();
settings:Setup(SpellCalc_settings, DEFAULTSETTINGS);

settings:SetBeforeSaveCallback(BeforeSave);
settings:SetAfterSaveCallback(AfterSave);

settings:MakeHeading(L["SETTINGS_HEAD_TOOLTIP"]);

local row = settings:MakeSettingsRow(1);
settings:MakeCheckboxOption("ttHit", L["SETTINGS_TT_HITVAL_LABEL"], nil, row);
settings:MakeCheckboxOption("ttCrit", L["SETTINGS_TT_CRIT_LABEL"], nil, row);
settings:MakeCheckboxOption("ttAverages", L["SETTINGS_TT_AVG_LABEL"], nil, row);
row = settings:MakeSettingsRow(1);
settings:MakeCheckboxOption("ttPower", L["SETTINGS_TT_POWER_LABEL"], L["SETTINGS_TT_POWER_TT"], row);
settings:MakeCheckboxOption("ttCoef", L["SETTINGS_TT_COEF_LABEL"], nil, row);
row = settings:MakeSettingsRow(1);
settings:MakeCheckboxOption("ttHitChance", L["SETTINGS_TT_HITCHANCE_LABEL"], nil, row);
settings:MakeCheckboxOption("ttHitDetail", L["SETTINGS_TT_HITCHANCE_DETAIL_LABEL"], L["SETTINGS_TT_HITCHANCE_DETAIL_TT"], row);
settings:MakeCheckboxOption("ttResist", L["SETTINGS_TT_RESISTANCE_LABEL"], L["SETTINGS_TT_RESISTANCE_TT"], row);
row = settings:MakeSettingsRow();
settings:MakeCheckboxOption("ttPerSecond", L["SETTINGS_TT_PERSEC_LABEL"], nil, row);
row = settings:MakeSettingsRow(1);
settings:MakeCheckboxOption("ttEffCost", L["SETTINGS_TT_EFFCOST_LABEL"], L["SETTINGS_TT_EFFCOST_TT"], row);
settings:MakeCheckboxOption("ttPerMana", L["SETTINGS_TT_PERMANA_LABEL"], nil, row);
settings:MakeCheckboxOption("ttToOom", L["SETTINGS_TT_OOM_LABEL"], nil, row);
row = settings:MakeSettingsRow(1);
settings:MakeCheckboxOption("ttShowBuffs", L["SETTINGS_TT_BUFFS_LABEL"], L["SETTINGS_TT_BUFFS_TT"], row);

settings:UpdateRowGroup(1);
settings:MakeHeading(L["SETTINGS_HEAD_CALC"]);
settings:MakeCheckboxOption("useRealToOom", L["SETTINGS_CALC_REAL_OOM"], L["SETTINGS_CALC_REAL_OOM_TT"]);

settings:MakeHeading(L["SETTINGS_HEAD_TARGET"]);

Expand All @@ -125,9 +105,35 @@ function _addon:SetupSettings()
settings:MakeEditBoxOption("resOverrideNature", L["SETTINGS_TT_NATURE_LABEL"], 3, true, nil, nil, nil, 66);
settings:MakeEditBoxOption("resOverrideArcane", L["SETTINGS_TT_ARCANE_LABEL"], 3, true, nil, nil, nil, 66);

-- Tooltip settings
local settingsTt = _addon:GetSettingsBuilder();
settingsTt:Setup(SpellCalc_settings, DEFAULTSETTINGS, L["SETTINGS_TOOLTIP_TITLE"], nil, nil, nil, nil, nil, nil, _addonName);
settingsTt:SetAfterSaveCallback(AfterSave);
settingsTt:MakeHeading(L["SETTINGS_HEAD_TOOLTIP"]);
local row = settingsTt:MakeSettingsRow(1);
settingsTt:MakeCheckboxOption("ttHit", L["SETTINGS_TT_HITVAL_LABEL"], nil, row);
settingsTt:MakeCheckboxOption("ttCrit", L["SETTINGS_TT_CRIT_LABEL"], nil, row);
settingsTt:MakeCheckboxOption("ttAverages", L["SETTINGS_TT_AVG_LABEL"], nil, row);
row = settingsTt:MakeSettingsRow(1);
settingsTt:MakeCheckboxOption("ttPower", L["SETTINGS_TT_POWER_LABEL"], L["SETTINGS_TT_POWER_TT"], row);
settingsTt:MakeCheckboxOption("ttCoef", L["SETTINGS_TT_COEF_LABEL"], nil, row);
row = settingsTt:MakeSettingsRow(1);
settingsTt:MakeCheckboxOption("ttHitChance", L["SETTINGS_TT_HITCHANCE_LABEL"], nil, row);
settingsTt:MakeCheckboxOption("ttHitDetail", L["SETTINGS_TT_HITCHANCE_DETAIL_LABEL"], L["SETTINGS_TT_HITCHANCE_DETAIL_TT"], row);
settingsTt:MakeCheckboxOption("ttResist", L["SETTINGS_TT_RESISTANCE_LABEL"], L["SETTINGS_TT_RESISTANCE_TT"], row);
row = settingsTt:MakeSettingsRow();
settingsTt:MakeCheckboxOption("ttPerSecond", L["SETTINGS_TT_PERSEC_LABEL"], nil, row);
row = settingsTt:MakeSettingsRow(1);
settingsTt:MakeCheckboxOption("ttEffCost", L["SETTINGS_TT_EFFCOST_LABEL"], L["SETTINGS_TT_EFFCOST_TT"], row);
settingsTt:MakeCheckboxOption("ttPerMana", L["SETTINGS_TT_PERMANA_LABEL"], nil, row);
settingsTt:MakeCheckboxOption("ttToOom", L["SETTINGS_TT_OOM_LABEL"], nil, row);
row = settingsTt:MakeSettingsRow(1);
settingsTt:MakeCheckboxOption("ttShowBuffs", L["SETTINGS_TT_BUFFS_LABEL"], L["SETTINGS_TT_BUFFS_TT"], row);
settingsTt:UpdateRowGroup(1);

-- Action bar settings
local settingsAb = _addon:GetSettingsBuilder();
settingsAb:Setup(SpellCalc_settings, DEFAULTSETTINGS, "Actionbar", nil, nil, nil, nil, nil, nil, _addonName);
settingsAb:Setup(SpellCalc_settings, DEFAULTSETTINGS, L["SETTINGS_AB_TITLE"], nil, nil, nil, nil, nil, nil, _addonName);
settingsAb:SetAfterSaveCallback(AfterSave);
settingsAb:MakeHeading(L["SETTINGS_AB_HEAD"]);
settingsAb:MakeCheckboxOption("abShow", L["SETTINGS_AB_SHOW"]);
Expand All @@ -146,6 +152,7 @@ function _addon:SetupSettings()
}
end, 100);


if self.ClassSettings ~= nil then
local settingsClass = _addon:GetSettingsBuilder();
settingsClass:Setup(SpellCalc_settings, DEFAULTSETTINGS, classLoc, nil, nil, nil, nil, nil, nil, _addonName);
Expand Down

0 comments on commit 111938d

Please sign in to comment.