warrior

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpellFlagBloodsurge  = core.SpellFlagAgentReserved1
	SpellFlagWhirlwindOH = core.SpellFlagAgentReserved2
	ArmsTree             = 0
	FuryTree             = 1
	ProtTree             = 2
)
View Source
const ShoutExpirationThreshold = time.Second * 3

Variables

View Source
var ItemSetDestroyerArmor = core.NewItemSet(core.ItemSet{
	Name: "Destroyer Armor",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()
			procAura := warrior.RegisterAura(core.Aura{
				Label:     "Destroyer 2pc Proc",
				ActionID:  core.ActionID{SpellID: 37522},
				Duration:  time.Second * 6,
				MaxStacks: 1,
				OnGain: func(aura *core.Aura, sim *core.Simulation) {
					warrior.AddStatDynamic(sim, stats.BlockValue, 100)
				},
				OnExpire: func(aura *core.Aura, sim *core.Simulation) {
					warrior.AddStatDynamic(sim, stats.BlockValue, -100)
				},
				OnSpellHitTaken: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					if result.Outcome.Matches(core.OutcomeBlock) {
						aura.RemoveStack(sim)
					}
				},
			})

			warrior.RegisterAura(core.Aura{
				Label:    "Destroyer 2pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnCastComplete: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell) {
					if spell == warrior.ShieldBlock {
						procAura.Activate(sim)
						procAura.SetStacks(sim, 1)
					}
				},
			})
		},
		4: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()
			procAura := warrior.NewTemporaryStatsAura("Destroyer 4pc Proc", core.ActionID{SpellID: 37525}, stats.Stats{stats.MeleeHaste: 200}, time.Second*10)

			warrior.RegisterAura(core.Aura{
				Label:    "Destroyer 4pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnSpellHitTaken: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					if result.Landed() && sim.RandomFloat("Destroyer 4pc") < 0.07 {
						procAura.Activate(sim)
					}
				},
			})
		},
	},
})
View Source
var ItemSetDestroyerBattlegear = core.NewItemSet(core.ItemSet{
	Name: "Destroyer Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()
			procAura := warrior.NewTemporaryStatsAura("Destroyer 2pc Proc", core.ActionID{SpellID: 37528}, stats.Stats{stats.AttackPower: 100}, time.Second*5)

			warrior.RegisterAura(core.Aura{
				Label:    "Destroyer 2pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnCastComplete: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell) {
					if spell == warrior.Overpower {
						procAura.Activate(sim)
					}
				},
			})
		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetDreadnaughtBattlegear = core.NewItemSet(core.ItemSet{
	Name: "Dreadnaught Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()
			rageMetrics := warrior.NewRageMetrics(core.ActionID{SpellID: 61571})

			procAura := warrior.RegisterAura(core.Aura{
				Label:    "Dreadnaught Battlegear 4pc Proc",
				ActionID: core.ActionID{SpellID: 61571},
				Duration: time.Second * 30,
				OnGain: func(_ *core.Aura, sim *core.Simulation) {
					warrior.PseudoStats.CostReduction += 5
				},
				OnExpire: func(_ *core.Aura, sim *core.Simulation) {
					warrior.PseudoStats.CostReduction -= 5
				},
				OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, _ *core.SpellResult) {
					if !spell.ProcMask.Matches(core.ProcMaskMeleeSpecial) {
						return
					}

					if actualGain := spell.DefaultCast.Cost - spell.CurCast.Cost; actualGain > 0 {
						rageMetrics.AddEvent(5, actualGain)
						aura.Deactivate(sim)
					}
				},
			})

			warrior.RegisterAura(core.Aura{
				Label:    "Dreadnaught Battlegear 4pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnPeriodicDamageDealt: func(_ *core.Aura, sim *core.Simulation, _ *core.Spell, result *core.SpellResult) {
					if result.Landed() && sim.RandomFloat("Dreadnaught Battlegear 4pc") < 0.1 {
						procAura.Activate(sim)
					}
				},
			})
		},
	},
})
View Source
var ItemSetDreadnaughtPlate = core.NewItemSet(core.ItemSet{
	Name: "Dreadnaught Plate",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetGladiatorsBattlegear = core.NewItemSet(core.ItemSet{
	Name: "Gladiator's Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

			agent.GetCharacter().AddStat(stats.Resilience, 100)
			agent.GetCharacter().AddStat(stats.AttackPower, 50)
		},
		4: func(agent core.Agent) {

			agent.GetCharacter().AddStat(stats.AttackPower, 150)
		},
	},
})
View Source
var ItemSetOnslaughtArmor = core.NewItemSet(core.ItemSet{
	Name: "Onslaught Armor",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetOnslaughtBattlegear = core.NewItemSet(core.ItemSet{
	Name: "Onslaught Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetSiegebreakerBattlegear = core.NewItemSet(core.ItemSet{
	Name: "Siegebreaker Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()
			procAura := warrior.RegisterAura(core.Aura{
				Label:    "Siegebreaker Battlegear 2pc Proc",
				ActionID: core.ActionID{SpellID: 64937},
				Duration: time.Second * 5,
				OnGain: func(aura *core.Aura, sim *core.Simulation) {
					warrior.AddStatDynamic(sim, stats.MeleeHaste, 150)
				},
				OnExpire: func(aura *core.Aura, sim *core.Simulation) {
					warrior.AddStatDynamic(sim, stats.MeleeHaste, -150)
				},
			})

			warrior.RegisterAura(core.Aura{
				Label:    "Siegebreaker Battlegear 2pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					if spell.ActionID.SpellID != 47450 && spell != warrior.Slam {
						return
					}
					if !result.Outcome.Matches(core.OutcomeCrit) {
						return
					}
					if result.Landed() && sim.RandomFloat("Siegebreaker Battlegear 2pc") < 0.4 {
						procAura.Activate(sim)
					}
				},
			})
		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetSiegebreakerPlate = core.NewItemSet(core.ItemSet{
	Name: "Siegebreaker Plate",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetWarbringerArmor = core.NewItemSet(core.ItemSet{
	Name: "Warbringer Armor",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {
			warrior := agent.(WarriorAgent).GetWarrior()

			bladeTurningShield := 0.0

			procaura := warrior.RegisterAura(core.Aura{
				Label:    "Warbringer 2pc Proc",
				ActionID: core.ActionID{SpellID: 37514},
				Duration: time.Second * 15,
				OnSpellHitTaken: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					damage := result.Damage
					if damage >= bladeTurningShield {
						result.Damage -= bladeTurningShield
						aura.Deactivate(sim)
					} else {
						result.Damage -= bladeTurningShield
						bladeTurningShield -= damage
					}
				},
			})
			warrior.RegisterAura(core.Aura{
				Label:    "Warbringer 2pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					if result.Outcome.Matches(core.OutcomeParry) {
						procaura.Activate(sim)
						bladeTurningShield = 200
					}
				},
			})
		},
		4: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()

			procAura := warrior.RegisterAura(core.Aura{
				Label:    "Warbringer 4pc Proc",
				ActionID: core.ActionID{SpellID: 37516},
				Duration: core.NeverExpires,
				OnGain: func(aura *core.Aura, sim *core.Simulation) {
					aura.Unit.PseudoStats.DamageDealtMultiplier *= 1.1
				},
				OnExpire: func(aura *core.Aura, sim *core.Simulation) {
					aura.Unit.PseudoStats.DamageDealtMultiplier /= 1.1
				},
				OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					if result.Damage > 0 {
						aura.Deactivate(sim)
					}
				},
			})

			warrior.RegisterAura(core.Aura{
				Label:    "Warbringer 4pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, spellEffect *core.SpellResult) {
					if spell == warrior.Revenge {
						procAura.Activate(sim)
					}
				},
			})
		},
	},
})

