Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warrior baseline spells #43

Merged
merged 43 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7c050e7
Implement shouts and adjust related raid buffs
Swillis57 Mar 25, 2024
b54c5f4
Berserker Rage
Swillis57 Mar 25, 2024
e82fa69
Bloodrage removed, replaced by rage gen on shouts
Swillis57 Mar 25, 2024
2c163d5
_execute.go -> execute.go
Swillis57 Mar 25, 2024
4ee18a2
Execute
Swillis57 Mar 25, 2024
d9877e6
_demoralizing_shout -> demoralizing_shout
Swillis57 Mar 25, 2024
4efb5c8
Demo shout
Swillis57 Mar 25, 2024
254d2eb
_heroic_strike_cleave -> heroic_strike_cleave
Swillis57 Mar 25, 2024
221698b
Heroic Strike + Cleave
Swillis57 Mar 25, 2024
c597e6c
_heroic_throw -> heroic_throw
Swillis57 Mar 25, 2024
bbb0b4f
Heroic Throw
Swillis57 Mar 25, 2024
ea3e477
_overpower -> overpower
Swillis57 Mar 25, 2024
2b68f00
Overpower
Swillis57 Mar 25, 2024
f5e99e4
_recklessness -> recklessness
Swillis57 Mar 25, 2024
aea7a61
Recklessness
Swillis57 Mar 26, 2024
fcca6e9
_rend -> rend
Swillis57 Mar 26, 2024
6fa9d2b
Rend
Swillis57 Mar 26, 2024
e6d00cd
_revenge -> revenge
Swillis57 Mar 26, 2024
15ad96e
Revenge
Swillis57 Mar 26, 2024
28eec5b
_shattering_throw -> shattering_throw
Swillis57 Mar 26, 2024
a06565a
Shattering Throw
Swillis57 Mar 26, 2024
a58aa49
_shield_block -> shield_block
Swillis57 Mar 26, 2024
84c8369
Pull target-specific avoidance calculations into their own functions
Swillis57 Mar 26, 2024
a88c100
Shield Block
Swillis57 Mar 26, 2024
c91f362
re-add baseline spell files
Swillis57 Mar 26, 2024
f475a43
Remaining baseline abilities
Swillis57 Mar 29, 2024
c72dff6
New abilities: Inner Rage + Colossus Smash
Swillis57 Mar 29, 2024
1052c3c
Fix test buffs
Swillis57 Mar 29, 2024
0bcb2e6
Fixing raid buffs
Swillis57 Mar 30, 2024
adeca71
General cleanup and early beta tweaks
Swillis57 Mar 30, 2024
7c172e5
Merge branch 'wowsims:master' into warrior-baseline-spells
Swillis57 Mar 30, 2024
7870ecb
Update armor test - Sunder Armor now only stacks to 3
Swillis57 Mar 31, 2024
319f6e1
Merge branch 'warrior-baseline-spells' of https://github.com/Swillis5…
Swillis57 Mar 31, 2024
943aba7
Update test results
Swillis57 Mar 31, 2024
a6f93ad
Merge branch 'master' of https://github.com/wowsims/cata into warrior…
Swillis57 Mar 31, 2024
eb96ed2
Fix dumb implementation mistakes
Swillis57 Mar 31, 2024
6df1f42
Merge branch 'master' of https://github.com/Swillis57/cata into warri…
Swillis57 Apr 11, 2024
cd306e7
Update tests
Swillis57 Apr 11, 2024
3c08bb4
SpellMod system updates. Passive effect glyphs were converted into Sp…
Swillis57 Apr 11, 2024
a26b195
Don't waste a SpellMask bit for 0
Swillis57 Apr 11, 2024
a8748cd
Review fixes
Swillis57 Apr 11, 2024
2ddb49a
Merge branch 'master' of https://github.com/wowsims/cata into warrior…
Swillis57 Apr 11, 2024
f1b91a4
Update tests
Swillis57 Apr 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -414,23 +414,21 @@ message RaidBuffs {

// +Stam
TristateEffect power_word_fortitude = 2;
bool commanding_shout = 3;

// +Health
TristateEffect commanding_shout = 3;
TristateEffect blood_pact = 4;

// + Agi and Str
bool horn_of_winter = 5;
TristateEffect strength_of_earth_totem = 6; // none, normal, 15% improved
bool battle_shout = 10;

// +Intell and/or Spi
bool arcane_brilliance = 7;
TristateEffect fel_intelligence = 8;
bool divine_spirit = 9;

// +AP
TristateEffect battle_shout = 10;

// 10% AP
bool trueshot_aura = 11;
bool unleashed_rage = 12;
Expand Down Expand Up @@ -612,7 +610,7 @@ message Debuffs {
bool spore_cloud = 37;

TristateEffect demoralizing_roar = 25;
TristateEffect demoralizing_shout = 26;
bool demoralizing_shout = 26;
bool vindication = 36;
bool demoralizing_screech = 34;

Expand Down
2 changes: 1 addition & 1 deletion sim/core/armor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestSunderArmorStacks(t *testing.T) {
sunderAura.Activate(&sim)
sunderAura.SetStacks(&sim, stacks)
tolerance := 0.001
for stacks <= 5 {
for stacks <= 3 {
expectedArmor = baseArmor * (1.0 - float64(stacks)*0.04)
if !WithinToleranceFloat64(expectedArmor, target.Armor(), tolerance) {
t.Fatalf("Armor value for target should be %f but found %f", expectedArmor, target.Armor())
Expand Down
62 changes: 50 additions & 12 deletions sim/core/buffs.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func applyBuffEffects(agent Agent, raidBuffs *proto.RaidBuffs, partyBuffs *proto
})
}

if raidBuffs.CommandingShout > 0 {
MakePermanent(CommandingShoutAura(&character.Unit, GetTristateValueInt32(raidBuffs.CommandingShout, 0, 5), 0, false))
if raidBuffs.CommandingShout {
MakePermanent(CommandingShoutAura(&character.Unit, false))
}
if raidBuffs.BloodPact > 0 {
MakePermanent(BloodPactAura(&character.Unit, GetTristateValueInt32(raidBuffs.BloodPact, 0, 3)))
Expand Down Expand Up @@ -202,8 +202,8 @@ func applyBuffEffects(agent Agent, raidBuffs *proto.RaidBuffs, partyBuffs *proto
RetributionAura(character, raidBuffs.SanctifiedRetribution)
}

if raidBuffs.BattleShout > 0 {
MakePermanent(BattleShoutAura(&character.Unit, GetTristateValueInt32(raidBuffs.BattleShout, 0, 5), 0, false))
if raidBuffs.BattleShout {
MakePermanent(BattleShoutAura(&character.Unit, false))
}
if individualBuffs.BlessingOfMight > 0 {
MakePermanent(BlessingOfMightAura(&character.Unit, GetTristateValueInt32(individualBuffs.BlessingOfMight, 0, 2)))
Expand Down Expand Up @@ -1385,17 +1385,38 @@ func spellPowerBonusEffect(aura *Aura, spellPowerBonus float64) *ExclusiveEffect
})
}

func BattleShoutAura(unit *Unit, commandingPresencePts int32, boomingVoicePts int32, minorGlyph bool) *Aura {
// TODO: find the actual str/agi bonus for changed buffs. wowhead doesn't have it yet
// guesstimate for now based on lack of SoE totem/HoW buff changes in 4.0.1
func BattleShoutAura(unit *Unit, minorGlyph bool) *Aura {
aura := unit.GetOrRegisterAura(Aura{
Label: "Battle Shout",
ActionID: ActionID{SpellID: 47436},
Duration: time.Duration(float64(time.Minute*2)*(1+0.25*float64(boomingVoicePts))) + TernaryDuration(minorGlyph, 2*time.Minute, 0),
ActionID: ActionID{SpellID: 6673},
Duration: time.Duration(float64(time.Minute*2)) + TernaryDuration(minorGlyph, 2*time.Minute, 0),
BuildPhase: CharacterBuildPhaseBuffs,
})
attackPowerBonusEffect(aura, math.Floor(550*(1+0.05*float64(commandingPresencePts))))

strengthAgilityBonusEffect(aura, 155)
return aura
}

func strengthAgilityBonusEffect(aura *Aura, strBonus float64) *ExclusiveEffect {
return aura.NewExclusiveEffect("StrengthAgilityBonus", false, ExclusiveEffect{
Priority: strBonus,
OnGain: func(ee *ExclusiveEffect, sim *Simulation) {
ee.Aura.Unit.AddStatsDynamic(sim, stats.Stats{
stats.Strength: ee.Priority,
stats.Agility: ee.Priority,
})
},
OnExpire: func(ee *ExclusiveEffect, sim *Simulation) {
ee.Aura.Unit.AddStatsDynamic(sim, stats.Stats{
stats.Strength: -ee.Priority,
stats.Agility: -ee.Priority,
})
},
})
}

func BlessingOfMightAura(unit *Unit, impBomPts int32) *Aura {
aura := unit.GetOrRegisterAura(Aura{
Label: "Blessing of Might",
Expand Down Expand Up @@ -1428,17 +1449,34 @@ func attackPowerBonusEffect(aura *Aura, apBonus float64) *ExclusiveEffect {
})
}

func CommandingShoutAura(unit *Unit, commandingPresencePts int32, boomingVoicePts int32, minorGlyph bool) *Aura {
// TODO: same as str/agi buffs, placeholder values until we can get the actual values
func CommandingShoutAura(unit *Unit, minorGlyph bool) *Aura {
aura := unit.GetOrRegisterAura(Aura{
Label: "Commanding Shout",
ActionID: ActionID{SpellID: 47440},
Duration: time.Duration(float64(time.Minute*2)*(1+0.25*float64(boomingVoicePts))) + TernaryDuration(minorGlyph, 2*time.Minute, 0),
ActionID: ActionID{SpellID: 469},
Duration: time.Minute*2 + TernaryDuration(minorGlyph, 2*time.Minute, 0),
BuildPhase: CharacterBuildPhaseBuffs,
})
healthBonusEffect(aura, 2255*(1+0.05*float64(commandingPresencePts)))
staminaBonusEffect(aura, 165)
return aura
}

func staminaBonusEffect(aura *Aura, stamBonus float64) *ExclusiveEffect {
return aura.NewExclusiveEffect("StaminaBonus", false, ExclusiveEffect{
Priority: stamBonus,
OnGain: func(ee *ExclusiveEffect, s *Simulation) {
ee.Aura.Unit.AddStatsDynamic(s, stats.Stats{
stats.Stamina: ee.Priority,
})
},
OnExpire: func(ee *ExclusiveEffect, s *Simulation) {
ee.Aura.Unit.AddStatsDynamic(s, stats.Stats{
stats.Stamina: -ee.Priority,
})
},
})
}

func BloodPactAura(unit *Unit, impImpPts int32) *Aura {
aura := unit.GetOrRegisterAura(Aura{
Label: "Blood Pact",
Expand Down
4 changes: 4 additions & 0 deletions sim/core/cooldown.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (cd *Cooldown) Use(sim *Simulation) {
*cd.Timer = Timer(sim.CurrentTime + cd.Duration)
}

func (cd *Cooldown) Reduce(t time.Duration) {
cd.Set(cd.ReadyAt() - t)
}

func BothTimersReadyAt(t1 *Timer, t2 *Timer) time.Duration {
readyAt := time.Duration(0)
if t1 != nil {
Expand Down
41 changes: 27 additions & 14 deletions sim/core/debuffs.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ func applyDebuffEffects(target *Unit, targetIdx int, debuffs *proto.Debuffs, rai
if debuffs.DemoralizingRoar != proto.TristateEffect_TristateEffectMissing {
MakePermanent(DemoralizingRoarAura(target, GetTristateValueInt32(debuffs.DemoralizingRoar, 0, 5)))
}
if debuffs.DemoralizingShout != proto.TristateEffect_TristateEffectMissing {
MakePermanent(DemoralizingShoutAura(target, 0, GetTristateValueInt32(debuffs.DemoralizingShout, 0, 5)))
if debuffs.DemoralizingShout {
MakePermanent(DemoralizingShoutAura(target, false))
}
if debuffs.Vindication && targetIdx == 0 {
MakePermanent(VindicationAura(target, 2))
Expand All @@ -145,7 +145,7 @@ func applyDebuffEffects(target *Unit, targetIdx int, debuffs *proto.Debuffs, rai

// Atk spd reduction
if debuffs.ThunderClap != proto.TristateEffect_TristateEffectMissing {
MakePermanent(ThunderClapAura(target, GetTristateValueInt32(debuffs.ThunderClap, 0, 3)))
MakePermanent(ThunderClapAura(target))
}
if debuffs.FrostFever != proto.TristateEffect_TristateEffectMissing {
MakePermanent(FrostFeverAura(target, GetTristateValueInt32(debuffs.FrostFever, 0, 3), 0))
Expand Down Expand Up @@ -553,9 +553,9 @@ func SunderArmorAura(target *Unit) *Aura {
var effect *ExclusiveEffect
aura := target.GetOrRegisterAura(Aura{
Label: "Sunder Armor",
ActionID: ActionID{SpellID: 47467},
ActionID: ActionID{SpellID: 58567},
Duration: time.Second * 30,
MaxStacks: 5,
MaxStacks: 3,
OnStacksChange: func(aura *Aura, sim *Simulation, oldStacks int32, newStacks int32) {
effect.SetPriority(sim, 0.04*float64(newStacks))
},
Expand Down Expand Up @@ -721,13 +721,13 @@ func DemoralizingRoarAura(target *Unit, points int32) *Aura {
return aura
}

func DemoralizingShoutAura(target *Unit, boomingVoicePts int32, impDemoShoutPts int32) *Aura {
func DemoralizingShoutAura(target *Unit, glyph bool) *Aura {
aura := target.GetOrRegisterAura(Aura{
Label: "DemoralizingShout-" + strconv.Itoa(int(impDemoShoutPts)),
ActionID: ActionID{SpellID: 47437},
Duration: time.Duration(float64(time.Second*30) * (1 + 0.1*float64(boomingVoicePts))),
Label: "DemoralizingShout",
ActionID: ActionID{SpellID: 1160},
Duration: time.Second*30 + TernaryDuration(glyph, time.Second*15, 0),
})
apReductionEffect(aura, 411*(1+0.08*float64(impDemoShoutPts)))
PhysDamageReductionEffect(aura, 0.1)
return aura
}

Expand All @@ -751,6 +751,19 @@ func DemoralizingScreechAura(target *Unit) *Aura {
return aura
}

func PhysDamageReductionEffect(aura *Aura, dmgReduction float64) *ExclusiveEffect {
reductionMult := 1.0 - dmgReduction
return aura.NewExclusiveEffect("PhysDamageReduction", false, ExclusiveEffect{
Priority: dmgReduction,
OnGain: func(ee *ExclusiveEffect, sim *Simulation) {
ee.Aura.Unit.PseudoStats.SchoolDamageDealtMultiplier[SpellSchoolPhysical] *= reductionMult
},
OnExpire: func(ee *ExclusiveEffect, sim *Simulation) {
ee.Aura.Unit.PseudoStats.SchoolDamageDealtMultiplier[SpellSchoolPhysical] /= reductionMult
},
})
}

func apReductionEffect(aura *Aura, apReduction float64) *ExclusiveEffect {
statReduction := stats.Stats{stats.AttackPower: -apReduction}
return aura.NewExclusiveEffect("APReduction", false, ExclusiveEffect{
Expand All @@ -764,13 +777,13 @@ func apReductionEffect(aura *Aura, apReduction float64) *ExclusiveEffect {
})
}

func ThunderClapAura(target *Unit, points int32) *Aura {
func ThunderClapAura(target *Unit) *Aura {
aura := target.GetOrRegisterAura(Aura{
Label: "ThunderClap-" + strconv.Itoa(int(points)),
ActionID: ActionID{SpellID: 47502},
Label: "ThunderClap",
ActionID: ActionID{SpellID: 6343},
Duration: time.Second * 30,
})
AtkSpeedReductionEffect(aura, []float64{1.1, 1.14, 1.17, 1.2}[points])
AtkSpeedReductionEffect(aura, 1.2)
return aura
}

Expand Down
6 changes: 3 additions & 3 deletions sim/core/rage.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func newRageCost(spell *Spell, options RageCostOptions) *RageCost {
}

return &RageCost{
Refund: options.Refund * options.Cost,
Refund: options.Refund,
RefundMetrics: options.RefundMetrics,
ResourceMetrics: spell.Unit.NewRageMetrics(spell.ActionID),
}
Expand All @@ -244,7 +244,7 @@ func (rc *RageCost) SpendCost(sim *Simulation, spell *Spell) {
}
}
func (rc *RageCost) IssueRefund(sim *Simulation, spell *Spell) {
if rc.Refund > 0 {
spell.Unit.AddRage(sim, rc.Refund, rc.RefundMetrics)
if rc.Refund > 0 && spell.CurCast.Cost > 0 {
spell.Unit.AddRage(sim, rc.Refund*spell.CurCast.Cost, rc.RefundMetrics)
}
}
34 changes: 34 additions & 0 deletions sim/core/spell_mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ const (
// Uses FloatValue
SpellMod_PowerCost_Pct

// Increases or decreases spell.DefaultCast.Cost by flat amount
// Uses FloatValue
SpellMod_PowerCost_Flat

// Will add time.Duration to spell.CD.Duration
// Uses TimeValue
SpellMod_Cooldown_Flat
Expand All @@ -189,6 +193,10 @@ const (
// Will add / substract % amount from the cast time multiplier.
// Ueses: FloatValue
SpellMod_CastTime_Pct

// Add/subtract bonus crit rating
// Uses: FloatValue
SpellMod_BonusCrit_Rating
)

var spellModMap = map[SpellModType]*SpellModFunctions{
Expand All @@ -207,6 +215,11 @@ var spellModMap = map[SpellModType]*SpellModFunctions{
Remove: removePowerCostPercent,
},

SpellMod_PowerCost_Flat: {
Apply: applyPowerCostFlat,
Remove: removePowerCostFlat,
},

SpellMod_Cooldown_Flat: {
Apply: applyCooldownFlat,
Remove: removeCooldownFlat,
Expand All @@ -221,6 +234,11 @@ var spellModMap = map[SpellModType]*SpellModFunctions{
Apply: applyCastTimePercent,
Remove: removeCastTimePercent,
},

SpellMod_BonusCrit_Rating: {
Apply: applyBonusCritRating,
Remove: removeBonusCritRating,
},
}

func applyDamageDonePercent(mod *SpellMod, spell *Spell) {
Expand All @@ -247,6 +265,14 @@ func removePowerCostPercent(mod *SpellMod, spell *Spell) {
spell.DefaultCast.Cost /= 1 + mod.floatValue
}

func applyPowerCostFlat(mod *SpellMod, spell *Spell) {
spell.DefaultCast.Cost += mod.floatValue
}

func removePowerCostFlat(mod *SpellMod, spell *Spell) {
spell.DefaultCast.Cost -= mod.floatValue
}

func applyCooldownFlat(mod *SpellMod, spell *Spell) {
spell.CD.Duration += mod.timeValue
}
Expand All @@ -270,3 +296,11 @@ func applyCastTimePercent(mod *SpellMod, spell *Spell) {
func removeCastTimePercent(mod *SpellMod, spell *Spell) {
spell.CastTimeMultiplier -= mod.floatValue
}

func applyBonusCritRating(mod *SpellMod, spell *Spell) {
spell.BonusCritRating += mod.floatValue
}

func removeBonusCritRating(mod *SpellMod, spell *Spell) {
spell.BonusCritRating -= mod.floatValue
}
4 changes: 4 additions & 0 deletions sim/core/spell_resistances.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func (spell *Spell) ResistanceMultiplier(sim *Simulation, isPeriodic bool, attac
}

func (at *AttackTable) GetArmorDamageModifier(spell *Spell) float64 {
if at.IgnoreArmor {
return 1.0
}

armorConstant := float64(at.Attacker.Level)*467.5 - 22167.5
defenderArmor := at.Defender.Armor()
reducibleArmor := min((defenderArmor+armorConstant)/3, defenderArmor)
Expand Down
1 change: 1 addition & 0 deletions sim/core/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ type AttackTable struct {
NatureDamageTakenMultiplier float64
HauntSEDamageTakenMultiplier float64
HealingDealtMultiplier float64
IgnoreArmor bool // Ignore defender's armor for specifically this attacker's attacks
}

func NewAttackTable(attacker *Unit, defender *Unit) *AttackTable {
Expand Down
3 changes: 1 addition & 2 deletions sim/core/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var FullRaidBuffs = &proto.RaidBuffs{
AbominationsMight: true,
ArcaneBrilliance: true,
ArcaneEmpowerment: true,
BattleShout: proto.TristateEffect_TristateEffectImproved,
BattleShout: true,
Bloodlust: true,
DemonicPactSp: 500,
DevotionAura: proto.TristateEffect_TristateEffectImproved,
Expand All @@ -66,7 +66,6 @@ var FullRaidBuffs = &proto.RaidBuffs{
PowerWordFortitude: proto.TristateEffect_TristateEffectImproved,
SanctifiedRetribution: true,
ShadowProtection: true,
StrengthOfEarthTotem: proto.TristateEffect_TristateEffectImproved,
SwiftRetribution: true,
Thorns: proto.TristateEffect_TristateEffectImproved,
TotemOfWrath: true,
Expand Down
Loading
Loading