Skip to content

Commit

Permalink
Sturdy bone (#2252)
Browse files Browse the repository at this point in the history
* me when the bone is sturdy

* check active char

* forgor

* fix event name

---------

Co-authored-by: imring <35897995+imring@users.noreply.github.com>
  • Loading branch information
clevernt and imring authored Oct 22, 2024
1 parent 8d4edc3 commit dbc049a
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/weapons/sword/sturdybone/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package_name: sturdybone
genshin_id: 11430
key: sturdybone
63 changes: 63 additions & 0 deletions internal/weapons/sword/sturdybone/data_gen.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
id: 11430
key: "sturdybone"
rarity: 4
weapon_class: WEAPON_SWORD_ONE_HAND
image_name: "UI_EquipIcon_Sword_Umpakati"
base_stats: {
base_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
initial_value: 43.7349
curve: GROW_CURVE_ATTACK_202
}
base_props: {
prop_type: FIGHT_PROP_ATTACK_PERCENT
initial_value: 0.06
curve: GROW_CURVE_CRITICAL_201
}
promo_data: {
max_level: 20
}
promo_data: {
max_level: 40
add_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
value: 25.9
}
}
promo_data: {
max_level: 50
add_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
value: 51.9
}
}
promo_data: {
max_level: 60
add_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
value: 77.8
}
}
promo_data: {
max_level: 70
add_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
value: 103.7
}
}
promo_data: {
max_level: 80
add_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
value: 129.7
}
}
promo_data: {
max_level: 90
add_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
value: 155.6
}
}
}
name_text_hash_map: 495182275
85 changes: 85 additions & 0 deletions internal/weapons/sword/sturdybone/sturdybone.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package sturdybone

