Skip to content

Commit

Permalink
AQ Spell Rank Toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguinerarogue committed Dec 4, 2024
1 parent b22ad57 commit 16208fd
Show file tree
Hide file tree
Showing 41 changed files with 244 additions and 230 deletions.
1 change: 1 addition & 0 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ message SimOptions {
bool save_all_values = 7; // Only used internally.
bool interactive = 8; // Enables interactive mode.
bool use_labeled_rands = 9; // Use test level RNG.
bool use_aq_spell_ranks = 10;
}

// The aggregated results from all uses of a particular action.
Expand Down
2 changes: 2 additions & 0 deletions proto/ui.proto
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ message SimSettings {
string language = 9;
Faction faction = 6;
DatabaseFilters filters = 10;
bool use_aq_spell_ranks = 12;

}

// Contains all information that is imported/exported from an individual sim.
Expand Down
112 changes: 64 additions & 48 deletions sim/core/buffs.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ var BuffSpellValues = map[BuffName]stats.Stats{
AspectOfTheWild: {
stats.NatureResistance: 60,
},
BattleShout: {
stats.AttackPower: TernaryFloat64(IncludeAQ, 232, 193),
},
BlessingOfMight: {
stats.AttackPower: TernaryFloat64(IncludeAQ, 185, 155),
},
BlessingOfWisdom: {
stats.MP5: TernaryFloat64(IncludeAQ, 33, 30),
},
HornOfLordaeron: {
stats.Strength: TernaryFloat64(IncludeAQ, 89, 70.15),
stats.Agility: TernaryFloat64(IncludeAQ, 89, 70.15),
},
BloodPact: {
stats.Stamina: 42,
},
Expand All @@ -83,9 +70,6 @@ var BuffSpellValues = map[BuffName]stats.Stats{
DevotionAura: {
stats.BonusArmor: 735,
},
GraceOfAir: {
stats.Agility: TernaryFloat64(IncludeAQ, 77, 67),
},
FireResistanceAura: {
stats.FireResistance: 60,
},
Expand Down Expand Up @@ -126,9 +110,6 @@ var BuffSpellValues = map[BuffName]stats.Stats{
ShadowResistanceAura: {
stats.ShadowResistance: 60,
},
StrengthOfEarth: {
stats.Strength: TernaryFloat64(IncludeAQ, 77, 61),
},
ScrollOfAgility: {
stats.Agility: 17,
},
Expand Down Expand Up @@ -379,11 +360,7 @@ func applyBuffEffects(agent Agent, playerFaction proto.Faction, raidBuffs *proto
}

if individualBuffs.BlessingOfWisdom > 0 && isAlliance {
updateStats := BuffSpellValues[BlessingOfWisdom]
if individualBuffs.BlessingOfWisdom == proto.TristateEffect_TristateEffectImproved {
updateStats = updateStats.Multiply(1.2)
}
character.AddStats(updateStats)
MakePermanent(BlessingOfWisdomAura(&character.Unit, GetTristateValueInt32(individualBuffs.BlessingOfWisdom, 0, 2)))
} else if raidBuffs.ManaSpringTotem > 0 && isHorde {
updateStats := BuffSpellValues[ManaSpring]
if raidBuffs.ManaSpringTotem == proto.TristateEffect_TristateEffectImproved {
Expand Down Expand Up @@ -1334,11 +1311,14 @@ const ReplenishmentAuraDuration = time.Second * 15
})
} */

const StrengthOfEarthTotemRanks = 5
var StrengthOfEarthTotemSpellId = [StrengthOfEarthTotemRanks + 1]int32{0, 8075, 8160, 8161, 10442, 25361}
var StrengthOfEarthStrength = [StrengthOfEarthTotemRanks + 1]float64{0, 10, 20, 36, 61, 77}

func StrengthOfEarthTotemAura(unit *Unit, multiplier float64) *Aura {
rank := TernaryInt32(IncludeAQ, 5, 4)
spellID := []int32{0, 8075, 8160, 8161, 10442, 25361}[rank]
spellID := TernaryInt32(unit.Env.UseAQSpellRanks, 25361, 10442)
duration := time.Minute * 2
updateStats := BuffSpellValues[StrengthOfEarth].Multiply(multiplier).Floor()
bonusStrength := math.Floor(TernaryFloat64(unit.Env.UseAQSpellRanks, 77, 61) * multiplier)

aura := unit.GetOrRegisterAura(Aura{
Label: "Strength of Earth Totem",
Expand All @@ -1347,27 +1327,30 @@ func StrengthOfEarthTotemAura(unit *Unit, multiplier float64) *Aura {
BuildPhase: CharacterBuildPhaseBuffs,
OnGain: func(aura *Aura, sim *Simulation) {
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
unit.AddStats(updateStats)
unit.AddStat(stats.Strength, bonusStrength)
} else {
unit.AddStatsDynamic(sim, updateStats)
unit.AddStatDynamic(sim, stats.Strength, bonusStrength)
}
},
OnExpire: func(aura *Aura, sim *Simulation) {
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
unit.AddStats(updateStats.Multiply(-1))
unit.AddStat(stats.Strength, -bonusStrength)
} else {
unit.AddStatsDynamic(sim, updateStats.Multiply(-1))
unit.AddStatDynamic(sim, stats.Strength, -bonusStrength)
}
},
})
return aura
}

const GraceOfAirTotemRanks = 3
var GraceOfAirTotemSpellId = [GraceOfAirTotemRanks + 1]int32{0, 8835, 10627, 25359}
var GraceOfAirTotemAgility = [GraceOfAirTotemRanks + 1]float64{0, 43, 67, 77}

func GraceOfAirTotemAura(unit *Unit, multiplier float64) *Aura {
rank := TernaryInt32(IncludeAQ, 3, 2)
spellID := []int32{0, 8835, 10627, 25359}[rank]
duration := time.Minute * 2
updateStats := BuffSpellValues[GraceOfAir].Multiply(multiplier).Floor()
bonusAgi := math.Floor(TernaryFloat64(unit.Env.UseAQSpellRanks, 77, 67) * multiplier)
spellID := TernaryInt32(unit.Env.UseAQSpellRanks, 25359, 10627)

aura := unit.GetOrRegisterAura(Aura{
Label: "Grace of Air Totem",
Expand All @@ -1376,16 +1359,16 @@ func GraceOfAirTotemAura(unit *Unit, multiplier float64) *Aura {
BuildPhase: CharacterBuildPhaseBuffs,
OnGain: func(aura *Aura, sim *Simulation) {
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
unit.AddStats(updateStats)
unit.AddStat(stats.Agility, bonusAgi)
} else {
unit.AddStatsDynamic(sim, updateStats)
unit.AddStatDynamic(sim, stats.Agility, bonusAgi)
}
},
OnExpire: func(aura *Aura, sim *Simulation) {
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
unit.AddStats(updateStats.Multiply(-1))
unit.AddStat(stats.Agility, -bonusAgi)
} else {
unit.AddStatsDynamic(sim, updateStats.Multiply(-1))
unit.AddStatDynamic(sim, stats.Agility, -bonusAgi)
}
},
})
Expand All @@ -1399,24 +1382,28 @@ var BattleShoutBaseAP = [BattleShoutRanks + 1]float64{0, 20, 40, 57, 93, 138, 19
var BattleShoutLevel = [BattleShoutRanks + 1]int{0, 1, 12, 22, 32, 42, 52, 60}

func BattleShoutAura(unit *Unit, impBattleShout int32, boomingVoicePts int32) *Aura {
rank := TernaryInt32(IncludeAQ, 7, 6)
rank := TernaryInt32(unit.Env.UseAQSpellRanks, 7, 6)
spellId := BattleShoutSpellId[rank]
baseAP := BattleShoutBaseAP[rank]
bshoutAP := math.Floor(BattleShoutBaseAP[rank] * (1 + 0.05*float64(impBattleShout)))

return unit.GetOrRegisterAura(Aura{
Label: "Battle Shout",
ActionID: ActionID{SpellID: spellId},
Duration: time.Duration(float64(time.Minute*2) * (1 + 0.1*float64(boomingVoicePts))),
BuildPhase: CharacterBuildPhaseBuffs,
OnGain: func(aura *Aura, sim *Simulation) {
aura.Unit.AddStatsDynamic(sim, stats.Stats{
stats.AttackPower: math.Floor(baseAP * (1 + 0.05*float64(impBattleShout))),
})
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
aura.Unit.AddStat(stats.AttackPower, bshoutAP)
} else {
aura.Unit.AddStatDynamic(sim, stats.AttackPower, bshoutAP)
}
},
OnExpire: func(aura *Aura, sim *Simulation) {
aura.Unit.AddStatsDynamic(sim, stats.Stats{
stats.AttackPower: -1 * math.Floor(baseAP*(1+0.05*float64(impBattleShout))),
})
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
aura.Unit.AddStat(stats.AttackPower, -bshoutAP)
} else {
aura.Unit.AddStatDynamic(sim, stats.AttackPower, -bshoutAP)
}
},
})
}
Expand All @@ -1442,9 +1429,9 @@ func TrueshotAura(unit *Unit) *Aura {
}

