forked from genshinsim/gcsim
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement xianyun plunge for qiqi (genshinsim#2229)
- Loading branch information
1 parent
a028cef
commit 9fc0800
Showing
7 changed files
with
273 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters