diff --git a/internal/weapons/sword/peakpatrolsong/config.yml b/internal/weapons/sword/peakpatrolsong/config.yml new file mode 100644 index 000000000..3be82fd81 --- /dev/null +++ b/internal/weapons/sword/peakpatrolsong/config.yml @@ -0,0 +1,3 @@ +package_name: peakpatrolsong +genshin_id: 11516 +key: peakpatrolsong diff --git a/internal/weapons/sword/peakpatrolsong/data_gen.textproto b/internal/weapons/sword/peakpatrolsong/data_gen.textproto new file mode 100644 index 000000000..8dcbc59e4 --- /dev/null +++ b/internal/weapons/sword/peakpatrolsong/data_gen.textproto @@ -0,0 +1,63 @@ +id: 11516 +key: "peakpatrolsong" +rarity: 5 +weapon_class: WEAPON_SWORD_ONE_HAND +image_name: "UI_Gacha_EquipIcon_Sword_XochitlsTube" +base_stats: { + base_props: { + prop_type: FIGHT_PROP_BASE_ATTACK + initial_value: 44.3358 + curve: GROW_CURVE_ATTACK_304 + } + base_props: { + prop_type: FIGHT_PROP_DEFENSE_PERCENT + initial_value: 0.18 + curve: GROW_CURVE_CRITICAL_301 + } + promo_data: { + max_level: 20 + } + promo_data: { + max_level: 40 + add_props: { + prop_type: FIGHT_PROP_BASE_ATTACK + value: 31.1 + } + } + promo_data: { + max_level: 50 + add_props: { + prop_type: FIGHT_PROP_BASE_ATTACK + value: 62.2 + } + } + promo_data: { + max_level: 60 + add_props: { + prop_type: FIGHT_PROP_BASE_ATTACK + value: 93.4 + } + } + promo_data: { + max_level: 70 + add_props: { + prop_type: FIGHT_PROP_BASE_ATTACK + value: 124.5 + } + } + promo_data: { + max_level: 80 + add_props: { + prop_type: FIGHT_PROP_BASE_ATTACK + value: 155.6 + } + } + promo_data: { + max_level: 90 + add_props: { + prop_type: FIGHT_PROP_BASE_ATTACK + value: 186.7 + } + } +} +name_text_hash_map: 999999999 diff --git a/internal/weapons/sword/peakpatrolsong/peakpatrolsong.go b/internal/weapons/sword/peakpatrolsong/peakpatrolsong.go new file mode 100644 index 000000000..092bd1fb6 --- /dev/null +++ b/internal/weapons/sword/peakpatrolsong/peakpatrolsong.go @@ -0,0 +1,98 @@ +package peakpatrolsong + +import ( + "fmt" + + "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/character" + "github.com/genshinsim/gcsim/pkg/modifier" +) + +func init() { + core.RegisterWeaponFunc(keys.PeakPatrolSong, NewWeapon) +} + +type Weapon struct { + Index int + stacks int +} + +const ( + buffKey = "peakpatrolsong-buff" + buffDur = 6 * 60 + teamBuffKey = "peakpatrolsong-team-buff" + teamBuffDur = 15 * 60 + icdKey = "peakpatrolsong-buff-icd" + icdDur = 0.1 * 60 +) + +func (w *Weapon) SetIndex(idx int) { w.Index = idx } +func (w *Weapon) Init() error { return nil } + +func NewWeapon(c *core.Core, char *character.CharWrapper, p info.WeaponProfile) (info.Weapon, error) { + w := &Weapon{} + r := float64(p.Refine) + + d := make([]float64, attributes.EndStatType) + b := make([]float64, attributes.EndStatType) + + def := 0.045 + 0.015*r + bonusMulti := 0.09 + 0.03*r + maxBonus := 0.27 + 0.09*r + + c.Events.Subscribe(event.OnEnemyDamage, func(args ...interface{}) bool { + atk := args[1].(*combat.AttackEvent) + if atk.Info.ActorIndex != char.Index { + return false + } + if atk.Info.AttackTag != attacks.AttackTagNormal && atk.Info.AttackTag != attacks.AttackTagPlunge { + return false + } + if char.StatusIsActive(icdKey) { + return false + } + + if !char.StatModIsActive(buffKey) { + w.stacks = 0 + } + if w.stacks < 2 { + w.stacks++ + } + + d[attributes.DEFP] = def * float64(w.stacks) + char.AddStatMod(character.StatMod{ + Base: modifier.NewBaseWithHitlag(buffKey, buffDur), + AffectedStat: attributes.DEFP, + Amount: func() ([]float64, bool) { + return d, true + }, + }) + + if w.stacks == 2 { + bonus := bonusMulti * char.TotalDef() / 1000.0 + bonus = min(bonus, maxBonus) + for i := attributes.PyroP; i <= attributes.DendroP; i++ { + b[i] = bonus + } + for _, this := range c.Player.Chars() { + this.AddStatMod(character.StatMod{ + Base: modifier.NewBaseWithHitlag(teamBuffKey, teamBuffDur), + Amount: func() ([]float64, bool) { + return b, true + }, + }) + } + } + + char.AddStatus(icdKey, icdDur, true) + return false + }, fmt.Sprintf("peakpatrolsong-hit-%v", char.Base.Key.String())) + + return w, nil +} diff --git a/internal/weapons/sword/peakpatrolsong/peakpatrolsong_gen.go b/internal/weapons/sword/peakpatrolsong/peakpatrolsong_gen.go new file mode 100644 index 000000000..ee885de47 --- /dev/null +++ b/internal/weapons/sword/peakpatrolsong/peakpatrolsong_gen.go @@ -0,0 +1,25 @@ +// Code generated by "pipeline"; DO NOT EDIT. +package peakpatrolsong + +import ( + _ "embed" + + "github.com/genshinsim/gcsim/pkg/model" + "google.golang.org/protobuf/encoding/prototext" +) + +//go:embed data_gen.textproto +var pbData []byte +var base *model.WeaponData + +func init() { + base = &model.WeaponData{} + err := prototext.Unmarshal(pbData, base) + if err != nil { + panic(err) + } +} + +func (x *Weapon) Data() *model.WeaponData { + return base +} diff --git a/pkg/core/keys/weapon.go b/pkg/core/keys/weapon.go index c595db0a9..e00ace5c0 100644 --- a/pkg/core/keys/weapon.go +++ b/pkg/core/keys/weapon.go @@ -135,6 +135,7 @@ var weaponNames = []string{ "oathsworneye", "oldmercspal", "otherworldlystory", + "peakpatrolsong", "pocketgrimoire", "polarstar", "portablepowersaw", @@ -331,6 +332,7 @@ const ( OathswornEye OldMercsPal OtherworldlyStory + PeakPatrolSong PocketGrimoire PolarStar PortablePowerSaw diff --git a/pkg/shortcut/weapons.go b/pkg/shortcut/weapons.go index 1d1046d1d..1b9bce6fb 100644 --- a/pkg/shortcut/weapons.go +++ b/pkg/shortcut/weapons.go @@ -186,6 +186,7 @@ var WeaponNameToKey = map[string]keys.Weapon{ "oldmercspal": keys.OldMercsPal, "otherworldlystory": keys.OtherworldlyStory, "otherworldly": keys.OtherworldlyStory, + "pps": keys.PeakPatrolSong, "pocketgrimoire": keys.PocketGrimoire, "pocket": keys.PocketGrimoire, "polarstar": keys.PolarStar, diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index 579f17aaa..03bf68880 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -236,6 +236,7 @@ import ( _ "github.com/genshinsim/gcsim/internal/weapons/sword/keyofkhajnisut" _ "github.com/genshinsim/gcsim/internal/weapons/sword/lion" _ "github.com/genshinsim/gcsim/internal/weapons/sword/mistsplitter" + _ "github.com/genshinsim/gcsim/internal/weapons/sword/peakpatrolsong" _ "github.com/genshinsim/gcsim/internal/weapons/sword/primordial" _ "github.com/genshinsim/gcsim/internal/weapons/sword/prototype" _ "github.com/genshinsim/gcsim/internal/weapons/sword/royal"