Skip to content

Commit

Permalink
Merge pull request #670 from srliao/rewrite
Browse files Browse the repository at this point in the history
fix ht c6, charge hitlag, charge frames, c6 icd
  • Loading branch information
srliao authored Aug 9, 2022
2 parents 2f4428e + e970823 commit 82d564d
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 40 deletions.
104 changes: 72 additions & 32 deletions internal/characters/hutao/charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
)

var chargeFrames []int
var paramitaChargeFrames []int
var ppChargeFrames []int

const chargeHitmark = 19
const paramitaChargeHitmark = 6
const (
chargeHitmark = 19
ppChargeHitmark = 3
)

func init() {
// charge -> x
Expand All @@ -23,11 +25,11 @@ func init() {
chargeFrames[action.ActionJump] = chargeHitmark

// charge (paramita) -> x
paramitaChargeFrames = frames.InitAbilSlice(44)
paramitaChargeFrames[action.ActionBurst] = 35
paramitaChargeFrames[action.ActionDash] = paramitaChargeHitmark
paramitaChargeFrames[action.ActionJump] = paramitaChargeHitmark
paramitaChargeFrames[action.ActionSwap] = 42
ppChargeFrames = frames.InitAbilSlice(44)
ppChargeFrames[action.ActionBurst] = 33
ppChargeFrames[action.ActionDash] = ppChargeHitmark
ppChargeFrames[action.ActionJump] = ppChargeHitmark
ppChargeFrames[action.ActionSwap] = 42
}

func (c *char) ChargeAttack(p map[string]int) action.ActionInfo {
Expand All @@ -38,17 +40,18 @@ func (c *char) ChargeAttack(p map[string]int) action.ActionInfo {

//check for particles
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Charge Attack",
AttackTag: combat.AttackTagExtra,
ICDTag: combat.ICDTagExtraAttack,
ICDGroup: combat.ICDGroupPole,
StrikeType: combat.StrikeTypeSlash,
Element: attributes.Physical,
Durability: 25,
Mult: charge[c.TalentLvlAttack()],
HitlagFactor: 0.01,
HitlagHaltFrames: 0.01 * 60,
ActorIndex: c.Index,
Abil: "Charge Attack",
AttackTag: combat.AttackTagExtra,
ICDTag: combat.ICDTagExtraAttack,
ICDGroup: combat.ICDGroupPole,
StrikeType: combat.StrikeTypeSlash,
Element: attributes.Physical,
Durability: 25,
Mult: charge[c.TalentLvlAttack()],
HitlagFactor: 0.01,
CanBeDefenseHalted: true,
IsDeployable: true,
}
c.Core.QueueAttack(ai, combat.NewCircleHit(c.Core.Combat.Player(), 0.5, false, combat.TargettableEnemy), 0, chargeHitmark)

Expand All @@ -61,24 +64,61 @@ func (c *char) ChargeAttack(p map[string]int) action.ActionInfo {
}

func (c *char) ppChargeAttack(p map[string]int) action.ActionInfo {

//TODO: currently assuming snapshot is on cast since it's a bullet and nothing implemented re "pp slide"
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Charge Attack",
AttackTag: combat.AttackTagExtra,
ICDTag: combat.ICDTagExtraAttack,
ICDGroup: combat.ICDGroupPole,
StrikeType: combat.StrikeTypeSlash,
Element: attributes.Physical,
Durability: 25,
Mult: charge[c.TalentLvlAttack()],
ActorIndex: c.Index,
Abil: "Charge Attack",
AttackTag: combat.AttackTagExtra,
ICDTag: combat.ICDTagExtraAttack,
ICDGroup: combat.ICDGroupPole,
StrikeType: combat.StrikeTypeSlash,
Element: attributes.Physical,
Durability: 25,
Mult: charge[c.TalentLvlAttack()],
HitlagFactor: 0.01,
CanBeDefenseHalted: true,
IsDeployable: true,
}
c.Core.QueueAttack(ai, combat.NewCircleHit(c.Core.Combat.Player(), 0.5, false, combat.TargettableEnemy), 0, ppChargeHitmark, c.ppParticles, c.applyBB)

//frames changes if previous action is normal
prevState := -1
if c.Core.Player.LastAction.Char == c.Index && c.Core.Player.LastAction.Type == action.ActionAttack {
prevState = c.NormalCounter - 1
if prevState < 0 {
prevState = c.NormalHitNum - 1
}
}
ff := func(next action.Action) int {
if prevState == -1 {
return ppChargeFrames[next]
}
switch next {
case action.ActionDash, action.ActionJump:
default:
return ppChargeFrames[next]
}
switch prevState {
case 0: //n1
return 2
case 1:
return 5
case 2:
return 2
case 3:
return 3
case 4:
return 3
default:
return 500 //TODO: this action is illegal; need better way to handle it
}
}
c.Core.QueueAttack(ai, combat.NewCircleHit(c.Core.Combat.Player(), 0.5, false, combat.TargettableEnemy), 0, paramitaChargeHitmark, c.ppParticles, c.applyBB)

return action.ActionInfo{
Frames: frames.NewAbilFunc(paramitaChargeFrames),
AnimationLength: paramitaChargeFrames[action.InvalidAction],
CanQueueAfter: paramitaChargeHitmark,
Frames: ff,
AnimationLength: ppChargeFrames[action.InvalidAction],
CanQueueAfter: 1,
State: action.ChargeAttackState,
}
}
16 changes: 10 additions & 6 deletions internal/characters/hutao/cons.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ import (
"github.com/genshinsim/gcsim/pkg/modifier"
)

const (
c6ICDKey = "hutao-c6-icd"
)

func (c *char) c6() {
c.c6buff = make([]float64, attributes.EndStatType)
c.c6buff[attributes.CR] = 1
c.Core.Events.Subscribe(event.OnCharacterHurt, func(_ ...interface{}) bool {
c.checkc6()
return false
}, "hutao-c6")
}

func (c *char) checkc6() {
if c.Core.F < c.c6icd && c.c6icd != 0 {
if c.StatusIsActive(c6ICDKey) {
return
}
//check if hp less than 25%
Expand All @@ -29,17 +35,15 @@ func (c *char) checkc6() {
}

//increase crit rate to 100%
m := make([]float64, attributes.EndStatType)
m[attributes.CR] = 1
c.AddStatMod(character.StatMod{
Base: modifier.NewBase("hutao-c6", 600),
Base: modifier.NewBaseWithHitlag("hutao-c6", 600),
AffectedStat: attributes.CR,
Amount: func() ([]float64, bool) {
return m, true
return c.c6buff, true
},
})

c.c6icd = c.Core.F + 3600
c.AddStatus(c6ICDKey, 3600, true)
}

//Upon defeating an enemy affected by a Blood Blossom that Hu Tao applied
Expand Down
2 changes: 1 addition & 1 deletion internal/characters/hutao/hutao.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type char struct {
a4buff []float64
ppbuff []float64
c4buff []float64
c6icd int
c6buff []float64
applyA1 bool

burstHealCount int
Expand Down
4 changes: 3 additions & 1 deletion internal/characters/hutao/skill.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ func (c *char) Skill(p map[string]int) action.ActionInfo {
Abil: "Paramita Papilio",
Amount: .30 * c.HPCurrent,
})
c.checkc6()
if c.Base.Cons >= 6 {
c.checkc6()
}

//trigger 0 damage attack; matters because this breaks freeze
ai := combat.AttackInfo{
Expand Down

0 comments on commit 82d564d

Please sign in to comment.