Skip to content

Commit

Permalink
Merge pull request #467 from shizukayuki/cleanup
Browse files Browse the repository at this point in the history
Move mods under init
  • Loading branch information
srliao authored Apr 14, 2022
2 parents d6d23d9 + 072fa9a commit 011ef42
Show file tree
Hide file tree
Showing 57 changed files with 462 additions and 364 deletions.
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ A rough guideline for your comment is as follows:
- [ ] C0 Skill
- [ ] C0 Burst
- [ ] A1
- [ ] A2
- [ ] A4
- [ ] Sanity Test Cases
- [ ] C1
Expand All @@ -37,7 +36,6 @@ A rough guideline for your comment is as follows:
- [ ] C0 Skill
- [ ] C0 Burst
- [ ] A1
- [ ] A2
- [ ] A4
- [ ] Sanity Test Cases
- [ ] C1
Expand Down
14 changes: 9 additions & 5 deletions internal/characters/albedo/albedo.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,23 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.EnergyMax = 40
c.Weapon.Class = core.WeaponClassSword
c.NormalHitNum = 5

c.icdSkill = 0

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

c.skillHook()

if c.Base.Cons >= 4 {
c.c4()
}

if c.Base.Cons == 6 {
c.c6()
}

return &c, nil
}

func (c *char) ActionStam(a core.ActionType, p map[string]int) float64 {
Expand All @@ -66,7 +70,7 @@ func (c *char) ActionStam(a core.ActionType, p map[string]int) float64 {

/**
a2: skill tick deal 25% more dmg if enemy hp < 50%
a1: skill tick deal 25% more dmg if enemy hp < 50%
a4: burst increase party em by 125 for 10s
Expand Down Expand Up @@ -224,7 +228,7 @@ func (c *char) skillHook() {

if c.Core.Flags.DamageMode && t.HP()/t.MaxHP() < .5 {
snap.Stats[core.DmgP] += 0.25
c.Core.Log.NewEvent("a2 proc'd, dealing extra dmg", core.LogCharacterEvent, c.Index, "hp %", t.HP()/t.MaxHP(), "final dmg", snap.Stats[core.DmgP])
c.Core.Log.NewEvent("a1 proc'd, dealing extra dmg", core.LogCharacterEvent, c.Index, "hp %", t.HP()/t.MaxHP(), "final dmg", snap.Stats[core.DmgP])
}

c.Core.Combat.QueueAttackWithSnap(c.skillAttackInfo, snap, core.NewDefCircHit(3, false, core.TargettableEnemy), 1)
Expand Down
8 changes: 6 additions & 2 deletions internal/characters/aloy/aloy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {

c.Tags["coil_stacks"] = 0

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

c.coilMod()
c.onExitField()

return &c, nil
}

// Add coil mod at the beginning of the sim
Expand Down
21 changes: 1 addition & 20 deletions internal/characters/amber/abil.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,7 @@ func (c *char) Aimed(p map[string]int) (int, int) {
Mult: aim[c.TalentLvlAttack()],
HitWeakPoint: weakspot == 1,
}

// d.AnimationFrames = f

//add 15% since 360noscope
cb := func(a core.AttackCB) {
if a.AttackEvent.Info.HitWeakPoint {
c.AddMod(core.CharStatMod{
Key: "a2",
Amount: func() ([]float64, bool) {
val := make([]float64, core.EndStatType)
val[core.ATKP] = 0.15
return val, true
},
Expiry: c.Core.F + 600,
})
}

}

c.Core.Combat.QueueAttack(ai, core.NewDefSingleTarget(1, core.TargettableEnemy), f, f+travel, cb)
c.Core.Combat.QueueAttack(ai, core.NewDefSingleTarget(1, core.TargettableEnemy), f, f+travel, c.a4)

if c.Base.Cons >= 1 {
ai.Mult = .2 * ai.Mult
Expand Down
42 changes: 33 additions & 9 deletions internal/characters/amber/amber.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,51 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.BurstCon = 3
c.SkillCon = 5

c.bunnies = make([]bunny, 0, 2)

if c.Base.Cons >= 4 {
c.SetNumCharges(core.ActionSkill, 2)
}

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

c.a1()

if c.Base.Cons >= 2 {
c.overloadExplode()
}
c.a2()
c.bunnies = make([]bunny, 0, 2)

return &c, nil
}

func (c *char) a2() {
func (c *char) a1() {
m := make([]float64, core.EndStatType)
m[core.CR] = .1

c.AddPreDamageMod(core.PreDamageMod{
Key: "amber-a2",
Key: "amber-a1",
Expiry: -1,
Amount: func(atk *core.AttackEvent, t core.Target) ([]float64, bool) {
v := make([]float64, core.EndStatType)
v[core.CR] = .1
return v, atk.Info.AttackTag == core.AttackTagElementalBurst
return m, atk.Info.AttackTag == core.AttackTagElementalBurst
},
})
}

func (c *char) a4(a core.AttackCB) {
if !a.AttackEvent.Info.HitWeakPoint {
return
}

m := make([]float64, core.EndStatType)
m[core.ATKP] = 0.15

c.AddMod(core.CharStatMod{
Key: "amber-a4",
Expiry: c.Core.F + 600,
Amount: func() ([]float64, bool) {
return m, true
},
})
}
2 changes: 1 addition & 1 deletion internal/characters/ayaka/abil.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (c *char) Dash(p map[string]int) (int, int) {
c.Core.RestoreStam(10)
val := make([]float64, core.EndStatType)
val[core.CryoP] = 0.18
//a2 increase normal + ca dmg by 30% for 6s
//a1 increase normal + ca dmg by 30% for 6s
c.AddMod(core.CharStatMod{
Key: "ayaka-a4",
Expiry: c.Core.F + 600,
Expand Down
13 changes: 11 additions & 2 deletions internal/characters/ayaka/ayaka.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,29 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.BurstCon = 3
c.SkillCon = 5
c.NormalHitNum = 5
c.InitCancelFrames()

c.icdC1 = -1
c.c6CDTimerAvail = false

// Start with C6 ability active
if c.Base.Cons == 6 {
c.c6CDTimerAvail = true
c.c6AddBuff()
}

c.InitCancelFrames()

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

// Start with C6 ability active
if c.Base.Cons == 6 {
c.c6AddBuff()
}
}

func (c *char) ActionStam(a core.ActionType, p map[string]int) float64 {
switch a {
case core.ActionDash:
Expand Down
21 changes: 12 additions & 9 deletions internal/characters/ayato/ayato.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,36 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.NormalHitNum = 5

c.shunsuikenCounter = 3
c.stacksMax = 4
c.particleICD = 0
c.a4ICD = 0
c.c6ready = false

c.stacksMax = 4
if c.Base.Cons >= 2 {
c.stacksMax = 5
}

c.InitCancelFrames()

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()
c.a2()

c.a1()
c.a4()
c.onExitField()

if c.Base.Cons >= 1 {
c.c1()
}
if c.Base.Cons >= 2 {
c.stacksMax = 5
c.c2()
}
if c.Base.Cons >= 6 {
c.c6()
}

c.InitCancelFrames()

}

func (c *char) ActionStam(a core.ActionType, p map[string]int) float64 {
Expand Down Expand Up @@ -116,15 +119,15 @@ func (c *char) c6() {
}, "ayato-c6")
}

func (c *char) a2() {
func (c *char) a1() {
c.Core.Events.Subscribe(core.PostSkill, func(args ...interface{}) bool {
if c.Core.ActiveChar != c.CharIndex() {
return false
}
c.stacks = 2
c.Core.Log.NewEvent("ayato a2 proc'd", core.LogCharacterEvent, c.Index)
c.Core.Log.NewEvent("ayato a1 proc'd", core.LogCharacterEvent, c.Index)
return false
}, "ayato-a2")
}, "ayato-a1")
}

func (c *char) a4() {
Expand Down
8 changes: 7 additions & 1 deletion internal/characters/barbara/barbara.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
}
c.Tmpl = t
c.Base.Element = core.Hydro

e, ok := p.Params["start_energy"]
if !ok {
e = 80
Expand All @@ -35,6 +36,12 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.SkillCon = 5
c.NormalHitNum = 4

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

c.a1()

if c.Base.Cons >= 1 {
Expand All @@ -46,7 +53,6 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
if c.Base.Cons >= 6 {
c.c6()
}
return &c, nil
}

func (c *char) a1() {
Expand Down
8 changes: 6 additions & 2 deletions internal/characters/beidou/beidou.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.NormalHitNum = 5
c.CharZone = core.ZoneLiyue

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

c.burstProc()
c.a4()

if c.Base.Cons >= 4 {
c.c4()
}

return &c, nil
}

/**
Expand Down
10 changes: 6 additions & 4 deletions internal/characters/bennett/bennett.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.NormalHitNum = 5
c.Base.Element = core.Pyro

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

if c.Base.Cons >= 2 {
c.c2()
}

//add effect for burst

return &c, nil
}

func (c *char) c2() {
Expand Down
12 changes: 8 additions & 4 deletions internal/characters/chongyun/chongyun.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,23 @@ func NewChar(s *core.Core, p core.CharacterProfile) (core.Character, error) {
c.BurstCon = 3
c.SkillCon = 5
c.CharZone = core.ZoneLiyue

c.fieldSrc = -601

return &c, nil
}

func (c *char) Init() {
c.Tmpl.Init()

c.onSwapHook()

if c.Base.Cons >= 4 {
c.c4()
}

if c.Base.Cons == 6 && c.Core.Flags.DamageMode {
c.c6()
}

return &c, nil
}

func (c *char) c4() {
Expand Down Expand Up @@ -121,7 +125,7 @@ func (c *char) infuse(char core.Character) {
return
}

//a2 adds 8% atkspd for 2.1 seconds
//a1 adds 8% atkspd for 2.1 seconds
val := make([]float64, core.EndStatType)
val[core.AtkSpd] = 0.08
char.AddMod(core.CharStatMod{
Expand Down
Loading

0 comments on commit 011ef42

Please sign in to comment.