Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Navia #1809

Merged
merged 41 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1b55631
Navia Initial Commit. Todo, fix SurgingBlade() and SkillCB() not bein…
RarePossum Nov 10, 2023
37eeb1c
Fixed Stackoverflow from lack of Init, added CDs for Skill, along wit…
RarePossum Nov 10, 2023
9573b28
Fixed All Burst hits granting Shrapnel
RarePossum Nov 10, 2023
70e5899
Added:
RarePossum Nov 13, 2023
67de852
Added:
RarePossum Nov 17, 2023
df7dfc9
Fixed:
RarePossum Nov 18, 2023
fa94a75
Fixed:
RarePossum Nov 18, 2023
f7050a2
Added:
RarePossum Nov 18, 2023
8b5fee0
Fixed:
RarePossum Nov 18, 2023
e7b8517
Fixed:
RarePossum Nov 19, 2023
bb8decf
Fixed:
RarePossum Nov 19, 2023
7d36056
Fixed:
RarePossum Nov 19, 2023
679ee4b
Update for v2
RarePossum Nov 20, 2023
6338157
Update for v2
RarePossum Nov 24, 2023
0171c65
Refactored some callbacks
RarePossum Dec 15, 2023
75d7ada
Neuvillette Implementation (#1727)
Charlie-Zheng Dec 10, 2023
b858236
Navia Initial Commit. Todo, fix SurgingBlade() and SkillCB() not bein…
RarePossum Nov 10, 2023
ff96f09
Reverted some things I missed when rebasing
RarePossum Dec 15, 2023
18f8252
Fixed Keys
RarePossum Dec 15, 2023
bed22ae
Merge branch 'genshinsim:main' into Navia
RarePossum Dec 18, 2023
47717b5
Merge branch 'genshinsim:main' into Navia
RarePossum Dec 19, 2023
62a6b0d
Removed nighttimewhispers.go
RarePossum Dec 20, 2023
781d745
Merge remote-tracking branch 'origin/Navia' into Navia
RarePossum Dec 20, 2023
53aee55
Fixed missing import, and infusion timing out
RarePossum Dec 21, 2023
b662940
Fixed shot calculation
RarePossum Dec 21, 2023
0b29bda
Fixed shot calculation again
RarePossum Dec 21, 2023
f6edecd
Merge branch 'genshinsim:main' into Navia
RarePossum Dec 22, 2023
93f61c2
Merge branch 'genshinsim:main' into Navia
RarePossum Dec 22, 2023
753dd9a
Correct Frames based on footage
RarePossum Dec 23, 2023
3a2f755
Added N0 timings and removed incorrect import
RarePossum Dec 23, 2023
637a753
Fixed NA out of range error, and incorrect Skill hitboxes
RarePossum Dec 23, 2023
011f953
Cleaned up Pull Crystal Code Slightly
RarePossum Dec 23, 2023
c81a2d2
Fixed Navia's Skill buffs not applying to her shotgun due to timeout
RarePossum Dec 23, 2023
d3ef43a
Fixed NA starting during Hold Skill
RarePossum Dec 23, 2023
17b91fe
Fixed NA starting during Hold Skill
RarePossum Dec 23, 2023
bc3e601
Fixed comments, updated locale, ran pipeline, added documentation, fi…
RarePossum Dec 24, 2023
f934da1
Fix linting, hopefully
RarePossum Dec 24, 2023
1d76452
Fix linting again, hopefully
RarePossum Dec 24, 2023
37b4015
third linting change
RarePossum Dec 24, 2023
3e4926c
addressed comments, updated grammar, fixed skill, icd, updated docume…
RarePossum Dec 24, 2023
5650966
fixed typos
RarePossum Dec 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},