func BlessingOfMightAura(unit *Unit, impBomPts int32) *Aura {
spellID := TernaryInt32(IncludeAQ, 25291, 19838)
spellID := TernaryInt32(unit.Env.UseAQSpellRanks, 25291, 19838)

bonusAP := math.Floor(BuffSpellValues[BlessingOfMight][stats.AttackPower] * (1 + 0.04*float64(impBomPts)))
bonusAP := math.Floor(TernaryFloat64(unit.Env.UseAQSpellRanks, 185, 155) * (1 + 0.04*float64(impBomPts)))

aura := MakePermanent(unit.GetOrRegisterAura(Aura{
Label: "Blessing of Might",
Expand All @@ -1463,6 +1450,35 @@ func BlessingOfMightAura(unit *Unit, impBomPts int32) *Aura {
return aura
}

func BlessingOfWisdomAura(unit *Unit, impBowPts int32) *Aura {
spellID := TernaryInt32(unit.Env.UseAQSpellRanks, 25290, 19854)

bonusMP5 := math.Floor(TernaryFloat64(unit.Env.UseAQSpellRanks, 33, 30) * (1 + 0.10*float64(impBowPts)))

aura := MakePermanent(unit.GetOrRegisterAura(Aura{
Label: "Blessing of Wisdom",
ActionID: ActionID{SpellID: spellID},
Duration: NeverExpires,
BuildPhase: CharacterBuildPhaseBuffs,
OnGain: func(aura *Aura, sim *Simulation) {
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
aura.Unit.AddStat(stats.MP5, bonusMP5)
} else {
aura.Unit.AddStatDynamic(sim, stats.MP5, bonusMP5)
}
},
OnExpire: func(aura *Aura, sim *Simulation) {
if aura.Unit.Env.MeasuringStats && aura.Unit.Env.State != Finalized {
aura.Unit.AddStat(stats.MP5, -bonusMP5)
} else {
aura.Unit.AddStatDynamic(sim, stats.MP5, -bonusMP5)
}
},
}))

return aura
}

// TODO: Are there exclusive AP buffs in SoD?
// func attackPowerBonusEffect(aura *Aura, apBonus float64) *ExclusiveEffect {
// return aura.NewExclusiveEffect("AttackPowerBonus", false, ExclusiveEffect{
Expand Down
7 changes: 0 additions & 7 deletions sim/core/config.go

This file was deleted.

1 change: 1 addition & 0 deletions sim/core/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Environment struct {
// Whether stats are currently being measured. Used to disable some validation
// checks which are otherwise helpful.
MeasuringStats bool
UseAQSpellRanks bool

Raid *Raid
Encounter Encounter
Expand Down
1 change: 1 addition & 0 deletions sim/core/sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func runSim(rsr *proto.RaidSimRequest, progress chan *proto.ProgressMetrics, ski

func NewSim(rsr *proto.RaidSimRequest, signals simsignals.Signals) *Simulation {
env, _, _ := NewEnvironment(rsr.Raid, rsr.Encounter, false)
env.UseAQSpellRanks = rsr.SimOptions.UseAqSpellRanks
return newSimWithEnv(env, rsr.SimOptions, signals)
}

Expand Down
6 changes: 5 additions & 1 deletion sim/druid/starfire.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ var StarfireLevel = [StarfireRanks + 1]int{0, 20, 26, 34, 42, 50, 58, 60}
func (druid *Druid) registerStarfireSpell() {
druid.Starfire = make([]*DruidSpell, StarfireRanks+1)

maxRank := core.TernaryInt(core.IncludeAQ, StarfireRanks, StarfireRanks-1)
maxRank := StarfireRanks
if !druid.Env.UseAQSpellRanks {
maxRank -= 1
}

for rank := 1; rank <= maxRank; rank++ {
config := druid.newStarfireSpellConfig(rank)

Expand Down
5 changes: 4 additions & 1 deletion sim/hunter/aspects.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ func (hunter *Hunter) getMaxAspectOfTheHawkAttackPower(rank int) float64 {
}

func (hunter *Hunter) getMaxHawkRank() int {
maxRank := core.TernaryInt(core.IncludeAQ, 7, 6)
maxRank := 7
if !hunter.Env.UseAQSpellRanks {
maxRank -= 1
}

for i := maxRank; i > 0; i-- {
config := hunter.getAspectOfTheHawkSpellConfig(i)
Expand Down
5 changes: 4 additions & 1 deletion sim/hunter/multi_shot.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ func (hunter *Hunter) getMultiShotConfig(rank int, timer *core.Timer) core.Spell
}

func (hunter *Hunter) registerMultiShotSpell(timer *core.Timer) {
maxRank := core.TernaryInt(core.IncludeAQ, 5, 4)
maxRank := 5
if !hunter.Env.UseAQSpellRanks {
maxRank -= 1
}
for rank := 1; rank <= maxRank; rank++ {
config := hunter.getMultiShotConfig(rank, timer)

Expand Down
5 changes: 4 additions & 1 deletion sim/hunter/serpent_sting.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ func (hunter *Hunter) chimeraShotSerpentStingSpell(rank int) *core.Spell {
func (hunter *Hunter) registerSerpentStingSpell() {
hunter.SerpentStingAPCoeff = 0

maxRank := core.TernaryInt(core.IncludeAQ, 9, 8)
maxRank := 9
if !hunter.Env.UseAQSpellRanks {
maxRank -= 1
}
for rank := maxRank; rank >= 0; rank-- {
config := hunter.getSerpentStingConfig(rank)

Expand Down
6 changes: 5 additions & 1 deletion sim/mage/arcane_missiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ func (mage *Mage) registerArcaneMissilesSpell() {
mage.ArcaneMissiles = make([]*core.Spell, ArcaneMissilesRanks+1)
mage.ArcaneMissilesTickSpell = make([]*core.Spell, ArcaneMissilesRanks+1)

// TODO AQ <=
maxRank := ArcaneMissilesRanks
if !mage.Env.UseAQSpellRanks {
maxRank -= 1
}

for rank := 1; rank < ArcaneMissilesRanks; rank++ {
config := mage.getArcaneMissilesSpellConfig(rank)

Expand Down
5 changes: 4 additions & 1 deletion sim/mage/fireball.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ var FireballLevel = [FireballRanks + 1]int{0, 1, 6, 12, 18, 24, 30, 36, 42, 48,
func (mage *Mage) registerFireballSpell() {
mage.Fireball = make([]*core.Spell, FireballRanks+1)

maxRank := core.TernaryInt(core.IncludeAQ, FireballRanks, FireballRanks-1)
maxRank := FireballRanks
if !mage.Env.UseAQSpellRanks {
maxRank -= 1
}
for rank := 1; rank <= maxRank; rank++ {
config := mage.newFireballSpellConfig(rank)

Expand Down
5 changes: 4 additions & 1 deletion sim/mage/frostbolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ var FrostboltLevel = [FrostboltRanks + 1]int{0, 4, 8, 14, 20, 26, 32, 38, 44, 50
func (mage *Mage) registerFrostboltSpell() {
mage.Frostbolt = make([]*core.Spell, FrostboltRanks+1)

maxRank := core.TernaryInt(core.IncludeAQ, FrostboltRanks, FrostboltRanks-1)
maxRank := FrostboltRanks
if !mage.Env.UseAQSpellRanks {
maxRank -= 1
}
for rank := 1; rank <= maxRank; rank++ {
config := mage.getFrostboltConfig(rank)

Expand Down
4 changes: 2 additions & 2 deletions sim/rogue/backstab.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ func (rogue *Rogue) registerBackstabSpell() {
25: 32,
40: 60,
50: 90,
60: core.TernaryFloat64(core.IncludeAQ, 150, 140),
60: core.TernaryFloat64(rogue.Env.UseAQSpellRanks, 210, 225),
}[rogue.Level]

spellID := map[int32]int32{
25: 2590,
40: 8721,
50: 11279,
60: core.TernaryInt32(core.IncludeAQ, 25300, 11281),
60: core.TernaryInt32(rogue.Env.UseAQSpellRanks, 25300, 11281),
}[rogue.Level]

damageMultiplier := 1.5 * []float64{1, 1.04, 1.08, 1.12, 1.16, 1.2}[rogue.Talents.Opportunity]
Expand Down
4 changes: 2 additions & 2 deletions sim/rogue/poisons.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ func (rogue *Rogue) registerDeadlyPoisonSpell() {
25: 9,
40: 13,
50: 20,
60: 27,
60: core.TernaryFloat64(rogue.Env.UseAQSpellRanks, 34, 27),
}[rogue.Level]
spellID := map[int32]int32{
25: 2823,
40: 2824,
50: 11355,
60: 11356,
60: core.TernaryInt32(rogue.Env.UseAQSpellRanks, 25351, 11356),
}[rogue.Level]

rogue.deadlyPoisonTick = rogue.RegisterSpell(core.SpellConfig{
Expand Down
Loading

0 comments on commit 16208fd

Please sign in to comment.