Skip to content

Commit 3d4e16c

Browse files
authored
Gallagher (#328)
* Skeleton * basic atk impl * E2 registration * char struct * gallagher skill impl * stat renaming * ult impl * e6 impl * traces * ult * Added proper behavior of eba turning off enhanced flag, and atk reduction scaling with level * Added energy part of e1 * eidolon and trace initialization * Struct field for heal * technique impl * Ult besotted app now takes into account e4 * Linting + a few forgotten struct fields * fixed atk reduction * wipe besotted from all enemies after death * Added debuff status to besotted
1 parent 4f9f160 commit 3d4e16c

File tree

11 files changed

+721
-0
lines changed

11 files changed

+721
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package gallagher
2+
3+
import (
4+
"github.com/simimpact/srsim/pkg/engine/info"
5+
"github.com/simimpact/srsim/pkg/engine/modifier"
6+
"github.com/simimpact/srsim/pkg/engine/prop"
7+
"github.com/simimpact/srsim/pkg/key"
8+
"github.com/simimpact/srsim/pkg/model"
9+
)
10+
11+
var (
12+
basicHitSplit = []float64{0.5, 0.5}
13+
ebaHitSplit = []float64{0.25, 0.15, 0.6}
14+
)
15+
16+
const (
17+
Normal key.Attack = "gallgher-normal"
18+
NectarBlitz key.Attack = "gallagher-nectar-blitz"
19+
AtkReduction key.Modifier = "gallagher-atk-reduction"
20+
)
21+
22+
func init() {
23+
modifier.Register(AtkReduction, modifier.Config{
24+
StatusType: model.StatusType_STATUS_DEBUFF,
25+
Stacking: modifier.ReplaceBySource,
26+
Duration: 2,
27+
})
28+
}
29+
30+
func (c *char) Attack(target key.TargetID, state info.ActionState) {
31+
if c.isEnhanced {
32+
c.EnhancedBasic(target, state)
33+
} else {
34+
c.Basic(target, state)
35+
}
36+
}
37+
38+
func (c *char) Basic(target key.TargetID, state info.ActionState) {
39+
for index, ratio := range basicHitSplit {
40+
c.engine.Attack(
41+
info.Attack{
42+
Source: c.id,
43+
Targets: []key.TargetID{target},
44+
Key: Normal,
45+
HitIndex: index,
46+
HitRatio: ratio,
47+
BaseDamage: info.DamageMap{
48+
model.DamageFormula_BY_ATK: basic[c.info.AttackLevelIndex()],
49+
},
50+
AttackType: model.AttackType_NORMAL,
51+
DamageType: model.DamageType_FIRE,
52+
StanceDamage: 30,
53+
EnergyGain: 20,
54+
},
55+
)
56+
}
57+
58+
state.EndAttack()
59+
}
60+
61+
func (c *char) EnhancedBasic(target key.TargetID, state info.ActionState) {
62+
for index, ratio := range ebaHitSplit {
63+
c.engine.Attack(
64+
info.Attack{
65+
Source: c.id,
66+
Targets: []key.TargetID{target},
67+
Key: NectarBlitz,
68+
HitIndex: index,
69+
HitRatio: ratio,
70+
BaseDamage: info.DamageMap{
71+
model.DamageFormula_BY_ATK: enhancedBasic[c.info.AttackLevelIndex()],
72+
},
73+
AttackType: model.AttackType_NORMAL,
74+
DamageType: model.DamageType_FIRE,
75+
StanceDamage: 90,
76+
EnergyGain: 20,
77+
},
78+
)
79+
}
80+
state.EndAttack()
81+
82+
c.engine.AddModifier(target, info.Modifier{
83+
Name: AtkReduction,
84+
Source: c.id,
85+
Duration: 2,
86+
Stats: info.PropMap{
87+
prop.ATKPercent: -ebaAtkReduction[c.info.AttackLevelIndex()],
88+
},
89+
})
90+
91+
c.isEnhanced = false
92+
}

internal/character/gallagher/data.go

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package gallagher
2+
3+
import (
4+
"github.com/simimpact/srsim/pkg/engine/event"
5+
"github.com/simimpact/srsim/pkg/engine/info"
6+
"github.com/simimpact/srsim/pkg/engine/modifier"
7+
"github.com/simimpact/srsim/pkg/engine/prop"
8+
"github.com/simimpact/srsim/pkg/model"
9+
)
10+
11+
const (
12+
E1 = "gallagher-e1"
13+
E2 = "gallagher-e2"
14+
E6 = "gallagher-e6"
15+
)
16+
17+
func init() {
18+
modifier.Register(E1, modifier.Config{})
19+
20+
modifier.Register(E2, modifier.Config{
21+
StatusType: model.StatusType_STATUS_BUFF,
22+
Stacking: modifier.ReplaceBySource,
23+
Duration: 2,
24+
})
25+
26+
modifier.Register(E6, modifier.Config{})
27+
}
28+
29+
func (c *char) initEidolons() {
30+
c.engine.Events().BattleStart.Subscribe(c.E1Buffs)
31+
32+
if c.info.Eidolon >= 6 {
33+
c.engine.AddModifier(c.id, info.Modifier{
34+
Name: E6,
35+
Source: c.id,
36+
Stats: info.PropMap{
37+
prop.BreakEffect: 0.2,
38+
prop.AllStanceDMGPercent: 0.2,
39+
},
40+
})
41+
}
42+
}
43+
44+
func (c *char) E1Buffs(e event.BattleStart) {
45+
c.engine.AddModifier(c.id, info.Modifier{
46+
Name: E1,
47+
Source: c.id,
48+
Stats: info.PropMap{
49+
prop.EffectRES: 0.5,
50+
},
51+
})
52+
53+
c.engine.ModifyEnergy(info.ModifyAttribute{
54+
Target: c.id,
55+
Source: c.id,
56+
Key: E1,
57+
Amount: 20,
58+
})
59+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package gallagher
2+
3+
import (
4+
"github.com/simimpact/srsim/pkg/engine"
5+
"github.com/simimpact/srsim/pkg/engine/info"
6+
"github.com/simimpact/srsim/pkg/engine/target/character"
7+
"github.com/simimpact/srsim/pkg/key"
8+
"github.com/simimpact/srsim/pkg/model"
9+
)
10+
11+
func init() {
12+
character.Register(key.Gallagher, character.Config{
13+
Create: NewInstance,
14+
Rarity: 4,
15+
Element: model.DamageType_FIRE,
16+
Path: model.Path_ABUNDANCE,
17+
MaxEnergy: 110,
18+
Promotions: promotions,
19+
Traces: traces,
20+
SkillInfo: character.SkillInfo{
21+
Attack: character.Attack{
22+
SPAdd: 1,
23+
TargetType: model.TargetType_ENEMIES,
24+
},
25+
Skill: character.Skill{
26+
SPNeed: 1,
27+
TargetType: model.TargetType_ALLIES,
28+
},
29+
Ult: character.Ult{
30+
TargetType: model.TargetType_ENEMIES,
31+
},
32+
Technique: character.Technique{
33+
TargetType: model.TargetType_SELF,
34+
IsAttack: true,
35+
},
36+
},
37+
})
38+
}
39+
40+
type char struct {
41+
engine engine.Engine
42+
id key.TargetID
43+
info info.Character
44+
isEnhanced bool
45+
}
46+
47+
func NewInstance(engine engine.Engine, id key.TargetID, charInfo info.Character) info.CharInstance {
48+
c := &char{
49+
engine: engine,
50+
id: id,
51+
info: charInfo,
52+
isEnhanced: false,
53+
}
54+
55+
c.initEidolons()
56+
c.initTraces()
57+
58+
c.engine.Events().TargetDeath.Subscribe(c.wipeBesotted)
59+
60+
return c
61+
}

0 commit comments

Comments
 (0)