"[javascript]": {
Expand Down
71 changes: 71 additions & 0 deletions internal/characters/navia/asc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package navia

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

func init() {

}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved

// For 4s after using Ceremonial Crystalshot, the DMG dealt by Navia's Normal Attacks,
// Charged Attacks, and Plunging Attacks will be converted into Geo DMG which cannot
// be overridden by other Elemental infusions, and the DMG dealt by Navia's Normal Attacks,
// Charged Attacks, and Plunging Attacks will be increased by 40%.
func (c *char) a1() {
if c.Base.Ascension < 1 {
return
}
c.Core.Log.NewEvent("infusion added", glog.LogCharacterEvent, c.Index)
RarePossum marked this conversation as resolved.
Show resolved Hide resolved

// add Damage Bonus
m := make([]float64, attributes.EndStatType)
c.AddAttackMod(character.AttackMod{
Base: modifier.NewBaseWithHitlag("navia-a1-dmg", 60*4), // 4s
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
Amount: func(atk *combat.AttackEvent, _ combat.Target) ([]float64, bool) {
// skip if not normal/charged/plunge
if atk.Info.AttackTag != attacks.AttackTagNormal &&
atk.Info.AttackTag != attacks.AttackTagExtra &&
atk.Info.AttackTag != attacks.AttackTagPlunge {
return nil, false
}
// apply buff
m[attributes.DmgP] = 0.4
return m, true
},
})
}

// For each Pyro/Electro/Cryo/Hydro party member, Navia gains 20% increased ATK.
// This effect can stack up to 2 times.
func (c *char) a4() {
if c.Base.Ascension < 4 {
return
}

ele := 0
for _, char := range c.Core.Player.Chars() {
if char.Base.Element != attributes.Geo && char.Base.
Element != attributes.Anemo && char.Base.Element != attributes.Dendro {
ele++
}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
}
if ele > 2 {
ele = 2
}

m := make([]float64, attributes.EndStatType)
m[attributes.ATKP] = 0.2 * float64(ele)
c.AddStatMod(character.StatMod{
Base: modifier.NewBase("navia-a4", -1),
AffectedStat: attributes.ATKP,
Amount: func() ([]float64, bool) {
return m, true
},
})
}

Check failure on line 71 in internal/characters/navia/asc.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofmt`-ed with `-s` (gofmt)
75 changes: 75 additions & 0 deletions internal/characters/navia/attack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package navia

import (
"fmt"
"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 (
attackFrames [][]int
attackHitmarks = [][]int{{23}, {22}, {31, 39, 38}, {41}}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
attackHitlagHaltFrame = [][]float64{{0.06}, {0.06}, {0.01, 0.01, 0.01}, {.06}}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
attackDefHalt = [][]bool{{true}, {true}, {false, false, false}, {true}}
attackHitboxes = [][]float64{{2}, {4.3, 2}, {4.5, 3}, {4.7, 2}}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
attackOffsets = []float64{0.5, -1.5, 1, -1.85}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
)

const normalHitNum = 4

func init() {
attackFrames = make([][]int, normalHitNum)

attackFrames[0] = frames.InitNormalCancelSlice(attackHitmarks[0][0], 28)
attackFrames[1] = frames.InitNormalCancelSlice(attackHitmarks[1][0], 42)
attackFrames[2] = frames.InitNormalCancelSlice(attackHitmarks[2][0], 48)
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
attackFrames[3] = frames.InitNormalCancelSlice(attackHitmarks[3][0], 93)
}

func (c *char) Attack(_ map[string]int) (action.Info, error) {
for i, mult := range auto[c.NormalCounter] {
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: fmt.Sprintf("Normal %v", c.NormalCounter),
AttackTag: attacks.AttackTagNormal,
ICDTag: attacks.ICDTagNormalAttack,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeBlunt,
Element: attributes.Physical,
Durability: 25,
Mult: mult[c.TalentLvlAttack()],
HitlagFactor: 0.01,
HitlagHaltFrames: attackHitlagHaltFrame[c.NormalCounter][i] * 60,
CanBeDefenseHalted: attackDefHalt[c.NormalCounter][i],
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
}
ap := combat.NewCircleHitOnTarget(
c.Core.Combat.Player(),
geometry.Point{Y: attackOffsets[c.NormalCounter]},
attackHitboxes[c.NormalCounter][0],
)
if c.NormalCounter != 0 {
ap = combat.NewBoxHitOnTarget(
c.Core.Combat.Player(),
geometry.Point{Y: attackOffsets[c.NormalCounter]},
attackHitboxes[c.NormalCounter][0],
attackHitboxes[c.NormalCounter][1],
)
}
c.QueueCharTask(func() {
c.Core.QueueAttack(ai, ap, 0, 0)
}, attackHitmarks[c.NormalCounter][i])
}

defer c.AdvanceNormalIndex()

return action.Info{
Frames: frames.NewAttackFunc(c.Character, attackFrames),
AnimationLength: attackFrames[c.NormalCounter][action.InvalidAction],
CanQueueAfter: attackHitmarks[c.NormalCounter][len(attackHitmarks[c.NormalCounter])-1],
State: action.NormalAttackState,
}, nil
}
150 changes: 150 additions & 0 deletions internal/characters/navia/burst.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
package navia

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

var (
burstFrames []int
)

const (
burstHitmark = 104
burstKey = "navia-artillery"
burstDuration = 720
targetRadius = 10
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
burstDelay = 154
)

func init() {
burstFrames = frames.InitAbilSlice(102)
burstFrames[action.ActionSwap] = 93
burstFrames[action.ActionWalk] = 127
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
}

// On the orders of the President of the Spina di Rosula, call for a magnificent
// Golden Rose Salute. Unleashes a massive bombardment on opponents in front of her,
// dealing Aoe Geo DMG and providing Fire Support for a duration afterward, periodically
// dealing Geo DMG.
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
func (c *char) Burst(_ map[string]int) (action.Info, error) {
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "As the Sunlit Sky's Singing Salute",
AttackTag: attacks.AttackTagElementalBurst,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeBlunt,
Element: attributes.Geo,
Durability: 50,
Mult: burst[0][c.TalentLvlBurst()],
}

c.Core.QueueAttack(
ai,
combat.NewBoxHit(c.Core.Combat.Player(), c.Core.Combat.Player(), geometry.Point{Y: 0}, 12, 6),
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
burstHitmark,
burstHitmark,
)
RarePossum marked this conversation as resolved.
Show resolved Hide resolved

c.QueueCharTask(
func() {
c.AddStatus(burstKey, burstDuration+burstDelay, false)
c.naviaburst = true
},
burstDelay,
)
c.QueueCharTask(
func() {
c.naviaburst = false
},
burstDuration+burstDelay,
)

c.ConsumeEnergy(12)
c.SetCD(action.ActionBurst, 15*60)

ai.Abil = "Fire Support"
ai.ICDTag = attacks.ICDTagElementalBurst
ai.Durability = 25
ai.Mult = burst[1][c.TalentLvlBurst()]

snap := c.Snapshot(&ai)
c.artillerySnapshot = combat.AttackEvent{
Info: ai,
Snapshot: snap,
SourceFrame: c.Core.F,
}
for i, j := 3, 0; i <= burstDuration; i += BurstInterval(j) {
c.Core.QueueAttack(
ai,
combat.NewCircleHitOnTarget(c.location(targetRadius), nil, 3),
burstDelay+i,
burstDelay+i+9,
c.BurstCB(),
c.c4(),
)
}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved

return action.Info{
Frames: frames.NewAbilFunc(burstFrames),
AnimationLength: burstFrames[action.InvalidAction],
CanQueueAfter: burstFrames[action.ActionSwap], // earliest cancel
State: action.BurstState,
}, nil
}

func BurstInterval(j int) int {
if j%3 == 1 {
j++
return 48
} else {
j++
return 42
}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
}

// When attacks from Golden Rose's Salute hit opponents, Navia will gain 1 charge
// of Crystal Shrapnel.
// This effect can be triggered up to once every 2.4s.
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
func (c *char) BurstCB() combat.AttackCBFunc {
RarePossum marked this conversation as resolved.
Show resolved Hide resolved

return func(a combat.AttackCB) {
if c.StatusIsActive("navia-q-shrapnel-icd") {
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
return
}
if a.Target.Type() != targets.TargettableEnemy {
return
}

if c.shrapnel < 6 {
c.shrapnel++
c.Core.Log.NewEvent("Crystal Shrapnel gained from Burst", glog.LogCharacterEvent, c.Index)
RarePossum marked this conversation as resolved.
Show resolved Hide resolved

}

c.AddStatus("navia-q-shrapnel-icd", 2.4*60, false)
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
}

}

// Targets a random enemy if there is an enemy present, if not, it targets a random spot
func (c *char) location(r float64) geometry.Point {
enemy := c.Core.Combat.RandomEnemyWithinArea(
combat.NewCircleHitOnTarget(c.Core.Combat.Player().Pos(), nil, 10),
nil,
)
var pos geometry.Point
if enemy != nil {
pos = enemy.Pos()
} else {
pos = geometry.CalcRandomPointFromCenter(c.Core.Combat.Player().Pos(), 0, r, c.Core.Rand)
}
return pos
}
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions internal/characters/navia/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package_name: "navia"
genshin_id: 10000091
key: "navia"
RarePossum marked this conversation as resolved.
Show resolved Hide resolved
Loading