Skip to content

Commit

Permalink
Merge pull request #88 from InDebt/shadow
Browse files Browse the repository at this point in the history
[Shadow] Alpha Release
  • Loading branch information
InDebt authored Apr 16, 2024
2 parents a7a0c09 + 5177e2e commit 11b1d8a
Show file tree
Hide file tree
Showing 34 changed files with 1,666 additions and 1,234 deletions.
2 changes: 1 addition & 1 deletion assets/database/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -15790,7 +15790,7 @@
{"effectId":4088,"spellId":74231,"name":"Enchant Chest - Exceptional Spirit","type":5,"stats":[0,0,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":4089,"spellId":74232,"name":"Enchant Bracer - Precision","type":6,"stats":[0,0,0,0,0,0,0,50,0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":4090,"spellId":74234,"name":"Enchant Cloak - Protection","type":4,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":4091,"spellId":74235,"name":"Enchant Off-Hand - Superior Intellect","type":13,"enchantType":2,"stats":[0,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":4091,"spellId":74235,"name":"Enchant Off-Hand - Superior Intellect","type":13,"enchantType":5,"stats":[0,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":4092,"spellId":74236,"name":"Enchant Boots - Precision","type":10,"stats":[0,0,0,0,0,0,0,50,0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":4093,"spellId":74237,"name":"Enchant Bracer - Exceptional Spirit","type":6,"stats":[0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":4094,"spellId":74238,"name":"Enchant Boots - Mastery","type":10,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50],"quality":1},
Expand Down
8 changes: 4 additions & 4 deletions sim/common/cata/enchant_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,10 @@ func init() {
},
},

ApplyEffects: func(sim *core.Simulation, unit *core.Unit, _ *core.Spell) {
intStat := unit.GetStat(stats.Intellect)
strStat := unit.GetStat(stats.Strength)
agiStat := unit.GetStat(stats.Agility)
ApplyEffects: func(sim *core.Simulation, _ *core.Unit, _ *core.Spell) {
intStat := character.GetStat(stats.Intellect)
strStat := character.GetStat(stats.Strength)
agiStat := character.GetStat(stats.Agility)
if intStat > strStat && intStat > agiStat {
intAura.Activate(sim)
} else if agiStat > intStat && agiStat > strStat {
Expand Down
4 changes: 2 additions & 2 deletions sim/common/cata/other_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func init() {
dot.CalcAndDealPeriodicSnapshotDamage(sim, target, dot.OutcomeSnapshotCrit)
if sim.Proc(0.1, "Vengeful Wisp") {
// select random proc target
spreadTarget := sim.Encounter.TargetUnits[int(sim.Roll(0, float64(len(sim.Encounter.TargetUnits))-1))]
spreadTarget := sim.Encounter.TargetUnits[int(sim.Roll(0, float64(len(sim.Encounter.TargetUnits))))]

// refresh dot on next step - refreshing potentially on aura expire
// which will cause nasty things to happen
Expand Down Expand Up @@ -129,7 +129,7 @@ func init() {

if sim.Proc(0.1, "Vengeful Wisp") {
// select random proc target
spreadTarget := sim.Encounter.TargetUnits[int(sim.Roll(0, float64(len(sim.Encounter.TargetUnits))-1))]
spreadTarget := sim.Encounter.TargetUnits[int(sim.Roll(0, float64(len(sim.Encounter.TargetUnits))))]
spreadDot.Dot(spreadTarget).Apply(sim) // refresh self on
}
},
Expand Down
34 changes: 34 additions & 0 deletions sim/core/spell_mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ const (
// Add/subtract to the casts gcd
// Uses: TimeValue
SpellMod_GlobalCooldown_Flat

// Add/substrct to the base tick frequency
// Uses: TimeValue
SpellMod_DotTickLength_Flat
)

var spellModMap = map[SpellModType]*SpellModFunctions{
Expand Down Expand Up @@ -282,6 +286,10 @@ var spellModMap = map[SpellModType]*SpellModFunctions{
Apply: applyGlobalCooldownFlat,
Remove: removeGlobalCooldownFlat,
},
SpellMod_DotTickLength_Flat: {
Apply: applyDotTickLengthFlat,
Remove: removeDotTickLengthFlat,
},
}

func applyDamageDonePercent(mod *SpellMod, spell *Spell) {
Expand Down Expand Up @@ -401,3 +409,29 @@ func applyGlobalCooldownFlat(mod *SpellMod, spell *Spell) {
func removeGlobalCooldownFlat(mod *SpellMod, spell *Spell) {
spell.DefaultCast.GCD -= mod.timeValue
}

func applyDotTickLengthFlat(mod *SpellMod, spell *Spell) {
if spell.dots != nil {
for _, dot := range spell.dots {
if dot != nil {
dot.TickLength += mod.timeValue
}
}
}
if spell.aoeDot != nil {
spell.aoeDot.TickLength += mod.timeValue
}
}

func removeDotTickLengthFlat(mod *SpellMod, spell *Spell) {
if spell.dots != nil {
for _, dot := range spell.dots {
if dot != nil {
dot.TickLength -= mod.timeValue
}
}
}
if spell.aoeDot != nil {
spell.aoeDot.TickLength -= mod.timeValue
}
}
17 changes: 6 additions & 11 deletions sim/core/spell_resistances.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,30 +87,25 @@ func (at *AttackTable) GetArmorDamageModifier(spell *Spell) float64 {
- the resist cap is likely gone, since resists work like armor now
https://web.archive.org/web/20110209210726/http://elitistjerks.com/f75/t38540-general_mage_discussion_information/p11/#post1171056
This handles the player vs. mob partial resists case
- average resist is still 2% percent per level vs. higher level mobs
- otherwise it's modelled identical to the mob vs. player case
- it's modelled identical to the mob vs. player case
- the resulting numbers have been verified in game (55% for 0%, 30% for 10%, 15% for 20% resists)
*/

func (unit *Unit) averageResist(school SpellSchool, attacker *Unit) float64 {
resistance := unit.GetStat(school.ResistanceStat()) - attacker.stats[stats.SpellPenetration]
if resistance <= 0 {
return unit.levelBasedResist(attacker)

// https://wowpedia.fandom.com/wiki/Resistance?oldid=6512353
// With the release of cataclysm, level based resistances seem to have been removed
return 0
}

c := 5 * float64(attacker.Level)
if attacker.Type == EnemyUnit && attacker.Level-unit.Level >= 3 {
c = 510 // other values TBD, but not very useful in practice
}

return resistance/(c+resistance) + unit.levelBasedResist(attacker) // these may stack differently, but that's irrelevant in practice
}

func (unit *Unit) levelBasedResist(attacker *Unit) float64 {
if unit.Type == EnemyUnit && unit.Level > attacker.Level {
return 0.02 * float64(unit.Level-attacker.Level)
}
return 0
return resistance / (c + resistance)
}

type Threshold struct {
Expand Down
3 changes: 2 additions & 1 deletion sim/core/spell_resistances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func Test_PartialResistsVsBoss(t *testing.T) {
chance = th.cumulativeChance
}

expectedAr := 0.06 + resist/(400+resist)
// no more level based resists
expectedAr := resist / (400 + resist)

if math.Abs(resultingAr-expectedAr) > 1e-9 {
t.Errorf("resist = %.2f, thresholds = %s, resultingAr = %.2f%%, expectedAr = %.2f%%", resist, thresholds, resultingAr, expectedAr)
Expand Down
Loading

0 comments on commit 11b1d8a

Please sign in to comment.