Skip to content

Commit

Permalink
Implement xianyun plunge for qiqi (genshinsim#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
shizukayuki authored Sep 21, 2024
1 parent a028cef commit 9fc0800
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 1 deletion.
6 changes: 6 additions & 0 deletions internal/characters/qiqi/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ skill_data_mapping:
charge:
- 5 # Charged Attack DMG|{param5:F1P}+{param5:F1P}
- 5 # Charged Attack DMG|{param5:F1P}+{param5:F1P}
collision:
- 7 # Plunge DMG|{param7:F1P}
lowPlunge:
- 8 # Low/High Plunge DMG|{param8:P}/{param9:P}
highPlunge:
- 9 # Low/High Plunge DMG|{param8:P}/{param9:P}
skill:
skillDmgCont:
- 4 # Herald of Frost DMG|{param4:F1P}
Expand Down
163 changes: 163 additions & 0 deletions internal/characters/qiqi/plunge.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
package qiqi

import (
"errors"

"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"
"github.com/genshinsim/gcsim/pkg/core/player"
)

var highPlungeFrames []int
var lowPlungeFrames []int

const lowPlungeHitmark = 46
const highPlungeHitmark = 46
const collisionHitmark = lowPlungeHitmark - 6

const lowPlungePoiseDMG = 100.0
const lowPlungeRadius = 3.0

const highPlungePoiseDMG = 150.0
const highPlungeRadius = 5.0

func init() {
// low_plunge -> x
lowPlungeFrames = frames.InitAbilSlice(76)
lowPlungeFrames[action.ActionAttack] = 58
lowPlungeFrames[action.ActionSkill] = 59
lowPlungeFrames[action.ActionBurst] = 59
lowPlungeFrames[action.ActionDash] = lowPlungeHitmark
lowPlungeFrames[action.ActionWalk] = 75
lowPlungeFrames[action.ActionSwap] = 61

// high_plunge -> x
highPlungeFrames = frames.InitAbilSlice(77)
highPlungeFrames[action.ActionAttack] = 59
highPlungeFrames[action.ActionSkill] = 60
highPlungeFrames[action.ActionBurst] = 61
highPlungeFrames[action.ActionDash] = highPlungeHitmark
highPlungeFrames[action.ActionJump] = 76
highPlungeFrames[action.ActionSwap] = 63
}

// Low Plunge attack damage queue generator
// Use the "collision" optional argument if you want to do a falling hit on the way down
// Default = 0
func (c *char) LowPlungeAttack(p map[string]int) (action.Info, error) {
defer c.Core.Player.SetAirborne(player.Grounded)
switch c.Core.Player.Airborne() {
case player.AirborneXianyun:
return c.lowPlungeXY(p), nil
default:
return action.Info{}, errors.New("low_plunge can only be used while airborne")
}
}

func (c *char) lowPlungeXY(p map[string]int) action.Info {
collision, ok := p["collision"]
if !ok {
collision = 0 // Whether or not collision hit
}

if collision > 0 {
c.plungeCollision(collisionHitmark)
}

ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Low Plunge",
AttackTag: attacks.AttackTagPlunge,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeBlunt,
PoiseDMG: lowPlungePoiseDMG,
Element: attributes.Physical,
Durability: 25,
Mult: lowPlunge[c.TalentLvlAttack()],
}
c.Core.QueueAttack(
ai,
combat.NewCircleHitOnTarget(c.Core.Combat.Player(), geometry.Point{Y: 1}, lowPlungeRadius),
lowPlungeHitmark,
lowPlungeHitmark,
)

return action.Info{
Frames: frames.NewAbilFunc(lowPlungeFrames),
AnimationLength: lowPlungeFrames[action.InvalidAction],
CanQueueAfter: lowPlungeFrames[action.ActionDash],
State: action.PlungeAttackState,
}
}

// High Plunge attack damage queue generator
// Use the "collision" optional argument if you want to do a falling hit on the way down
// Default = 0
func (c *char) HighPlungeAttack(p map[string]int) (action.Info, error) {
defer c.Core.Player.SetAirborne(player.Grounded)
switch c.Core.Player.Airborne() {
case player.AirborneXianyun:
return c.highPlungeXY(p), nil
default:
return action.Info{}, errors.New("high_plunge can only be used while airborne")
}
}

