Skip to content

Commit

Permalink
add Crimson Moon's Semblance (#2164)
Browse files Browse the repository at this point in the history
* add Crimson Moon's Semblance

* refactor crimsonmoonssemblance
  • Loading branch information
kengzzzz committed May 28, 2024
1 parent 2d90b62 commit e04b111
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/weapons/spear/crimsonmoonssemblance/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package_name: crimsonmoonssemblance
genshin_id: 13512
key: crimsonmoonssemblance
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package crimsonmoonssemblance

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"
)

const (
icdKey = "crimsonmoonssemblance-icd"
icdDuration = 14 * 60
)

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

type Weapon struct {
Index int
}

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) {
var w Weapon
refine := p.Refine

c.Events.Subscribe(event.OnEnemyHit, func(args ...interface{}) bool {
ae := args[1].(*combat.AttackEvent)

if ae.Info.AttackTag != attacks.AttackTagExtra {
return false
}

if c.Player.Active() != char.Index {
return false
}

if char.StatusIsActive(icdKey) {
return false
}

char.AddStatus(icdKey, icdDuration, true)
char.ModifyHPDebtByRatio(0.25)

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

m := make([]float64, attributes.EndStatType)

char.AddStatMod(character.StatMod{
Base: modifier.NewBaseWithHitlag("crimsonmoonssemblance-bonus", -1),
AffectedStat: attributes.DmgP,
Amount: func() ([]float64, bool) {
maxhp := char.MaxHP()
m[attributes.DmgP] = 0.0
if char.CurrentHPDebt() > 0 {
m[attributes.DmgP] += 0.08 + 0.04*float64(refine)
}
if char.CurrentHPDebt() >= 0.3*maxhp {
m[attributes.DmgP] += 0.16 + 0.08*float64(refine)
}
return m, true
},
})

return &w, nil
}

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

63 changes: 63 additions & 0 deletions internal/weapons/spear/crimsonmoonssemblance/data_gen.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
id: 13512
key: "crimsonmoonssemblance"
rarity: 5
weapon_class: WEAPON_POLE
image_name: "UI_EquipIcon_Pole_BloodMoon"
base_stats: {
base_props: {
prop_type: FIGHT_PROP_BASE_ATTACK
initial_value: 47.537
curve: GROW_CURVE_ATTACK_302
}
base_props: {
prop_type: FIGHT_PROP_CRITICAL
initial_value: 0.048
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: 2944936683
2 changes: 2 additions & 0 deletions pkg/core/keys/weapon.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var weaponNames = []string{
"coolsteel",
"cranesechoingcall",
"crescentpike",
"crimsonmoonssemblance",
"darkironsword",
"deathmatch",
"debateclub",
Expand Down Expand Up @@ -244,6 +245,7 @@ const (
CoolSteel
CranesEchoingCall
CrescentPike
CrimsonMoonsSemblance
DarkIronSword
Deathmatch
DebateClub
Expand Down
2 changes: 2 additions & 0 deletions pkg/shortcut/weapons.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ var WeaponNameToKey = map[string]keys.Weapon{
"crescentpike": keys.CrescentPike,
"cpike": keys.CrescentPike,
"pike": keys.CrescentPike,
"crimsonmoon": keys.CrimsonMoonsSemblance,
"crimsonmoonssemblance": keys.CrimsonMoonsSemblance,
"darkironsword": keys.DarkIronSword,
"deathmatch": keys.Deathmatch,
"debateclub": keys.DebateClub,
Expand Down
1 change: 1 addition & 0 deletions pkg/simulation/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ import (
_ "github.com/genshinsim/gcsim/internal/weapons/spear/calamity"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/catch"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/crescent"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/crimsonmoonssemblance"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/deathmatch"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/dialoguesofthedesertsages"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/dragonbane"
Expand Down
25 changes: 25 additions & 0 deletions ui/packages/docs/docs/reference/weapons/crimsonmoonssemblance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Crimson Moon's Semblance
---

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

## Known issues

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

## Names

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

## Params

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

## Fields

<FieldsTable item_key="crimsonmoonssemblance" 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 @@ -65,6 +65,9 @@
"cpike",
"pike"
],
"crimsonmoonssemblance": [
"crimsonmoon"
],
"darkironsword": [],
"deathmatch": [],
"debateclub": [],
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 @@ -118,6 +118,7 @@
"coolsteel": "冷刃",
"cranesechoingcall": "鹤鸣余音",
"crescentpike": "流月针",
"crimsonmoonssemblance": "赤月之形",
"darkironsword": "暗铁剑",
"deathmatch": "决斗之枪",
"debateclub": "以理服人",
Expand Down Expand Up @@ -718,6 +719,7 @@
"coolsteel": "Cool Steel",
"cranesechoingcall": "Crane's Echoing Call",
"crescentpike": "Crescent Pike",
"crimsonmoonssemblance": "Crimson Moon's Semblance",
"darkironsword": "Dark Iron Sword",
"deathmatch": "Deathmatch",
"debateclub": "Debate Club",
Expand Down Expand Up @@ -1318,6 +1320,7 @@
"coolsteel": "Kühle Klinge",
"cranesechoingcall": "Widerhallender Ruf des Kranichs",
"crescentpike": "Mondpike",
"crimsonmoonssemblance": "Form des scharlachroten Mondes",
"darkironsword": "Dunkles Eisenschwert",
"deathmatch": "Duelllanze",
"debateclub": "Schlagfestes Argument",
Expand Down Expand Up @@ -1918,6 +1921,7 @@
"coolsteel": "冷刃",
"cranesechoingcall": "鶴鳴の余韻",
"crescentpike": "流月の針",
"crimsonmoonssemblance": "赤月のシルエット",
"darkironsword": "暗鉄剣",
"deathmatch": "死闘の槍",
"debateclub": "理屈責め",
Expand Down Expand Up @@ -2517,6 +2521,7 @@
"coolsteel": "차가운 칼날",
"cranesechoingcall": "학의 여음",
"crescentpike": "유월창",
"crimsonmoonssemblance": "붉은 달의 형상",
"darkironsword": "암철검",
"deathmatch": "결투의 창",
"debateclub": "훌륭한 대화수단",
Expand Down Expand Up @@ -3117,6 +3122,7 @@
"coolsteel": "Холодное лезвие",
"cranesechoingcall": "Звонкий клич журавля",
"crescentpike": "Пика полумесяца",
"crimsonmoonssemblance": "Очертания алой луны",
"darkironsword": "Тёмный железный меч",
"deathmatch": "Смертельный бой",
"debateclub": "Дубина переговоров",
Expand Down Expand Up @@ -3717,6 +3723,7 @@
"coolsteel": "Hoja Fría",
"cranesechoingcall": "Reverberación de la Grulla",
"crescentpike": "Pica Luna Creciente",
"crimsonmoonssemblance": "Semblante de la Luna Carmesí",
"darkironsword": "Espada de Hierro Oscuro",
"deathmatch": "Lanza del Duelo",
"debateclub": "Garrote del Debate",
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 @@ -208,6 +208,14 @@
"image_name": "UI_EquipIcon_Pole_Exotic",
"name_text_hash_map ": "578575283"
},
"crimsonmoonssemblance": {
"id": 13512,
"key": "crimsonmoonssemblance",
"rarity": 5,
"weapon_class": "WEAPON_POLE",
"image_name": "UI_EquipIcon_Pole_BloodMoon",
"name_text_hash_map ": "2944936683"
},
"darkironsword": {
"id": 11304,
"key": "darkironsword",
Expand Down

0 comments on commit e04b111

Please sign in to comment.