Skip to content

Commit

Permalink
Merge pull request #19 from wowsims/hunter_spells
Browse files Browse the repository at this point in the history
add aimed shot and wing clip
  • Loading branch information
rosenrusinov authored Feb 3, 2024
2 parents 832f683 + af5607f commit 64b5085
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 58 deletions.
56 changes: 0 additions & 56 deletions sim/_hunter/aimed_shot.go

This file was deleted.

92 changes: 92 additions & 0 deletions sim/hunter/aimed_shot.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package hunter

import (
"time"

"github.com/wowsims/sod/sim/core"
"github.com/wowsims/sod/sim/core/proto"
)

func (hunter *Hunter) getAimedShotConfig(rank int, timer *core.Timer) core.SpellConfig {
spellId := [7]int32{0, 19434, 20900, 20901, 20902, 20903, 20904}[rank]
baseDamage := [7]float64{0, 70, 125, 200, 330, 460, 600}[rank]
manaCost := [7]float64{0, 75, 115, 160, 210, 260, 310}[rank]
level := [7]int{0, 0, 28, 36, 44, 52, 60}[rank]

hasCobraStrikes := hunter.pet != nil && hunter.HasRune(proto.HunterRune_RuneChestCobraStrikes)

manaCostMultiplier := 1 - 0.02*float64(hunter.Talents.Efficiency)
if hunter.HasRune(proto.HunterRune_RuneChestMasterMarksman) {
manaCostMultiplier -= 0.25
}

return core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellSchool: core.SpellSchoolPhysical,
ProcMask: core.ProcMaskRangedSpecial,
Flags: core.SpellFlagMeleeMetrics | core.SpellFlagIncludeTargetBonusDamage | core.SpellFlagAPL,
Rank: rank,
RequiredLevel: level,
MissileSpeed: 24,

ManaCost: core.ManaCostOptions{
FlatCost: manaCost,
Multiplier: manaCostMultiplier,
},
Cast: core.CastConfig{
DefaultCast: core.Cast{
GCD: core.GCDDefault,
CastTime: time.Second * 3,
},
IgnoreHaste: true,
CD: core.Cooldown{
Timer: timer,
Duration: time.Second * 6,
},
},
ExtraCastCondition: func(sim *core.Simulation, target *core.Unit) bool {
return hunter.DistanceFromTarget >= 8
},

BonusCritRating: 0,
DamageMultiplierAdditive: 1 +
.05*float64(hunter.Talents.Barrage),
DamageMultiplier: 1,
CritMultiplier: hunter.critMultiplier(true, hunter.CurrentTarget),
ThreatMultiplier: 1,

ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
baseDamage := 0.2*spell.RangedAttackPower(target) +
hunter.AutoAttacks.Ranged().BaseDamage(sim) +
hunter.AmmoDamageBonus +
spell.BonusWeaponDamage() +
baseDamage

result := spell.CalcDamage(sim, target, baseDamage, spell.OutcomeRangedHitAndCrit)
spell.WaitTravelTime(sim, func(s *core.Simulation) {
spell.DealDamage(sim, result)

if hasCobraStrikes && result.DidCrit() {
hunter.CobraStrikesAura.Activate(sim)
hunter.CobraStrikesAura.SetStacks(sim, 2)
}
})
},
}
}

func (hunter *Hunter) registerAimedShotSpell(timer *core.Timer) {
if !hunter.Talents.AimedShot {
return
}

maxRank := 6

for i := 1; i <= maxRank; i++ {
config := hunter.getAimedShotConfig(i, timer)

if config.RequiredLevel <= int(hunter.Level) {
hunter.ArcaneShot = hunter.GetOrRegisterSpell(config)
}
}
}
5 changes: 3 additions & 2 deletions sim/hunter/hunter.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type Hunter struct {
Volley *core.Spell
CarveMh *core.Spell
CarveOh *core.Spell
WingClip *core.Spell

SerpentStingChimeraShot *core.Spell

Expand Down Expand Up @@ -116,14 +117,14 @@ func (hunter *Hunter) Initialize() {

hunter.registerArcaneShotSpell(arcaneShotTimer)
hunter.registerExplosiveShotSpell(arcaneShotTimer)

hunter.registerAimedShotSpell(arcaneShotTimer)
hunter.registerMultiShotSpell(multiShotTimer)

hunter.registerChimeraShotSpell()

hunter.registerRaptorStrikeSpell()
hunter.registerFlankingStrikeSpell()
hunter.registerCarveSpell()
hunter.registerWingClipSpell()

hunter.registerKillCommand()
//hunter.registerRapidFireCD()
Expand Down
55 changes: 55 additions & 0 deletions sim/hunter/wing_clip.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package hunter

import (
"github.com/wowsims/sod/sim/core"
)

func (hunter *Hunter) getWingClipConfig(rank int) core.SpellConfig {
spellId := [4]int32{0, 2974, 14267, 14268}[rank]
baseDamage := [4]float64{0, 5, 25, 50}[rank]
manaCost := [4]float64{0, 40, 60, 80}[rank]
level := [4]int{0, 12, 38, 60}[rank]

return core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellSchool: core.SpellSchoolPhysical,
ProcMask: core.ProcMaskMeleeMHSpecial,
Flags: core.SpellFlagMeleeMetrics | core.SpellFlagIncludeTargetBonusDamage | core.SpellFlagAPL,
Rank: rank,
RequiredLevel: level,

ManaCost: core.ManaCostOptions{
FlatCost: manaCost,
},

Cast: core.CastConfig{
DefaultCast: core.Cast{
GCD: core.GCDDefault,
},
IgnoreHaste: true,
},
ExtraCastCondition: func(sim *core.Simulation, target *core.Unit) bool {
return hunter.DistanceFromTarget <= 5
},

BonusCritRating: 0,
DamageMultiplier: 1,
CritMultiplier: hunter.critMultiplier(false, hunter.CurrentTarget),

ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
spell.CalcAndDealDamage(sim, target, baseDamage, spell.OutcomeMeleeWeaponSpecialHitAndCrit)
},
}
}

func (hunter *Hunter) registerWingClipSpell() {
maxRank := 3

for i := 1; i <= maxRank; i++ {
config := hunter.getWingClipConfig(i)

if config.RequiredLevel <= int(hunter.Level) {
hunter.WingClip = hunter.GetOrRegisterSpell(config)
}
}
}

0 comments on commit 64b5085

Please sign in to comment.