func (c *char) highPlungeXY(p map[string]int) action.Info {
collision, ok := p["collision"]
if !ok {
collision = 0 // Whether or not collision hit
}

if collision > 0 {
c.plungeCollision(collisionHitmark)
}

ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "High Plunge",
AttackTag: attacks.AttackTagPlunge,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeBlunt,
PoiseDMG: highPlungePoiseDMG,
Element: attributes.Physical,
Durability: 25,
Mult: highPlunge[c.TalentLvlAttack()],
}
c.Core.QueueAttack(
ai,
combat.NewCircleHitOnTarget(c.Core.Combat.Player(), geometry.Point{Y: 1}, highPlungeRadius),
highPlungeHitmark,
highPlungeHitmark,
)

return action.Info{
Frames: frames.NewAbilFunc(highPlungeFrames),
AnimationLength: highPlungeFrames[action.InvalidAction],
CanQueueAfter: highPlungeFrames[action.ActionDash],
State: action.PlungeAttackState,
}
}

// Plunge normal falling attack damage queue generator
// Standard - Always part of high/low plunge attacks
func (c *char) plungeCollision(delay int) {
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Plunge Collision",
AttackTag: attacks.AttackTagPlunge,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeSlash,
Element: attributes.Physical,
Durability: 0,
Mult: collision[c.TalentLvlAttack()],
}
c.Core.QueueAttack(ai, combat.NewCircleHitOnTarget(c.Core.Combat.Player(), geometry.Point{Y: 1}, 1), delay, delay)
}
54 changes: 54 additions & 0 deletions internal/characters/qiqi/qiqi_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion ui/packages/docs/src/components/Actions/character_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2064,6 +2064,14 @@
"ability": "burst",
"legal": true
},
{
"ability": "low_plunge",
"notes": "Previous action must be a jump buffed via Xianyun's burst for example."
},
{
"ability": "high_plunge",
"notes": "Previous action must be a jump buffed via Xianyun's burst for example."
},
{
"ability": "dash",
"legal": true
Expand All @@ -2074,7 +2082,7 @@
},
{
"ability": "walk",
"notes": "No action followed by walk has proper frames."
"notes": "No action followed by walk (except low_plunge and high_plunge) has proper frames."
},
{
"ability": "swap",
Expand Down
23 changes: 23 additions & 0 deletions ui/packages/docs/src/components/AoE/character_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6671,6 +6671,29 @@
"radius": 2.8
}
],
"plunge": [
{
"ability": "Plunge",
"shape": "Circle",
"center": "Player",
"offsetY": 1,
"radius": 1
},
{
"ability": "Low_Plunge",
"shape": "Circle",
"center": "Player",
"offsetY": 1,
"radius": 3
},
{
"ability": "High_Plunge",
"shape": "Circle",
"center": "Player",
"offsetY": 1,
"radius": 5
}
],
"skill": [
{
"ability": "E-Skill",
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/docs/src/components/Frames/character_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,12 @@
"count_credit": "Kolibri#7675",
"vid": "https://youtu.be/KlgZlck5kQQ?t=1159",
"count": "https://docs.google.com/spreadsheets/d/1zCwdd6_KYFqMD4OQ_llGLdDshoZTu_1pmAMysxGDQvs/edit?usp=sharing"
},
{
"vid_credit": "ectobiologist",
"count_credit": "ectobiologist",
"vid": "https://youtu.be/ZiDn8452bUc",
"count": "https://docs.google.com/spreadsheets/d/1hVAGm-h3aVDwWuc7GzGyAjvpnUPZBNK2w1tsyije7ZQ/edit?usp=sharing"
}
],
"raiden": [
Expand Down
12 changes: 12 additions & 0 deletions ui/packages/docs/src/components/Params/character_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,18 @@
"desc": "0 for no collision dmg (default), 1 for collision dmg."
}
],
"qiqi": [
{
"ability": "low_plunge",
"param": "collision",
"desc": "0 for no collision dmg (default), 1 for collision dmg."
},
{
"ability": "high_plunge",
"param": "collision",
"desc": "0 for no collision dmg (default), 1 for collision dmg."
}
],
"tartaglia": [
{
"ability": "attack",
Expand Down

0 comments on commit 9fc0800

Please sign in to comment.