Skip to content

Commit 84a781d

Browse files
committed
move reactiontype and durability to model
1 parent 4e54b18 commit 84a781d

30 files changed

Lines changed: 215 additions & 215 deletions

File tree

internal/artifacts/scrolloftheheroofcindercity/scrolloftheheroofcindercity.go

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ import (
1313
"github.com/genshinsim/gcsim/pkg/core/keys"
1414
"github.com/genshinsim/gcsim/pkg/core/player/character"
1515
"github.com/genshinsim/gcsim/pkg/core/targets"
16-
"github.com/genshinsim/gcsim/pkg/model/reactions"
16+
"github.com/genshinsim/gcsim/pkg/model"
1717
"github.com/genshinsim/gcsim/pkg/modifier"
1818
)
1919

20-
var reactToElements = map[reactions.ReactionType][]attributes.Element{
21-
reactions.Overload: {attributes.Electro, attributes.Pyro},
22-
reactions.Superconduct: {attributes.Electro, attributes.Cryo},
23-
reactions.Melt: {attributes.Pyro, attributes.Cryo},
24-
reactions.Vaporize: {attributes.Pyro, attributes.Hydro},
25-
reactions.Freeze: {attributes.Cryo, attributes.Hydro},
26-
reactions.ElectroCharged: {attributes.Electro, attributes.Hydro},
27-
reactions.SwirlHydro: {attributes.Anemo, attributes.Hydro},
28-
reactions.SwirlCryo: {attributes.Anemo, attributes.Cryo},
29-
reactions.SwirlElectro: {attributes.Anemo, attributes.Electro},
30-
reactions.SwirlPyro: {attributes.Anemo, attributes.Pyro},
31-
reactions.CrystallizeHydro: {attributes.Geo, attributes.Hydro},
32-
reactions.CrystallizeCryo: {attributes.Geo, attributes.Cryo},
33-
reactions.CrystallizeElectro: {attributes.Geo, attributes.Electro},
34-
reactions.CrystallizePyro: {attributes.Geo, attributes.Pyro},
35-
reactions.Aggravate: {attributes.Dendro, attributes.Electro},
36-
reactions.Spread: {attributes.Dendro},
37-
reactions.Quicken: {attributes.Dendro, attributes.Electro},
38-
reactions.Bloom: {attributes.Dendro, attributes.Hydro},
39-
reactions.Hyperbloom: {attributes.Dendro, attributes.Electro},
40-
reactions.Burgeon: {attributes.Dendro, attributes.Pyro},
41-
reactions.Burning: {attributes.Dendro, attributes.Pyro},
20+
var reactToElements = map[model.ReactionType][]attributes.Element{
21+
model.ReactionTypeOverload: {attributes.Electro, attributes.Pyro},
22+
model.ReactionTypeSuperconduct: {attributes.Electro, attributes.Cryo},
23+
model.ReactionTypeMelt: {attributes.Pyro, attributes.Cryo},
24+
model.ReactionTypeVaporize: {attributes.Pyro, attributes.Hydro},
25+
model.ReactionTypeFreeze: {attributes.Cryo, attributes.Hydro},
26+
model.ReactionTypeElectroCharged: {attributes.Electro, attributes.Hydro},
27+
model.ReactionTypeSwirlHydro: {attributes.Anemo, attributes.Hydro},
28+
model.ReactionTypeSwirlCryo: {attributes.Anemo, attributes.Cryo},
29+
model.ReactionTypeSwirlElectro: {attributes.Anemo, attributes.Electro},
30+
model.ReactionTypeSwirlPyro: {attributes.Anemo, attributes.Pyro},
31+
model.ReactionTypeCrystallizeHydro: {attributes.Geo, attributes.Hydro},
32+
model.ReactionTypeCrystallizeCryo: {attributes.Geo, attributes.Cryo},
33+
model.ReactionTypeCrystallizeElectro: {attributes.Geo, attributes.Electro},
34+
model.ReactionTypeCrystallizePyro: {attributes.Geo, attributes.Pyro},
35+
model.ReactionTypeAggravate: {attributes.Dendro, attributes.Electro},
36+
model.ReactionTypeSpread: {attributes.Dendro},
37+
model.ReactionTypeQuicken: {attributes.Dendro, attributes.Electro},
38+
model.ReactionTypeBloom: {attributes.Dendro, attributes.Hydro},
39+
model.ReactionTypeHyperbloom: {attributes.Dendro, attributes.Electro},
40+
model.ReactionTypeBurgeon: {attributes.Dendro, attributes.Pyro},
41+
model.ReactionTypeBurning: {attributes.Dendro, attributes.Pyro},
4242
}
4343

4444
func init() {
@@ -59,7 +59,7 @@ func (s *Set) SetIndex(idx int) { s.Index = idx }
5959
func (s *Set) GetCount() int { return s.Count }
6060
func (s *Set) Init() error { return nil }
6161

62-
func (s *Set) buffCB(react reactions.ReactionType, gadgetEmit bool) func(args ...interface{}) bool {
62+
func (s *Set) buffCB(react model.ReactionType, gadgetEmit bool) func(args ...interface{}) bool {
6363
return func(args ...interface{}) bool {
6464
trg := args[0].(combat.Target)
6565
if gadgetEmit && trg.Type() != targets.TargettableGadget {
@@ -132,36 +132,36 @@ func NewSet(c *core.Core, char *character.CharWrapper, count int, param map[stri
132132
// equipping character can trigger this effect while off-field, and the DMG bonus
133133
// from Artifact Sets with the same name do not stack.
134134
if count >= 4 {
135-
for evt, react := range map[event.Event]reactions.ReactionType{
136-
event.OnOverload: reactions.Overload,
137-
event.OnSuperconduct: reactions.Superconduct,
138-
event.OnMelt: reactions.Melt,
139-
event.OnVaporize: reactions.Vaporize,
140-
event.OnFrozen: reactions.Freeze,
141-
event.OnElectroCharged: reactions.ElectroCharged,
142-
event.OnSwirlHydro: reactions.SwirlHydro,
143-
event.OnSwirlCryo: reactions.SwirlCryo,
144-
event.OnSwirlElectro: reactions.SwirlElectro,
145-
event.OnSwirlPyro: reactions.SwirlPyro,
146-
event.OnCrystallizeHydro: reactions.CrystallizeHydro,
147-
event.OnCrystallizeCryo: reactions.CrystallizeCryo,
148-
event.OnCrystallizeElectro: reactions.CrystallizeElectro,
149-
event.OnCrystallizePyro: reactions.CrystallizePyro,
150-
event.OnAggravate: reactions.Aggravate,
151-
event.OnSpread: reactions.Spread,
152-
event.OnQuicken: reactions.Quicken,
153-
event.OnBloom: reactions.Bloom,
154-
event.OnHyperbloom: reactions.Hyperbloom,
155-
event.OnBurgeon: reactions.Burgeon,
156-
event.OnBurning: reactions.Burning,
135+
for evt, react := range map[event.Event]model.ReactionType{
136+
event.OnOverload: model.ReactionTypeOverload,
137+
event.OnSuperconduct: model.ReactionTypeSuperconduct,
138+
event.OnMelt: model.ReactionTypeMelt,
139+
event.OnVaporize: model.ReactionTypeVaporize,
140+
event.OnFrozen: model.ReactionTypeFreeze,
141+
event.OnElectroCharged: model.ReactionTypeElectroCharged,
142+
event.OnSwirlHydro: model.ReactionTypeSwirlHydro,
143+
event.OnSwirlCryo: model.ReactionTypeSwirlCryo,
144+
event.OnSwirlElectro: model.ReactionTypeSwirlElectro,
145+
event.OnSwirlPyro: model.ReactionTypeSwirlPyro,
146+
event.OnCrystallizeHydro: model.ReactionTypeCrystallizeHydro,
147+
event.OnCrystallizeCryo: model.ReactionTypeCrystallizeCryo,
148+
event.OnCrystallizeElectro: model.ReactionTypeCrystallizeElectro,
149+
event.OnCrystallizePyro: model.ReactionTypeCrystallizePyro,
150+
event.OnAggravate: model.ReactionTypeAggravate,
151+
event.OnSpread: model.ReactionTypeSpread,
152+
event.OnQuicken: model.ReactionTypeQuicken,
153+
event.OnBloom: model.ReactionTypeBloom,
154+
event.OnHyperbloom: model.ReactionTypeHyperbloom,
155+
event.OnBurgeon: model.ReactionTypeBurgeon,
156+
event.OnBurning: model.ReactionTypeBurning,
157157
} {
158158
elements := reactToElements[react]
159159
if !slices.Contains(elements, char.Base.Element) {
160160
continue
161161
}
162162
gadgetEmit := false
163163
switch react {
164-
case reactions.Burgeon, reactions.Hyperbloom:
164+
case model.ReactionTypeBurgeon, model.ReactionTypeHyperbloom:
165165
gadgetEmit = true
166166
}
167167
c.Combat.Events.Subscribe(evt, s.buffCB(react, gadgetEmit), fmt.Sprintf("scroll-4pc-%v-%v", react, char.Base.Key.String()))

internal/artifacts/thunderingfury/thunderingfury.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/genshinsim/gcsim/pkg/core/keys"
1515
"github.com/genshinsim/gcsim/pkg/core/player/character"
1616
"github.com/genshinsim/gcsim/pkg/enemy"
17-
"github.com/genshinsim/gcsim/pkg/model/reactions"
17+
"github.com/genshinsim/gcsim/pkg/model"
1818
"github.com/genshinsim/gcsim/pkg/modifier"
1919
)
2020

@@ -60,7 +60,7 @@ func NewSet(c *core.Core, char *character.CharWrapper, count int, param map[stri
6060
char.AddReactBonusMod(character.ReactBonusMod{
6161
Base: modifier.NewBase("tf-4pc", -1),
6262
Amount: func(ai combat.AttackInfo) (float64, bool) {
63-
if ai.Catalyzed && ai.CatalyzedType == reactions.Aggravate {
63+
if ai.Catalyzed && ai.CatalyzedType == model.ReactionTypeAggravate {
6464
return 0.2, false
6565
}
6666
switch ai.AttackTag {

internal/characters/amber/bunny.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/genshinsim/gcsim/pkg/core/targets"
1313
"github.com/genshinsim/gcsim/pkg/enemy"
1414
"github.com/genshinsim/gcsim/pkg/gadget"
15-
"github.com/genshinsim/gcsim/pkg/model/reactions"
15+
"github.com/genshinsim/gcsim/pkg/model"
1616
"github.com/genshinsim/gcsim/pkg/reactable"
1717
)
1818

@@ -36,7 +36,7 @@ func (b *Bunny) HandleAttack(atk *combat.AttackEvent) float64 {
3636
//TODO: Check if sucrose E or faruzan E on Bunny is 25 dur or 50 dur
3737

3838
if atk.Info.Durability > 0 {
39-
atk.Info.Durability *= reactions.Durability(b.WillApplyEle(atk.Info.ICDTag, atk.Info.ICDGroup, atk.Info.ActorIndex))
39+
atk.Info.Durability *= model.Durability(b.WillApplyEle(atk.Info.ICDTag, atk.Info.ICDGroup, atk.Info.ActorIndex))
4040
if atk.Info.Durability > 0 && atk.Info.Element != attributes.Physical {
4141
existing := b.Reactable.ActiveAuraString()
4242
applied := atk.Info.Durability

internal/characters/baizhu/asc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/genshinsim/gcsim/pkg/core/attributes"
66
"github.com/genshinsim/gcsim/pkg/core/combat"
77
"github.com/genshinsim/gcsim/pkg/core/player/character"
8-
"github.com/genshinsim/gcsim/pkg/model/reactions"
8+
"github.com/genshinsim/gcsim/pkg/model"
99
"github.com/genshinsim/gcsim/pkg/modifier"
1010
)
1111

@@ -64,7 +64,7 @@ func (c *char) a4() {
6464
if limitHP > 50 {
6565
limitHP = 50
6666
}
67-
if ai.Catalyzed && (ai.CatalyzedType == reactions.Aggravate || ai.CatalyzedType == reactions.Spread) {
67+
if ai.Catalyzed && (ai.CatalyzedType == model.ReactionTypeAggravate || ai.CatalyzedType == model.ReactionTypeSpread) {
6868
return limitHP * 0.008, false
6969
}
7070
switch ai.AttackTag {

internal/characters/dori/burst.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/genshinsim/gcsim/pkg/core/combat"
1212
"github.com/genshinsim/gcsim/pkg/core/geometry"
1313
"github.com/genshinsim/gcsim/pkg/core/info"
14-
"github.com/genshinsim/gcsim/pkg/model/reactions"
14+
"github.com/genshinsim/gcsim/pkg/model"
1515
)
1616

1717
var burstFrames []int
@@ -75,7 +75,7 @@ func (c *char) Burst(p map[string]int) (action.Info, error) {
7575
External: true,
7676
})
7777
if c.Core.F > icdSrc[idx]+attacks.ICDGroupResetTimer[attacks.ICDGroupDoriBurst] {
78-
dur := reactions.Durability(25)
78+
dur := model.Durability(25)
7979
if p.AuraCount() == 0 {
8080
dur = 20
8181
}

internal/characters/lynette/bogglecatbox.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/genshinsim/gcsim/pkg/core/geometry"
1111
"github.com/genshinsim/gcsim/pkg/core/glog"
1212
"github.com/genshinsim/gcsim/pkg/gadget"
13-
"github.com/genshinsim/gcsim/pkg/model/reactions"
13+
"github.com/genshinsim/gcsim/pkg/model"
1414
)
1515

1616
type BogglecatBox struct {
@@ -86,7 +86,7 @@ func (b *BogglecatBox) HandleAttack(atk *combat.AttackEvent) float64 {
8686
if atk.Info.Durability <= 0 {
8787
return 0
8888
}
89-
atk.Info.Durability *= reactions.Durability(b.WillApplyEle(atk.Info.ICDTag, atk.Info.ICDGroup, atk.Info.ActorIndex))
89+
atk.Info.Durability *= model.Durability(b.WillApplyEle(atk.Info.ICDTag, atk.Info.ICDGroup, atk.Info.ActorIndex))
9090
if atk.Info.Durability <= 0 {
9191
return 0
9292
}

internal/characters/nilou/bountifulcore.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/genshinsim/gcsim/pkg/core/glog"
1010
"github.com/genshinsim/gcsim/pkg/core/targets"
1111
"github.com/genshinsim/gcsim/pkg/gadget"
12-
"github.com/genshinsim/gcsim/pkg/model/reactions"
12+
"github.com/genshinsim/gcsim/pkg/model"
1313
"github.com/genshinsim/gcsim/pkg/reactable"
1414
)
1515

@@ -39,7 +39,7 @@ func newBountifulCore(c *core.Core, p geometry.Point, a *combat.AttackEvent) *Bo
3939
c.QueueAttackWithSnap(ai, snap, ap, 0)
4040

4141
// self damage
42-
ai.Abil += reactions.SelfDamageSuffix
42+
ai.Abil += model.SelfDamageSuffix
4343
ai.FlatDmg = 0.05 * ai.FlatDmg
4444
ap.SkipTargets[targets.TargettablePlayer] = false
4545
ap.SkipTargets[targets.TargettableEnemy] = true

internal/characters/traveler/common/dendro/lealotus.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/genshinsim/gcsim/pkg/core/geometry"
1111
"github.com/genshinsim/gcsim/pkg/core/glog"
1212
"github.com/genshinsim/gcsim/pkg/gadget"
13-
"github.com/genshinsim/gcsim/pkg/model/reactions"
13+
"github.com/genshinsim/gcsim/pkg/model"
1414
"github.com/genshinsim/gcsim/pkg/reactable"
1515
)
1616

@@ -91,7 +91,7 @@ func (s *LeaLotus) HandleAttack(atk *combat.AttackEvent) float64 {
9191
s.ShatterCheck(atk)
9292

9393
if atk.Info.Durability > 0 {
94-
atk.Info.Durability *= reactions.Durability(s.WillApplyEle(atk.Info.ICDTag, atk.Info.ICDGroup, atk.Info.ActorIndex))
94+
atk.Info.Durability *= model.Durability(s.WillApplyEle(atk.Info.ICDTag, atk.Info.ICDGroup, atk.Info.ActorIndex))
9595
if atk.Info.Durability > 0 && atk.Info.Element != attributes.Physical {
9696
existing := s.Reactable.ActiveAuraString()
9797
applied := atk.Info.Durability

pkg/avatar/avatar.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/genshinsim/gcsim/pkg/core/glog"
1212
"github.com/genshinsim/gcsim/pkg/core/info"
1313
"github.com/genshinsim/gcsim/pkg/core/targets"
14-
"github.com/genshinsim/gcsim/pkg/model/reactions"
14+
"github.com/genshinsim/gcsim/pkg/model"
1515
"github.com/genshinsim/gcsim/pkg/reactable"
1616
"github.com/genshinsim/gcsim/pkg/target"
1717
)
@@ -231,7 +231,7 @@ func (p *Player) calc(atk *combat.AttackEvent) (float64, bool) {
231231
return damage, isCrit
232232
}
233233

234-
func (p *Player) ApplySelfInfusion(ele attributes.Element, dur reactions.Durability, f int) {
234+
func (p *Player) ApplySelfInfusion(ele attributes.Element, dur model.Durability, f int) {
235235
p.Core.Log.NewEventBuildMsg(glog.LogPlayerEvent, -1, "self infusion applied: "+ele.String()).
236236
Write("durability", dur).
237237
Write("duration", f)
@@ -264,7 +264,7 @@ func (p *Player) ApplySelfInfusion(ele attributes.Element, dur reactions.Durabil
264264
}
265265
// otherwise calculate decay based on specified f (in frames)
266266
p.Durability[mod] = dur
267-
p.DecayRate[mod] = dur / reactions.Durability(f)
267+
p.DecayRate[mod] = dur / model.Durability(f)
268268
}
269269

270270
func (p *Player) ReactWithSelf(atk *combat.AttackEvent) {

pkg/conditional/enemy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/genshinsim/gcsim/pkg/core"
99
"github.com/genshinsim/gcsim/pkg/core/attributes"
1010
"github.com/genshinsim/gcsim/pkg/enemy"
11-
"github.com/genshinsim/gcsim/pkg/model/reactions"
11+
"github.com/genshinsim/gcsim/pkg/model"
1212
"github.com/genshinsim/gcsim/pkg/reactable"
1313
)
1414

@@ -50,7 +50,7 @@ func evalElement(c *core.Core, fields []string) (float64, error) {
5050
}
5151

5252
if ele == "burning" {
53-
result := reactions.Durability(0)
53+
result := model.Durability(0)
5454
if e.IsBurning() {
5555
result = e.Durability[reactable.Burning]
5656
}
@@ -61,7 +61,7 @@ func evalElement(c *core.Core, fields []string) (float64, error) {
6161
if elekey == attributes.UnknownElement {
6262
return 0, fmt.Errorf("bad element condition: invalid element %s", ele)
6363
}
64-
result := reactions.Durability(0)
64+
result := model.Durability(0)
6565
for i := reactable.Invalid; i < reactable.EndModifier; i++ {
6666
if i.Element() == elekey && e.Durability[i] > reactable.ZeroDur && e.Durability[i] > result {
6767
result = e.Durability[i]

0 commit comments

Comments
 (0)