Skip to content

Commit

Permalink
Merge pull request #183 from wowsims/phase-2-items
Browse files Browse the repository at this point in the history
Add Enchant Weapon - Dismantle
  • Loading branch information
kayla-glick authored Feb 14, 2024
2 parents b5dc0ac + 05cfc89 commit 0f74fa1
Show file tree
Hide file tree
Showing 24 changed files with 763 additions and 328 deletions.
Binary file modified assets/database/db.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions assets/database/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -9222,6 +9222,7 @@
{"effectId":1897,"spellId":13695,"name":"Enchant 2H Weapon - Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":2443,"spellId":21931,"name":"Enchant Weapon - Winter's Might","type":13,"stats":[0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":2463,"spellId":13657,"name":"Enchant Cloak - Fire Resistance","type":4,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":7210,"spellId":435481,"name":"Enchant Weapon - Dismantle","type":13,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":4},
{"effectId":7223,"spellId":435903,"name":"Enchant Chest - Retricutioner","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":4}
],
"runes":[
Expand Down Expand Up @@ -11998,6 +11999,7 @@
{"id":415467,"name":"Mass Regeneration","icon":"inv_enchant_essencenetherlarge","requiresLevel":1},
{"id":425168,"name":"Arcane Surge","icon":"spell_arcane_arcanetorrent","requiresLevel":1},
{"id":425169,"name":"Icy Veins","icon":"spell_frost_coldhearted","requiresLevel":1},
{"id":435481,"name":"Enchant Weapon - Dismantle","icon":"spell_holy_greaterheal"},
{"id":435903,"name":"Enchant Chest - Retricutioner","icon":"spell_holy_greaterheal"},
{"id":437327,"name":"Charged Inspiration","icon":"ability_mage_incantersabsorbtion"},
{"id":437362,"name":"Hyperconductive Shock","icon":"spell_shaman_staticshock"}
Expand Down
Binary file modified assets/database/leftover_db.bin
Binary file not shown.
3 changes: 2 additions & 1 deletion assets/database/leftover_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1527,12 +1527,13 @@
{"effectId":911,"spellId":13890,"name":"Enchant Boots - Minor Speed","type":10,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":924,"spellId":7428,"name":"Enchant Bracer - Minor Deflect","type":6,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":925,"spellId":13646,"name":"Enchant Bracer - Lesser Deflection","type":6,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":2},
{"effectId":943,"spellId":13529,"name":"Enchant 2H Weapon - Lesser Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":943,"spellId":13693,"name":"Enchant Weapon - Striking","type":13,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":943,"spellId":13529,"name":"Enchant 2H Weapon - Lesser Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":1843,"itemId":15564,"spellId":19057,"name":"Rugged Armor Kit","type":5,"extraTypes":[9,7,10],"enchantType":3,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":1897,"spellId":13695,"name":"Enchant 2H Weapon - Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":2443,"spellId":21931,"name":"Enchant Weapon - Winter's Might","type":13,"stats":[0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":2463,"spellId":13657,"name":"Enchant Cloak - Fire Resistance","type":4,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":7210,"spellId":435481,"name":"Enchant Weapon - Dismantle","type":13,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":4},
{"effectId":7223,"spellId":435903,"name":"Enchant Chest - Retricutioner","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":4}
],
"runes":[
Expand Down
110 changes: 76 additions & 34 deletions sim/common/sod/enchant_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sod
import (
"github.com/wowsims/sod/sim/core"
"github.com/wowsims/sod/sim/core/proto"
"github.com/wowsims/sod/sim/shaman"
)

func init() {
Expand Down Expand Up @@ -182,47 +183,88 @@ func init() {
// })

// Weapon - Dismantle
// core.NewEnchantEffect(7210, func(agent core.Agent) {
// character := agent.GetCharacter()
core.NewEnchantEffect(7210, func(agent core.Agent) {
character := agent.GetCharacter()

// // TODO: The mechanism for procs is not known yet
// procChance := 0.5
procChance := 0.10
baseDamageLow := 60.0
baseDamageHigh := 90.0

// procSpell := character.RegisterSpell(core.SpellConfig{
// ActionID: core.ActionID{SpellID: 435481},
// SpellSchool: core.SpellSchoolPhysical,
// ProcMask: core.ProcMaskEmpty,
// Flags: core.SpellFlagIgnoreTargetModifiers | core.SpellFlagIgnoreAttackerModifiers,
procSpell := character.GetOrRegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 439164},
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellDamage,

// DamageMultiplier: 1,
// CritMultiplier: 1,
// ThreatMultiplier: 1,
DamageMultiplier: 1,
CritMultiplier: 1,
ThreatMultiplier: 1,

// ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
// damage := sim.Roll(60, 90)
// spell.CalcAndDealDamage(sim, target, damage, spell.OutcomeAlwaysHit)
// },
// })
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
spell.CalcAndDealDamage(sim, target, sim.Roll(baseDamageLow, baseDamageHigh), spell.OutcomeMagicHitAndCrit)
},
})

// aura := character.GetOrRegisterAura(core.Aura{
// Label: "Enchant Weapon - Dismantle",
// 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.Landed() || result.Target.MobType != proto.MobType_MobTypeMechanical {
// return
// }
aura := character.GetOrRegisterAura(core.Aura{
Label: "Enchant Weapon - Dismantle",
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) {
// Dismantle only procs on hits that land
if !result.Landed() {
return
}

// if sim.RandomFloat("Dismantle") < procChance {
// procSpell.Cast(sim, result.Target)
// }
// },
// })
// Dismantle only procs on Mechanical units
if result.Target.MobType != proto.MobType_MobTypeMechanical {
return
}

// character.ItemSwap.RegisterOnSwapItemForEffect(7210, aura)
// })
// Dismantle only procs on attacks from the player character (not pet attacks or totems)
if spell.Unit != &character.Unit || shaman.SpellFlagTotem.Matches(spell.Flags) {
return
}

// Dismantle only procs on direct attacks, not proc effects or DoT ticks
if core.ProcMaskProc.Matches(spell.ProcMask) || core.ProcMaskWeaponProc.Matches(spell.ProcMask) {
return
}

// TODO: Confirm: Dismantle can not proc itself
if spell == procSpell {
return
}

// Main-Hand hits only trigger Dismantle if the MH weapon is enchanted with Dismantle
if core.ProcMaskMeleeMH.Matches(spell.ProcMask) && (character.GetMHWeapon() == nil || character.GetMHWeapon().Enchant.EffectID != 7210) {
return
}

// Off-Hand hits only trigger Dismantle if the MH weapon is enchanted with Dismantle
if core.ProcMaskMeleeOH.Matches(spell.ProcMask) && (character.GetOHWeapon() == nil || character.GetOHWeapon().Enchant.EffectID != 7210) {
return
}

if spell.ProcMask.Matches(core.ProcMaskSpellDamage) {
if sim.RandomFloat("Dismantle") < procChance {
// Spells proc both Main-Hand and Off-Hand if both are enchanted
if character.GetMHWeapon() != nil && character.GetMHWeapon().Enchant.EffectID == 7210 {
procSpell.Cast(sim, result.Target)
}
if character.GetOHWeapon() != nil && character.GetOHWeapon().Enchant.EffectID == 7210 {
procSpell.Cast(sim, result.Target)
}
}
} else if sim.RandomFloat("Dismantle") < procChance {
// Physical hits only proc on the hand that was hit with
procSpell.Cast(sim, result.Target)
}
},
})

character.ItemSwap.RegisterOnSwapItemForEffect(7210, aura)
})

// Cloak - Subtlety
// core.NewEnchantEffect(2621, func(agent core.Agent) {
Expand Down
16 changes: 16 additions & 0 deletions sim/priest/shadow/TestShadow.results
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ character_stats_results: {
final_stats: 0
}
}
dps_results: {
key: "TestShadow-AllItems-HyperconductiveMender'sMeditation"
value: {}
}
dps_results: {
key: "TestShadow-AllItems-HyperconductiveWizard'sAttire"
value: {}
}
dps_results: {
key: "TestShadow-AllItems-IrradiatedGarments"
value: {}
}
dps_results: {
key: "TestShadow-AllItems-TwilightInvoker'sVestments"
value: {}
}
dps_results: {
key: "TestShadow-Average-Default"
value: {}
Expand Down
Loading

0 comments on commit 0f74fa1

Please sign in to comment.