Skip to content

Commit

Permalink
Merge pull request #1 from wowsims/multi-school
Browse files Browse the repository at this point in the history
Update multi school names
  • Loading branch information
FelixPflaum authored Mar 5, 2024
2 parents 0677ca4 + fdd02fe commit b654564
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 44 deletions.
3 changes: 2 additions & 1 deletion proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum Profession {
}

// Keep in sync with sim/core/stats/stats.go.
// NextIndex: 44
enum Stat {
StatStrength = 0;
StatAgility = 1;
Expand Down Expand Up @@ -112,7 +113,7 @@ enum Stat {
StatNatureResistance = 38;
StatShadowResistance = 39;
StatBonusArmor = 40;
StatHealing = 41;
StatHealingPower = 41;
StatSpellDamage = 42;
StatFeralAttackPower = 43;
// DO NOT add new stats here without discussing it first; new stats come with
Expand Down
4 changes: 2 additions & 2 deletions sim/core/base_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ var BaseStats = map[BaseStatsKey]stats.Stats{}
// `octbasempbyclass.txt`, `combatratings.txt`, `chancetospellcritbase.txt`, etc.

var RaceOffsets = map[proto.Race]stats.Stats{
proto.Race_RaceUnknown: stats.Stats{},
proto.Race_RaceHuman: stats.Stats{},
proto.Race_RaceUnknown: {},
proto.Race_RaceHuman: {},
proto.Race_RaceOrc: {
stats.Agility: -3,
stats.Strength: 3,
Expand Down
4 changes: 2 additions & 2 deletions sim/core/consumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ func addImbueStats(character *Character, imbue proto.WeaponImbue, isMh bool, sha
})
case proto.WeaponImbue_BrilliantManaOil:
character.AddStats(stats.Stats{
stats.MP5: 12,
stats.Healing: 25,
stats.MP5: 12,
stats.HealingPower: 25,
})
case proto.WeaponImbue_BlackfathomManaOil:
character.AddStats(stats.Stats{
Expand Down
6 changes: 3 additions & 3 deletions sim/core/spell_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ func (spell *Spell) PhysicalCritCheck(sim *Simulation, attackTable *AttackTable)
func (spell *Spell) SpellPower() float64 {
return spell.Unit.GetStat(stats.SpellPower) +
spell.BonusSpellPower +
spell.SpellPowerSchool() +
spell.SpellSchoolPower() +
spell.Unit.PseudoStats.MobTypeSpellPower
}

func (spell *Spell) SpellDamage() float64 {
return spell.SpellPower() + spell.Unit.GetStat(stats.SpellDamage)
}

func (spell *Spell) SpellPowerSchool() float64 {
func (spell *Spell) SpellSchoolPower() float64 {
switch spell.SchoolIndex {
case stats.SchoolIndexNone:
return 0
Expand Down Expand Up @@ -212,7 +212,7 @@ func (spell *Spell) MagicCritCheck(sim *Simulation, target *Unit) bool {
}

func (spell *Spell) HealingPower(target *Unit) float64 {
return spell.SpellPower() + spell.Unit.GetStat(stats.Healing) + target.PseudoStats.BonusHealingTaken
return spell.SpellPower() + spell.Unit.GetStat(stats.HealingPower) + target.PseudoStats.BonusHealingTaken
}
func (spell *Spell) healingCritRating() float64 {
return spell.Unit.GetStat(stats.SpellCrit) + spell.BonusCritRating
Expand Down
94 changes: 75 additions & 19 deletions sim/core/spell_school.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,45 @@ const (
SpellSchoolNature
SpellSchoolShadow

SpellSchoolMagic = SpellSchoolArcane | SpellSchoolFire | SpellSchoolFrost | SpellSchoolHoly | SpellSchoolNature | SpellSchoolShadow
// Physical x Other
SpellSchoolSpellstrike = SpellSchoolPhysical | SpellSchoolArcane
SpellSchoolFlamestrike = SpellSchoolPhysical | SpellSchoolFire
SpellSchoolFroststrike = SpellSchoolPhysical | SpellSchoolFrost
SpellSchoolHolystrike = SpellSchoolPhysical | SpellSchoolHoly
SpellSchoolStormstrike = SpellSchoolPhysical | SpellSchoolNature
SpellSchoolShadowstrike = SpellSchoolPhysical | SpellSchoolShadow

// Arcane x Other
SpellSchoolSpellfire = SpellSchoolArcane | SpellSchoolFire
SpellSchoolSpellFrost = SpellSchoolArcane | SpellSchoolFrost
SpellSchoolDivine = SpellSchoolArcane | SpellSchoolHoly
SpellSchoolAstral = SpellSchoolArcane | SpellSchoolNature
SpellSchoolSpellShadow = SpellSchoolArcane | SpellSchoolShadow

// Fire x Other
SpellSchoolFrostfire = SpellSchoolFire | SpellSchoolFrost
SpellSchoolRadiant = SpellSchoolFire | SpellSchoolHoly
SpellSchoolVolcanic = SpellSchoolFire | SpellSchoolNature
SpellSchoolShadowflame = SpellSchoolFire | SpellSchoolShadow

// Frost x Other
SpellSchoolHolyfrost = SpellSchoolFrost | SpellSchoolHoly
SpellSchoolFroststorm = SpellSchoolFrost | SpellSchoolNature
SpellSchoolShadowfrost = SpellSchoolFrost | SpellSchoolShadow

// Holy x Other
SpellSchoolHolystorm = SpellSchoolHoly | SpellSchoolNature
SpellSchoolTwilight = SpellSchoolHoly | SpellSchoolShadow

// Nature x Other
SpellSchoolPlague = SpellSchoolNature | SpellSchoolShadow

SpellSchoolElemental = SpellSchoolFire | SpellSchoolFrost | SpellSchoolNature

SpellSchoolAttack = SpellSchoolPhysical |
SpellSchoolSpellstrike | SpellSchoolFlamestrike | SpellSchoolFroststrike | SpellSchoolHolystrike | SpellSchoolStormstrike | SpellSchoolShadowstrike

SpellSchoolArcaneFire = SpellSchoolArcane | SpellSchoolFire
SpellSchoolArcaneFrost = SpellSchoolArcane | SpellSchoolFrost
SpellSchoolFireFrost = SpellSchoolFire | SpellSchoolFrost
SpellSchoolFireShadow = SpellSchoolFire | SpellSchoolShadow
SpellSchoolFrostShadow = SpellSchoolFrost | SpellSchoolShadow
SpellSchoolPhysicalNature = SpellSchoolPhysical | SpellSchoolNature
SpellSchoolNatureShadow = SpellSchoolNature | SpellSchoolShadow
SpellSchoolPhysicalShadow = SpellSchoolPhysical | SpellSchoolShadow
SpellSchoolMagic = SpellSchoolArcane | SpellSchoolFire | SpellSchoolFrost | SpellSchoolHoly | SpellSchoolNature | SpellSchoolShadow
)

// Get associated school mask for a school index.
Expand All @@ -42,14 +71,41 @@ var schoolIndexToSchoolMask = [stats.SchoolLen]SpellSchool{
SpellSchoolHoly,
SpellSchoolNature,
SpellSchoolShadow,
SpellSchoolArcaneFire,
SpellSchoolArcaneFrost,
SpellSchoolFireFrost,
SpellSchoolFireShadow,
SpellSchoolFrostShadow,
SpellSchoolPhysicalNature,
SpellSchoolNatureShadow,
SpellSchoolPhysicalShadow,

// Physical x Other
SpellSchoolSpellstrike,
SpellSchoolFlamestrike,
SpellSchoolFroststrike,
SpellSchoolHolystrike,
SpellSchoolStormstrike,
SpellSchoolShadowstrike,

// Arcane x Other
SpellSchoolSpellfire,
SpellSchoolSpellFrost,
SpellSchoolDivine,
SpellSchoolAstral,
SpellSchoolSpellShadow,

// Fire x Other
SpellSchoolFrostfire,
SpellSchoolRadiant,
SpellSchoolVolcanic,
SpellSchoolShadowflame,

// Frost x Other
SpellSchoolHolyfrost,
SpellSchoolFroststorm,
SpellSchoolShadowfrost,

// Holy x Other
SpellSchoolHolystorm,
SpellSchoolTwilight,

// Nature x Other
SpellSchoolPlague,

SpellSchoolElemental,
}

var schoolMaskToIndex = func() map[SpellSchool]stats.SchoolIndex {
Expand All @@ -67,7 +123,7 @@ var schoolIndexToIndices = func() [stats.SchoolLen][]stats.SchoolIndex {
for schoolIndex := stats.SchoolIndexNone; schoolIndex < stats.SchoolLen; schoolIndex++ {
multiMask := SpellSchoolFromIndex(schoolIndex)
indexArr := []stats.SchoolIndex{}
for baseSchoolIndex := stats.SchoolIndexNone; baseSchoolIndex < stats.SchoolIndexMultiSchoolStart; baseSchoolIndex++ {
for baseSchoolIndex := stats.SchoolIndexNone; baseSchoolIndex < stats.PrimarySchoolLen; baseSchoolIndex++ {
schoolFlag := SpellSchoolFromIndex(baseSchoolIndex)
if multiMask.Matches(schoolFlag) {
indexArr = append(indexArr, baseSchoolIndex)
Expand All @@ -89,7 +145,7 @@ func (spell *Spell) GetSchoolBaseIndices() []stats.SchoolIndex {

// Check if school index is a multi-school.
func IsMultiSchoolIndex(schoolIndex stats.SchoolIndex) bool {
return schoolIndex >= stats.SchoolIndexMultiSchoolStart
return schoolIndex >= stats.PrimarySchoolLen
}

// Get spell school mask from school index.
Expand Down
2 changes: 1 addition & 1 deletion sim/core/stats/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var safeDepsOrder = []Stat{
RangedAttackPower,
SpellPower,
SpellDamage,
Healing,
HealingPower,
Health,
Mana,
MP5,
Expand Down
52 changes: 40 additions & 12 deletions sim/core/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ const (
NatureResistance
ShadowResistance
BonusArmor
Healing
HealingPower
SpellDamage
FeralAttackPower

// DO NOT add new stats here without discussing it first; new stats come with
// a performance penalty.

Expand Down Expand Up @@ -109,15 +110,42 @@ const (
SchoolIndexNature
SchoolIndexShadow

SchoolIndexMultiSchoolStart
SchoolIndexArcaneFire SchoolIndex = iota - 1
SchoolIndexArcaneFrost
SchoolIndexFireFrost
SchoolIndexFireShadow
SchoolIndexFrostShadow
SchoolIndexPhysicalNature
SchoolIndexNatureShadow
SchoolIndexPhysicalShadow
PrimarySchoolLen

// Physical x Other
SchoolIndexSpellstrike SchoolIndex = iota - 1
SchoolIndexFlamestrike
SchoolIndexFroststrike
SchoolIndexHolystrike
SchoolIndexStormstrike
SchoolIndexShadowstrike

// Arcane x Other
SchoolIndexSpellfire
SchoolIndexSpellFrost
SchoolIndexDivine
SchoolIndexAstral
SchoolIndexSpellShadow

// Fire x Other
SchoolIndexFrostfire
SchoolIndexRadiant
SchoolIndexVolcanic
SchoolIndexShadowflame

// Frost x Other
SchoolIndexHolyfrost
SchoolIndexFroststorm
SchoolIndexShadowfrost

// Holy x Other
SchoolIndexHolystorm
SchoolIndexTwilight

// Nature x Other
SchoolIndexPlague

SchoolIndexElemental

SchoolLen
)
Expand Down Expand Up @@ -168,8 +196,8 @@ func (s Stat) StatName() string {
return "ShadowPower"
case SpellDamage:
return "SpellDamage"
case Healing:
return "Healing"
case HealingPower:
return "HealingPower"
case SpellHaste:
return "SpellHaste"
case MP5:
Expand Down
2 changes: 1 addition & 1 deletion sim/druid/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func init() {

triggeredDmgSpell := character.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 436481},
SpellSchool: core.SpellSchoolPhysicalNature,
SpellSchool: core.SpellSchoolStormstrike,
ProcMask: core.ProcMaskEmpty,

// TODO: "Causes additional threat" in Tooltip, no clue what the multiplier is.
Expand Down
2 changes: 1 addition & 1 deletion sim/priest/mind_spike.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (priest *Priest) newMindSpikeSpellConfig() core.SpellConfig {

return core.SpellConfig{
ActionID: core.ActionID{SpellID: int32(proto.PriestRune_RuneWaistMindSpike)},
SpellSchool: core.SpellSchoolFrostShadow,
SpellSchool: core.SpellSchoolShadowfrost,
ProcMask: core.ProcMaskSpellDamage,
Flags: core.SpellFlagAPL,

Expand Down
2 changes: 1 addition & 1 deletion sim/shaman/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func init() {

spell := character.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 436413},
SpellSchool: core.SpellSchoolNatureShadow,
SpellSchool: core.SpellSchoolPlague,
ProcMask: core.ProcMaskSpellDamage,
Flags: core.SpellFlagAPL,

Expand Down
2 changes: 1 addition & 1 deletion sim/warrior/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func init() {

spell := character.RegisterSpell(core.SpellConfig{
ActionID: actionId,
SpellSchool: core.SpellSchoolPhysicalShadow,
SpellSchool: core.SpellSchoolShadowstrike,
ProcMask: core.ProcMaskSpellDamage,
Flags: core.SpellFlagAPL,

Expand Down

0 comments on commit b654564

Please sign in to comment.