/////////////////////////////////////////////////////////////// TBC Item set ///////////////////////////////////////////////////////////////

View Source
var ItemSetWarbringerBattlegear = core.NewItemSet(core.ItemSet{
	Name: "Warbringer Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()
			rageMetrics := warrior.NewRageMetrics(core.ActionID{SpellID: 37519})

			warrior.RegisterAura(core.Aura{
				Label:    "Warbringer 4pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					if result.Outcome.Matches(core.OutcomeDodge | core.OutcomeParry) {
						warrior.AddRage(sim, 2, rageMetrics)
					}
				},
			})
		},
	},
})
View Source
var ItemSetWrynnsBattlegear = core.NewItemSet(core.ItemSet{
	Name:            "Wrynn's Battlegear",
	AlternativeName: "Hellscream's Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetWrynnsPlate = core.NewItemSet(core.ItemSet{
	Name:            "Wrynn's Plate",
	AlternativeName: "Hellscream's Plate",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetYmirjarLordsBattlegear = core.NewItemSet(core.ItemSet{
	Name: "Ymirjar Lord's Battlegear",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

			warrior := agent.(WarriorAgent).GetWarrior()
			var bonusAP float64
			procAura := warrior.RegisterAura(core.Aura{
				Label:    "Ymirjar Lord's Battlegear 2pc Proc",
				ActionID: core.ActionID{SpellID: 70855},
				Duration: time.Second * 10,
				OnGain: func(aura *core.Aura, sim *core.Simulation) {
					bonusAP = warrior.GetStat(stats.AttackPower) * 0.16
					aura.Unit.AddStatDynamic(sim, stats.AttackPower, bonusAP)
				},
				OnExpire: func(aura *core.Aura, sim *core.Simulation) {
					aura.Unit.AddStatDynamic(sim, stats.AttackPower, -bonusAP)
				},
			})

			warrior.RegisterAura(core.Aura{
				Label:    "Ymirjar Lord's Battlegear 2pc",
				Duration: core.NeverExpires,
				OnReset: func(aura *core.Aura, sim *core.Simulation) {
					aura.Activate(sim)
				},
				OnPeriodicDamageDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
					if spell != warrior.DeepWounds {
						return
					}
					if result.Landed() && sim.RandomFloat("Ymirjar 2pc") < 0.03 {
						procAura.Activate(sim)
					}
				},
			})
		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var ItemSetYmirjarLordsPlate = core.NewItemSet(core.ItemSet{
	Name: "Ymirjar Lord's Plate",
	Bonuses: map[int32]core.ApplyEffect{
		2: func(agent core.Agent) {

		},
		4: func(agent core.Agent) {

		},
	},
})
View Source
var TalentTreeSizes = [3]int{31, 27, 27}

Functions

This section is empty.

Types

type Stance

type Stance uint8
const (
	BattleStance Stance = 1 << iota
	DefensiveStance
	BerserkerStance
)

type Warrior

type Warrior struct {
	core.Character

	Talents *proto.WarriorTalents

	WarriorInputs

	// Current state
	Stance               Stance
	RendValidUntil       time.Duration
	BloodsurgeValidUntil time.Duration

	Ymirjar4pcProcAura *core.Aura

	LastAMTick time.Duration

	Shout           *core.Spell
	BattleStance    *core.Spell
	DefensiveStance *core.Spell
	BerserkerStance *core.Spell

	BerserkerRage        *core.Spell
	Bloodthirst          *core.Spell
	DemoralizingShout    *core.Spell
	Devastate            *core.Spell
	Execute              *core.Spell
	MortalStrike         *core.Spell
	Overpower            *core.Spell
	Rend                 *core.Spell
	Revenge              *core.Spell
	ShieldBlock          *core.Spell
	ShieldSlam           *core.Spell
	Slam                 *core.Spell
	SunderArmor          *core.Spell
	SunderArmorDevastate *core.Spell
	ThunderClap          *core.Spell
	Whirlwind            *core.Spell
	WhirlwindOH          *core.Spell
	DeepWounds           *core.Spell
	Shockwave            *core.Spell
	ConcussionBlow       *core.Spell
	Bladestorm           *core.Spell
	BladestormOH         *core.Spell

	HeroicStrike *core.Spell
	Cleave       *core.Spell

	OverpowerAura            *core.Aura
	HSRageThreshold          float64
	RendRageThresholdBelow   float64
	RendHealthThresholdAbove float64

	BattleStanceAura    *core.Aura
	DefensiveStanceAura *core.Aura
	BerserkerStanceAura *core.Aura

	BloodsurgeAura  *core.Aura
	SuddenDeathAura *core.Aura
	ShieldBlockAura *core.Aura

	DemoralizingShoutAuras core.AuraArray
	SunderArmorAuras       core.AuraArray
	ThunderClapAuras       core.AuraArray
	// contains filtered or unexported fields
}

func NewWarrior

func NewWarrior(character core.Character, talents string, inputs WarriorInputs) *Warrior

func (*Warrior) AddPartyBuffs

func (warrior *Warrior) AddPartyBuffs(_ *proto.PartyBuffs)

func (*Warrior) AddRaidBuffs

func (warrior *Warrior) AddRaidBuffs(raidBuffs *proto.RaidBuffs)

func (*Warrior) ApplyTalents

func (warrior *Warrior) ApplyTalents()

func (*Warrior) CanApplySunderAura

func (warrior *Warrior) CanApplySunderAura(target *core.Unit) bool

func (*Warrior) CanThunderClapIgnoreStance

func (warrior *Warrior) CanThunderClapIgnoreStance(sim *core.Simulation) bool

func (*Warrior) CanWhirlwind

func (warrior *Warrior) CanWhirlwind(sim *core.Simulation) bool

func (*Warrior) CastExecute

func (warrior *Warrior) CastExecute(sim *core.Simulation, target *core.Unit) bool

func (*Warrior) CastFullTfbOverpower added in v1.0.1

func (warrior *Warrior) CastFullTfbOverpower(sim *core.Simulation, target *core.Unit) bool

Queue Overpower to be cast at every 6s if talented for 3/3 TfB

func (*Warrior) CastSlam

func (warrior *Warrior) CastSlam(sim *core.Simulation, target *core.Unit) bool

func (*Warrior) GetCharacter

func (warrior *Warrior) GetCharacter() *core.Character

func (*Warrior) HasMajorGlyph

func (warrior *Warrior) HasMajorGlyph(glyph proto.WarriorMajorGlyph) bool

func (*Warrior) HasMinorGlyph

func (warrior *Warrior) HasMinorGlyph(glyph proto.WarriorMinorGlyph) bool

func (*Warrior) Initialize

func (warrior *Warrior) Initialize()

func (*Warrior) IsSuddenDeathActive

func (warrior *Warrior) IsSuddenDeathActive() bool

func (*Warrior) QueueHSOrCleave

func (warrior *Warrior) QueueHSOrCleave(sim *core.Simulation)

func (*Warrior) RegisterBladestormCD

func (warrior *Warrior) RegisterBladestormCD()

func (*Warrior) RegisterHSOrCleave

func (warrior *Warrior) RegisterHSOrCleave(useCleave bool, rageThreshold float64)

func (*Warrior) RegisterRecklessnessCD

func (warrior *Warrior) RegisterRecklessnessCD()

func (*Warrior) RegisterRendSpell

func (warrior *Warrior) RegisterRendSpell(rageThreshold float64, healthThreshold float64)

TODO (maybe) https://github.com/magey/wotlk-warrior/issues/23 - Rend is not benefitting from Two-Handed Weapon Specialization

func (*Warrior) RegisterShieldBlockCD

func (warrior *Warrior) RegisterShieldBlockCD()

func (*Warrior) RegisterShieldWallCD

func (warrior *Warrior) RegisterShieldWallCD()

func (*Warrior) Reset

func (warrior *Warrior) Reset(_ *core.Simulation)

func (*Warrior) ShouldBerserkerRage

func (warrior *Warrior) ShouldBerserkerRage(sim *core.Simulation) bool

func (*Warrior) ShouldDemoralizingShout

func (warrior *Warrior) ShouldDemoralizingShout(sim *core.Simulation, target *core.Unit, filler bool, maintainOnly bool) bool

func (*Warrior) ShouldInstantSlam

func (warrior *Warrior) ShouldInstantSlam(sim *core.Simulation) bool

func (*Warrior) ShouldOverpower

func (warrior *Warrior) ShouldOverpower(sim *core.Simulation) bool

func (*Warrior) ShouldQueueHSOrCleave

func (warrior *Warrior) ShouldQueueHSOrCleave(sim *core.Simulation) bool

func (*Warrior) ShouldRend

func (warrior *Warrior) ShouldRend(sim *core.Simulation) bool

func (*Warrior) ShouldShout

func (warrior *Warrior) ShouldShout(sim *core.Simulation) bool

func (*Warrior) ShouldSlam

func (warrior *Warrior) ShouldSlam(sim *core.Simulation) bool

func (*Warrior) ShouldThunderClap

func (warrior *Warrior) ShouldThunderClap(sim *core.Simulation, target *core.Unit, filler bool, maintainOnly bool, ignoreStance bool) bool

func (*Warrior) SpamExecute

func (warrior *Warrior) SpamExecute(spam bool) bool

func (*Warrior) StanceMatches

func (warrior *Warrior) StanceMatches(other Stance) bool

func (*Warrior) ToughnessArmorMultiplier added in v1.0.1

func (warrior *Warrior) ToughnessArmorMultiplier() float64

func (*Warrior) TryHSOrCleave

func (warrior *Warrior) TryHSOrCleave(sim *core.Simulation, mhSwingSpell *core.Spell) *core.Spell

Returns true if the regular melee swing should be used, false otherwise.

type WarriorAgent

type WarriorAgent interface {
	GetWarrior() *Warrior
}

Agent is a generic way to access underlying warrior on any of the agents.

type WarriorInputs

type WarriorInputs struct {
	ShoutType                   proto.WarriorShout
	PrecastShout                bool
	PrecastShoutSapphire        bool
	PrecastShoutT2              bool
	RendCdThreshold             time.Duration
	BloodsurgeDurationThreshold time.Duration
	StanceSnapshot              bool
	Munch                       bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL