Skip to content

Commit

Permalink
update from wfpsim
Browse files Browse the repository at this point in the history
  • Loading branch information
kengzzzz committed Jul 6, 2024
1 parent cc41f55 commit 76a9962
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 77 deletions.
53 changes: 53 additions & 0 deletions internal/characters/emilie/asc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package emilie

import (
"github.com/genshinsim/gcsim/pkg/core/attacks"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/event"
"github.com/genshinsim/gcsim/pkg/core/geometry"
"github.com/genshinsim/gcsim/pkg/core/player/character"
"github.com/genshinsim/gcsim/pkg/enemy"
"github.com/genshinsim/gcsim/pkg/modifier"
)

func (c *char) a1() {
if c.Base.Ascension < 1 {
return
}
c.Core.Events.Subscribe(event.OnEmilieA1, func(args ...interface{}) bool {
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Emilie Passive A1",
AttackTag: attacks.AttackTagNone,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeDefault,
Element: attributes.Dendro,
Durability: 25,
Mult: 6.0,
}
ap := combat.NewCircleHitOnTarget(c.Core.Combat.PrimaryTarget(), geometry.Point{Y: 4.5}, 3)
c.Core.QueueAttack(ai, ap, 0, 30)
return false
}, "emilie-a1")
}

func (c *char) a4() {
if c.Base.Ascension < 4 {
return
}
m := make([]float64, attributes.EndStatType)
m[attributes.DmgP] = min(c.getTotalAtk()/1000*0.15, 0.36)
c.AddAttackMod(character.AttackMod{
Base: modifier.NewBase("emilie-a4", -1),
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) {
if e, ok := t.(*enemy.Enemy); !(ok && e.IsBurning()) {
return nil, false
}
return m, true
},
})
}

// A4 is not implemented:
99 changes: 99 additions & 0 deletions internal/characters/emilie/burst.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package emilie

import (
"github.com/genshinsim/gcsim/internal/frames"
"github.com/genshinsim/gcsim/pkg/core/action"
"github.com/genshinsim/gcsim/pkg/core/attacks"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/geometry"
)

var (
burstFrames []int
)

const (
burstHitmark = 104
burstDuration = 168
burstInterval = 18
burstMarkKey = "emilie-burst-mark"
)

func init() {
burstFrames = frames.InitAbilSlice(127)
burstFrames[action.ActionAttack] = 102
burstFrames[action.ActionSkill] = 102
burstFrames[action.ActionDash] = 103
burstFrames[action.ActionJump] = 103
burstFrames[action.ActionSwap] = 93
}

func (c *char) Burst(_ map[string]int) (action.Info, error) {
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Aromatic Explication",
AttackTag: attacks.AttackTagElementalBurst,
ICDTag: attacks.ICDTagElementalBurst,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeDefault,
Element: attributes.Dendro,
Durability: 25,
Mult: burstDMG[c.TalentLvlBurst()],
}

oldLvl := c.lumidouceLvl

c.QueueCharTask(func() {
burstArea := combat.NewCircleHitOnTarget(c.lumidoucePos, nil, 12.5)

if c.lumidouceSrc != -1 {
c.removeLumi(c.lumidouceSrc)
}
for i := 21; i <= burstDuration; i += burstInterval {
enemy := c.Core.Combat.RandomEnemyWithinArea(
burstArea,
func(e combat.Enemy) bool {
return !e.StatusIsActive(burstMarkKey)
},
)
var pos geometry.Point
if enemy != nil {
pos = enemy.Pos()
enemy.AddStatus(burstMarkKey, 0.7*60, false)
} else {
pos = geometry.CalcRandomPointFromCenter(burstArea.Shape.Pos(), 0.5, 12.5, c.Core.Rand)
}

ap := combat.NewCircleHitOnTarget(pos, geometry.Point{Y: 4.5}, 2.5)
c.Core.QueueAttack(
ai,
ap,
0,
0,
)
}
}, 21)

c.QueueCharTask(func() {
if oldLvl >= 2 {
c.lumidouceLvl = 2
} else {
c.lumidouceLvl = 0
}

c.lumidouceSrc = c.Core.F

c.Core.Tasks.Add(c.lumiTick(c.Core.F), skillLumiFirstTick)
c.Core.Tasks.Add(c.removeLumi(c.Core.F), 22*60)
}, burstDuration)

c.ConsumeEnergy(12)
c.SetCD(action.ActionBurst, 13.5*60)
return action.Info{
Frames: frames.NewAbilFunc(burstFrames),
AnimationLength: burstFrames[action.InvalidAction],
CanQueueAfter: burstFrames[action.ActionSwap],
State: action.BurstState,
}, nil
}
4 changes: 4 additions & 0 deletions internal/characters/emilie/emilie.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ func NewChar(s *core.Core, w *character.CharWrapper, _ info.CharacterProfile) er
c.BurstCon = 3
c.HasArkhe = true

c.lumidouceSrc = -1

w.Character = &c

return nil
}

func (c *char) Init() error {
c.a1()
c.a4()
return nil
}
func (c *char) AnimationStartDelay(k model.AnimationDelayKey) int {
Expand Down
Loading

0 comments on commit 76a9962

Please sign in to comment.