import (
"fmt"

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

const (
buffKey = "sturdy-bone"
)

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

type Weapon struct {
Index int
}

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

// Sprint or Alternate Sprint Stamina Consumption decreased by 15%.
// Additionally, after using Sprint or Alternate Sprint, Normal Attack DMG is increased by 32% of ATK.
// This effect expires after triggering 18 times or 7s.
func NewWeapon(c *core.Core, char *character.CharWrapper, p info.WeaponProfile) (info.Weapon, error) {
w := &Weapon{}
r := p.Refine

c.Player.AddStamPercentMod(buffKey, -1, func(a action.Action) (float64, bool) {
return -0.15, false
})

naDmg := 0.12 + 0.4*float64(r)
c.Events.Subscribe(event.OnDash, func(args ...interface{}) bool {
if c.Player.Active() != char.Index {
return false
}

char.SetTag(buffKey, 18)
char.AddStatus(buffKey, 7*60, true)

return false
}, fmt.Sprintf("sturdybone-%v", char.Base.Key.String()))

c.Events.Subscribe(event.OnEnemyHit, func(args ...interface{}) bool {
if c.Player.Active() != char.Index {
return false
}

atk := args[1].(*combat.AttackEvent)
if atk.Info.ActorIndex != char.Index {
return false
}
if atk.Info.AttackTag != attacks.AttackTagNormal {
return false
}

if !char.StatusIsActive(buffKey) || char.Tag(buffKey) == 0 {
return false
}

dmgAdded := char.Stat(attributes.ATK) * naDmg
atk.Info.FlatDmg += dmgAdded

char.SetTag(buffKey, char.Tag(buffKey)-1)

c.Log.NewEvent("sturdy bone buff", glog.LogPreDamageMod, char.Index).
Write("damage_added", dmgAdded).
Write("remaining_stacks", char.Tags[buffKey])

return false
}, fmt.Sprintf("sturdybone-%v", char.Base.Key.String()))
return w, nil
}
25 changes: 25 additions & 0 deletions internal/weapons/sword/sturdybone/sturdybone_gen.go

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

2 changes: 2 additions & 0 deletions pkg/core/keys/weapon.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ var weaponNames = []string{
"splendoroftranquilwaters",
"staffofhoma",
"staffofthescarletsands",
"sturdybone",
"summitshaper",
"surfsup",
"swordofdescension",
Expand Down Expand Up @@ -390,6 +391,7 @@ const (
SplendorOfTranquilWaters
StaffOfHoma
StaffOfTheScarletSands
SturdyBone
SummitShaper
SurfsUp
SwordOfDescension
Expand Down
1 change: 1 addition & 0 deletions pkg/shortcut/weapons.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ var WeaponNameToKey = map[string]keys.Weapon{
"scarletsands": keys.StaffOfTheScarletSands,
"scarlet": keys.StaffOfTheScarletSands,
"sss": keys.StaffOfTheScarletSands,
"sturdybone": keys.SturdyBone,
"summitshaper": keys.SummitShaper,
"summit": keys.SummitShaper,
"surfsup": keys.SurfsUp,
Expand Down
1 change: 1 addition & 0 deletions pkg/simulation/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ import (
_ "github.com/genshinsim/gcsim/internal/weapons/sword/skyrider"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/skyward"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/splendoroftranquilwaters"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/sturdybone"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/summit"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/swordofdescension"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/swordofnarzissenkreuz"
Expand Down
29 changes: 29 additions & 0 deletions ui/packages/docs/docs/reference/weapons/sturdybone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Sturdy Bone
---

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="sturdybone" data_src="weapon" />

## Known issues

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

## Names

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

## Params

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

## Fields

<FieldsTable item_key="sturdybone" data_src="weapon" />
1 change: 1 addition & 0 deletions ui/packages/docs/src/components/Names/weapon_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"scarlet",
"sss"
],
"sturdybone": [],
"summitshaper": [
"summit"
],
Expand Down
7 changes: 7 additions & 0 deletions ui/packages/localization/src/locales/names.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
"splendoroftranquilwaters": "静水流涌之辉",
"staffofhoma": "护摩之杖",
"staffofthescarletsands": "赤沙之杖",
"sturdybone": "弥坚骨",
"summitshaper": "斫峰之刃",
"surfsup": "冲浪时光",
"swordofdescension": "降临之剑",
Expand Down Expand Up @@ -920,6 +921,7 @@
"splendoroftranquilwaters": "Splendor of Tranquil Waters",
"staffofhoma": "Staff of Homa",
"staffofthescarletsands": "Staff of the Scarlet Sands",
"sturdybone": "Sturdy Bone",
"summitshaper": "Summit Shaper",
"surfsup": "Surf's Up",
"swordofdescension": "Sword of Descension",
Expand Down Expand Up @@ -1585,6 +1587,7 @@
"splendoroftranquilwaters": "Pracht des stillen Wassers",
"staffofhoma": "Homa-Stab",
"staffofthescarletsands": "Stab der roten Sande",
"sturdybone": "Robuster Knochen",
"summitshaper": "Gipfelbrecher",
"surfsup": "Zeit fürs Wellenreiten",
"swordofdescension": "Schwert der Niederkunft",
Expand Down Expand Up @@ -2250,6 +2253,7 @@
"splendoroftranquilwaters": "静水流転の輝き",
"staffofhoma": "護摩の杖",
"staffofthescarletsands": "赤砂の杖",
"sturdybone": "ストロング・ボーン",
"summitshaper": "斬山の刃",
"surfsup": "サーフィンタイム",
"swordofdescension": "降臨の剣",
Expand Down Expand Up @@ -2914,6 +2918,7 @@
"splendoroftranquilwaters": "고요히 샘솟는 빛",
"staffofhoma": "호마의 지팡이",
"staffofthescarletsands": "적색 사막의 지팡이",
"sturdybone": "견고한 골검",
"summitshaper": "참봉의 칼날",
"surfsup": "서핑 타임",
"swordofdescension": "강림의 검",
Expand Down Expand Up @@ -3579,6 +3584,7 @@
"splendoroftranquilwaters": "Блеск тихих вод",
"staffofhoma": "Посох Хомы",
"staffofthescarletsands": "Посох алых песков",
"sturdybone": "Крепкая кость",
"summitshaper": "Кромсатель пиков",
"surfsup": "Лови волну",
"swordofdescension": "Меч нисхождения",
Expand Down Expand Up @@ -4244,6 +4250,7 @@
"splendoroftranquilwaters": "Fulgor de las Aguas Calmas",
"staffofhoma": "Báculo de Homa",
"staffofthescarletsands": "Báculo de las Arenas Escarlatas",
"sturdybone": "Hueso Recio",
"summitshaper": "Rompemontañas",
"surfsup": "Hora de Surfear",
"swordofdescension": "Espada del Descenso",
Expand Down
8 changes: 8 additions & 0 deletions ui/packages/ui/src/Data/weapon_data.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,14 @@
"image_name": "UI_EquipIcon_Pole_Deshret",
"name_text_hash_map ": "4238339131"
},
"sturdybone": {
"id": 11430,
"key": "sturdybone",
"rarity": 4,
"weapon_class": "WEAPON_SWORD_ONE_HAND",
"image_name": "UI_EquipIcon_Sword_Umpakati",
"name_text_hash_map ": "495182275"
},
"summitshaper": {
"id": 11504,
"key": "summitshaper",
Expand Down

0 comments on commit dbc049a

Please sign in to comment.