Skip to content

Commit

Permalink
Add Tome of the Eternal Flow (#1729)
Browse files Browse the repository at this point in the history
* init implementation

* update pipeline

* update weapon description

* update weapon_data

* update healkey

* fix ca buff

* update passive text

* fix stacks in eternalflow

---------

Co-authored-by: imring <vitaliyvorobets25@gmail.com>
  • Loading branch information
Athenaxdd and imring authored Oct 20, 2023
1 parent c01cab4 commit e652557
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/weapons/catalyst/eternalflow/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package_name: eternalflow
genshin_id: 14514
key: tomeoftheeternalflow
134 changes: 134 additions & 0 deletions internal/weapons/catalyst/eternalflow/eternalflow.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package eternalflow

import (
"fmt"
"math"

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

const (
buffKey = "eternalflow-buff"
buffIcd = "eternalflow-icd"
energyIcd = "eternalflow-energy-icd"
)

func init() {
core.RegisterWeaponFunc(keys.TomeOfTheEternalFlow, NewWeapon)
}

type Weapon struct {
stacks int
core *core.Core
char *character.CharWrapper
refine int
buffCA []float64
Index int
}

func (w *Weapon) SetIndex(idx int) { w.Index = idx }
func (w *Weapon) Init() error { return nil }

// HP is increased by 16/20/24/28/32%.
// When current HP increases or decreases, Charged Attack DMG will be increased by 14/18/22/26/30% for 4s.
// Max 3 stacks. This effect can be triggered once every 0.3s.
// When the character has 3 stacks or a third stack's duration refreshes, 8/9/10/11/12 Energy will be restored.
// This Energy restoration effect can be triggered once every 12s.
func NewWeapon(c *core.Core, char *character.CharWrapper, p info.WeaponProfile) (info.Weapon, error) {
w := &Weapon{
core: c,
char: char,
refine: p.Refine,
buffCA: make([]float64, attributes.EndStatType),
}

hpp := 0.12 + float64(p.Refine)*0.04
val := make([]float64, attributes.EndStatType)
val[attributes.HPP] = hpp
char.AddStatMod(character.StatMod{
Base: modifier.NewBaseWithHitlag("eternalflow-hpp", -1),
AffectedStat: attributes.HPP,
Amount: func() ([]float64, bool) {
return val, true
},
})

c.Events.Subscribe(event.OnPlayerHPDrain, func(args ...interface{}) bool {
di := args[0].(player.DrainInfo)
if c.Player.Active() != char.Index {
return false
}
if di.ActorIndex != char.Index {
return false
}
if di.Amount <= 0 {
return false
}

w.onChangeHP()
return false
}, fmt.Sprintf("eternalflow-drain-%v", char.Base.Key.String()))

c.Events.Subscribe(event.OnHeal, func(args ...interface{}) bool {
index := args[1].(int)
amount := args[2].(float64)
overheal := args[3].(float64)
if c.Player.Active() != char.Index {
return false
}
if index != char.Index {
return false
}
if amount <= 0 {
return false
}
// do not trigger if at max hp already
if math.Abs(amount-overheal) <= 1e-9 {
return false
}

w.onChangeHP()
return false
}, fmt.Sprintf("eternalflow-heal-%v", char.Base.Key.String()))
return w, nil
}

func (w *Weapon) onChangeHP() {
if w.char.StatusIsActive(buffIcd) {
return
}
if !w.char.StatModIsActive(buffKey) {
w.stacks = 0
}
if w.stacks < 3 {
w.stacks++
}

w.char.AddStatus(buffIcd, 0.3*60, true)
w.char.AddAttackMod(character.AttackMod{
Base: modifier.NewBaseWithHitlag(buffKey, 4*60),
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) {
w.buffCA[attributes.DmgP] = (0.10 + 0.04*float64(w.refine)) * float64(w.stacks)
switch atk.Info.AttackTag {
case attacks.AttackTagExtra:
return w.buffCA, true
default:
return nil, false
}
},
})

if w.stacks == 3 && !w.char.StatusIsActive(energyIcd) {
w.char.AddEnergy("eternalflow-energy", 7+float64(w.refine)*1)
w.char.AddStatus(energyIcd, 12*60, true)
}
}
37 changes: 37 additions & 0 deletions pkg/core/curves/weaponcurves.go
Original file line number Diff line number Diff line change
Expand Up @@ -5521,6 +5521,43 @@ var WeaponBaseMap = map[keys.Weapon]WeaponBase{
},
},
},
keys.TomeOfTheEternalFlow: {
AtkCurve: GROW_CURVE_ATTACK_304,
SpecializedCurve: GROW_CURVE_CRITICAL_301,
BaseAtk: 44.33580017089844,
BaseSpecialized: 0.19200000166893005,
Specialized: attributes.CD,
PromotionBonus: []PromoData{
{
MaxLevel: 20,
Atk: 0,
},
{
MaxLevel: 40,
Atk: 31.100000381469727,
},
{
MaxLevel: 50,
Atk: 62.20000076293945,
},
{
MaxLevel: 60,
Atk: 93.4000015258789,
},
{
MaxLevel: 70,
Atk: 124.5,
},
{
MaxLevel: 80,
Atk: 155.60000610351562,
},
{
MaxLevel: 90,
Atk: 186.6999969482422,
},
},
},
keys.ToukabouShigure: {
AtkCurve: GROW_CURVE_ATTACK_201,
SpecializedCurve: GROW_CURVE_CRITICAL_201,
Expand Down
2 changes: 2 additions & 0 deletions pkg/core/keys/weapon.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ var weaponNames = []string{
"thrillingtalesofdragonslayers",
"thunderingpulse",
"tidalshadow",
"tomeoftheeternalflow",
"toukaboushigure",
"travelershandysword",
"tulaytullahsremembrance",
Expand Down Expand Up @@ -355,6 +356,7 @@ const (
ThrillingTalesOfDragonSlayers
ThunderingPulse
TidalShadow
TomeOfTheEternalFlow
ToukabouShigure
TravelersHandySword
TulaytullahsRemembrance
Expand Down
2 changes: 2 additions & 0 deletions pkg/shortcut/weapons.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ var WeaponNameToKey = map[string]keys.Weapon{
"thunderingpulse": keys.ThunderingPulse,
"tpulse": keys.ThunderingPulse,
"tidalshadow": keys.TidalShadow,
"tomeoftheeternalflow": keys.TomeOfTheEternalFlow,
"eternalflow": keys.TomeOfTheEternalFlow,
"toukaboushigure": keys.ToukabouShigure,
"shigure": keys.ToukabouShigure,
"umbrella": keys.ToukabouShigure,
Expand Down
1 change: 1 addition & 0 deletions pkg/simulation/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ import (
_ "github.com/genshinsim/gcsim/internal/weapons/catalyst/blackcliff"
_ "github.com/genshinsim/gcsim/internal/weapons/catalyst/dodoco"
_ "github.com/genshinsim/gcsim/internal/weapons/catalyst/emeraldorb"
_ "github.com/genshinsim/gcsim/internal/weapons/catalyst/eternalflow"
_ "github.com/genshinsim/gcsim/internal/weapons/catalyst/favonius"
_ "github.com/genshinsim/gcsim/internal/weapons/catalyst/flowingpurity"
_ "github.com/genshinsim/gcsim/internal/weapons/catalyst/frostbearer"
Expand Down
29 changes: 29 additions & 0 deletions ui/packages/docs/docs/reference/weapons/tomboftheeternalflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Tome Of The Eternal Flow
---

import AoETable from "@site/src/components/AoE/AoETable";
import IssuesTable from "@site/src/components/Issues/IssuesTable";
import NamesList from "@site/src/components/Names/NamesList";
import ParamsTable from "@site/src/components/Params/ParamsTable";
import FieldsTable from "@site/src/components/Fields/FieldsTable";

## AoE Data

<AoETable item_key="tomeoftheeternalflow" data_src="weapon" />

## Known issues

<IssuesTable item_key="tomeoftheeternalflow" data_src="weapon" />

## Names

<NamesList item_key="tomeoftheeternalflow" data_src="weapon" />

## Params

<ParamsTable item_key="tomeoftheeternalflow" data_src="weapon" />

## Fields

<FieldsTable item_key="tomeoftheeternalflow" data_src="weapon" />
3 changes: 3 additions & 0 deletions ui/packages/docs/src/components/Names/weapon_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@
"tpulse"
],
"tidalshadow": [],
"tomeoftheeternalflow": [
"eternalflow"
],
"toukaboushigure": [
"shigure",
"umbrella"
Expand Down
9 changes: 8 additions & 1 deletion ui/packages/ui/src/Data/weapon_data.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,13 @@
"weapon_class": "WEAPON_CLAYMORE",
"image_name": "UI_EquipIcon_Claymore_Vorpal"
},
"tomeoftheeternalflow": {
"id": 14514,
"key": "tomeoftheeternalflow",
"rarity": 5,
"weapon_class": "WEAPON_CATALYST",
"image_name": "UI_EquipIcon_Catalyst_Iudex"
},
"toukaboushigure": {
"id": 11422,
"key": "toukaboushigure",
Expand Down Expand Up @@ -1170,4 +1177,4 @@
"image_name": "UI_EquipIcon_Sword_Pleroma"
}
}
}
}

0 comments on commit e652557

Please sign in to comment.