Skip to content

Commit

Permalink
Add The Dockhand's Assistant (genshinsim#1730)
Browse files Browse the repository at this point in the history
* inital implementation

* update curves, weapon text

* update weapon_data

* update pipeline, fix grammar

* fix grammar

* update lint

* fix curve

* fix nits

---------

Co-authored-by: imring <vitaliyvorobets25@gmail.com>
  • Loading branch information
Athenaxdd and imring authored Oct 31, 2023
1 parent ea434ea commit 0ea5c61
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 34 deletions.
3 changes: 3 additions & 0 deletions internal/weapons/sword/dockhand/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package_name: thedockhandsassistant
genshin_id: 11427
key: thedockhandsassistant
124 changes: 124 additions & 0 deletions internal/weapons/sword/dockhand/dockhand.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package dockhand

import (
"fmt"

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

const icdKey = "dockhands-assistant-icd"

var symbol = []string{"unity-symbol-0", "unity-symbol-1", "unity-symbol-2"}

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

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

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

// When the wielder is healed or heals others, they will gain a Unity's Symbol that lasts 30s, up to a maximum of 3 Symbols.
// When using their Elemental Skill or Burst, all Symbols will be consumed and the Roused effect will be granted for 10s.
// For each Symbol consumed, gain 40/50/60/70/80 Elemental Mastery,
// and 2s after the effect occurs, 2/2.5/3/3.5/4 Energy per Symbol consumed will be restored for said character.
// The Roused effect can be triggered once every 15s,
// and Symbols can be gained even when the character is not on the field.

func NewWeapon(c *core.Core, char *character.CharWrapper, p info.WeaponProfile) (info.Weapon, error) {
w := &Weapon{
core: c,
char: char,
refine: p.Refine,
buff: make([]float64, attributes.EndStatType),
}

c.Events.Subscribe(event.OnHeal, func(args ...interface{}) bool {
source := args[0].(*player.HealInfo)
index := args[1].(int)
amount := args[2].(float64)
if source.Caller != char.Index && index != char.Index { // heal others and get healed including wielder
return false
}
if amount <= 0 {
return false
}

// override oldest symbol
idx := 0
for i, s := range symbol {
if char.StatusExpiry(s) < char.StatusExpiry(symbol[idx]) {
idx = i
}
}
char.AddStatus(symbol[idx], 30*60, true)

c.Log.NewEvent("dockhands-assistant proc'd", glog.LogWeaponEvent, char.Index).
Write("index", idx)

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

key := fmt.Sprintf("dockhands-assistant-roused-%v", char.Base.Key.String())
c.Events.Subscribe(event.OnBurst, w.consumeEnergy, key)
c.Events.Subscribe(event.OnSkill, w.consumeEnergy, key)
return w, nil
}

func (w *Weapon) consumeEnergy(args ...interface{}) bool {
em := 30 + 10*float64(w.refine)
refund := 1.5 + 0.5*float64(w.refine)

// check for active before deleting symbol
if w.char.StatusIsActive(icdKey) {
return false
}
if w.core.Player.Active() != w.char.Index {
return false
}

count := 0
for _, s := range symbol {
if w.char.StatusIsActive(s) {
count++
}
w.char.DeleteStatus(s)
}
if count == 0 {
return false
}

w.char.AddStatus(icdKey, 15*60, true)
w.buff[attributes.EM] = em * float64(count)

// add em buff
w.char.AddStatMod(character.StatMod{
Base: modifier.NewBaseWithHitlag("dockhands-assistant-em", 10*60),
AffectedStat: attributes.EM,
Amount: func() ([]float64, bool) {
return w.buff, true
},
})

// regen energy after 2 secs
w.char.QueueCharTask(func() {
w.char.AddEnergy("dockhands-assistant-energy", refund*float64(count))
}, 2*60)

return false
}
37 changes: 37 additions & 0 deletions pkg/core/curves/weaponcurves.go
Original file line number Diff line number Diff line change
Expand Up @@ -5188,6 +5188,43 @@ var WeaponBaseMap = map[keys.Weapon]WeaponBase{
},
},
},
keys.TheDockhandsAssistant: {
AtkCurve: GROW_CURVE_ATTACK_201,
SpecializedCurve: GROW_CURVE_CRITICAL_201,
BaseAtk: 42.4010009765625,
BaseSpecialized: 0.09000000357627869,
Specialized: attributes.HPP,
PromotionBonus: []PromoData{
{
MaxLevel: 20,
Atk: 0,
},
{
MaxLevel: 40,
Atk: 25.899999618530273,
},
{
MaxLevel: 50,
Atk: 51.900001525878906,
},
{
MaxLevel: 60,
Atk: 77.80000305175781,
},
{
MaxLevel: 70,
Atk: 103.69999694824219,
},
{
MaxLevel: 80,
Atk: 129.6999969482422,
},
{
MaxLevel: 90,
Atk: 155.60000610351562,
},
},
},
keys.TheFirstGreatMagic: {
AtkCurve: GROW_CURVE_ATTACK_301,
SpecializedCurve: GROW_CURVE_CRITICAL_301,
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 @@ -175,6 +175,7 @@ var weaponNames = []string{
"thebell",
"theblacksword",
"thecatch",
"thedockhandsassistant",
"thefirstgreatmagic",
"theflute",
"thestringless",
Expand Down Expand Up @@ -347,6 +348,7 @@ const (
TheBell
TheBlackSword
TheCatch
TheDockhandsAssistant
TheFirstGreatMagic
TheFlute
TheStringless
Expand Down
2 changes: 2 additions & 0 deletions pkg/shortcut/weapons.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ var WeaponNameToKey = map[string]keys.Weapon{
"blacksword": keys.TheBlackSword,
"thecatch": keys.TheCatch,
"catch": keys.TheCatch,
"thedockhandsassistant": keys.TheDockhandsAssistant,
"dockhand": keys.TheDockhandsAssistant,
"thefirstgreatmagic": keys.TheFirstGreatMagic,
"firstgreatmagic": keys.TheFirstGreatMagic,
"fgm": keys.TheFirstGreatMagic,
Expand Down
1 change: 1 addition & 0 deletions pkg/simulation/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ import (
_ "github.com/genshinsim/gcsim/internal/weapons/sword/cinnabar"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/coolsteel"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/darkironsword"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/dockhand"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/dullblade"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/favonius"
_ "github.com/genshinsim/gcsim/internal/weapons/sword/festering"
Expand Down
34 changes: 17 additions & 17 deletions ui/packages/db/src/Data/char_data.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,23 @@
"burst_energy_cost": 60
}
},
"luminehydro": {
"id": 10000007,
"sub_id": 703,
"key": "luminehydro",
"rarity": "QUALITY_ORANGE",
"body": "BODY_GIRL",
"region": "ASSOC_TYPE_MAINACTOR",
"element": "Water",
"weapon_class": "WEAPON_SWORD_ONE_HAND",
"icon_name": "UI_AvatarIcon_PlayerGirl",
"skill_details": {
"skill": 10087,
"burst": 10088,
"attack": 100552,
"burst_energy_cost": 80
}
},
"lynette": {
"id": 10000083,
"key": "lynette",
Expand Down Expand Up @@ -775,23 +792,6 @@
"burst_energy_cost": 60
}
},
"luminehydro": {
"id": 10000007,
"sub_id": 703,
"key": "luminehydro",
"rarity": "QUALITY_ORANGE",
"body": "BODY_GIRL",
"region": "ASSOC_TYPE_MAINACTOR",
"element": "Water",
"weapon_class": "WEAPON_SWORD_ONE_HAND",
"icon_name": "UI_AvatarIcon_PlayerGirl",
"skill_details": {
"skill": 10087,
"burst": 10088,
"attack": 100552,
"burst_energy_cost": 80
}
},
"mika": {
"id": 10000080,
"key": "mika",
Expand Down
29 changes: 29 additions & 0 deletions ui/packages/docs/docs/reference/weapons/thedockhandsassistance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "The Dockhand's Assistant"
---

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

## Known issues

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

## Names

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

## Params

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

## Fields

<FieldsTable item_key="thedockhandsassistant" 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 @@ -333,6 +333,9 @@
"thecatch": [
"catch"
],
"thedockhandsassistant": [
"dockhand"
],
"thefirstgreatmagic": [
"firstgreatmagic",
"fgm"
Expand Down
34 changes: 17 additions & 17 deletions ui/packages/ui/src/Data/char_data.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,23 @@
"burst_energy_cost": 60
}
},
"luminehydro": {
"id": 10000007,
"sub_id": 703,
"key": "luminehydro",
"rarity": "QUALITY_ORANGE",
"body": "BODY_GIRL",
"region": "ASSOC_TYPE_MAINACTOR",
"element": "Water",
"weapon_class": "WEAPON_SWORD_ONE_HAND",
"icon_name": "UI_AvatarIcon_PlayerGirl",
"skill_details": {
"skill": 10087,
"burst": 10088,
"attack": 100552,
"burst_energy_cost": 80
}
},
"lynette": {
"id": 10000083,
"key": "lynette",
Expand Down Expand Up @@ -775,23 +792,6 @@
"burst_energy_cost": 60
}
},
"luminehydro": {
"id": 10000007,
"sub_id": 703,
"key": "luminehydro",
"rarity": "QUALITY_ORANGE",
"body": "BODY_GIRL",
"region": "ASSOC_TYPE_MAINACTOR",
"element": "Water",
"weapon_class": "WEAPON_SWORD_ONE_HAND",
"icon_name": "UI_AvatarIcon_PlayerGirl",
"skill_details": {
"skill": 10087,
"burst": 10088,
"attack": 100552,
"burst_energy_cost": 80
}
},
"mika": {
"id": 10000080,
"key": "mika",
Expand Down
7 changes: 7 additions & 0 deletions ui/packages/ui/src/Data/weapon_data.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,13 @@
"weapon_class": "WEAPON_POLE",
"image_name": "UI_EquipIcon_Pole_Mori"
},
"thedockhandsassistant": {
"id": 11427,
"key": "thedockhandsassistant",
"rarity": 4,
"weapon_class": "WEAPON_SWORD_ONE_HAND",
"image_name": "UI_EquipIcon_Sword_Mechanic"
},
"thefirstgreatmagic": {
"id": 15512,
"key": "thefirstgreatmagic",
Expand Down

0 comments on commit 0ea5c61

Please sign in to comment.