Skip to content

Commit

Permalink
add nightsoul to gcsl (genshinsim#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
imring authored Oct 12, 2024
1 parent 7bc8998 commit e11b0db
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/characters/mualani/mualani.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func (c *char) ActionReady(a action.Action, p map[string]int) (bool, action.Fail

func (c *char) Condition(fields []string) (any, error) {
switch fields[0] {
case "nightsoul":
return c.nightsoulState.Condition(fields)
case "momentum":
return c.momentumStacks, nil
default:
Expand Down
13 changes: 13 additions & 0 deletions internal/template/nightsoul/nightsoul.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package nightsoul

import (
"fmt"

"github.com/genshinsim/gcsim/pkg/core"
"github.com/genshinsim/gcsim/pkg/core/event"
"github.com/genshinsim/gcsim/pkg/core/glog"
Expand Down Expand Up @@ -75,3 +77,14 @@ func (s *State) clampPoints() {
func (s *State) Points() float64 {
return s.nightsoulPoints
}

func (s *State) Condition(fields []string) (any, error) {
switch fields[1] {
case "state":
return s.HasBlessing(), nil
case "points":
return s.Points(), nil
default:
return nil, fmt.Errorf("invalid nightsoul condition: %v", fields[1])
}
}
2 changes: 2 additions & 0 deletions ui/packages/docs/docs/reference/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ For example, if you are looking for the tag for Lisa's A4 (defense shred), then
| character name | `sets` | set name | - | Evaluates to the count of the set on the character. |
| character name | `stats` | `def%`/`def`/`hp`/`hp%`/`atk`/`atk%`/`er`/`em`/`cr`/`cd`/`heal`/`pyro%`/`hydro%`/`cryo%`/`electro%`/`anemo%`/`geo%`/`dendro%`/`phys%`/`atkspd%`/`dmg%` | - | Evaluates to the value of the stat on the character. |
| character name | `skill`/`burst`/`attack`/`charge`/`high_plunge`/`low_plunge`/`aim`/`dash`/`jump`/`swap`/`walk`/`wait` | `cd`/`charge`/`ready` | - | Evaluates to the following things for the specified action of the character: remaining cooldown / remaining charges (example: Sucrose Skill) / `1` if the action is ready, `0` otherwise. |
| character name | `nightsoul` | `state` | - | `1` if the character is in Nightsoul's Blessing state, `0` otherwise. |
| character name | `nightsoul` | `point` | - | Evaluates to the character's Nightsoul points. |

0 comments on commit e11b0db

Please sign in to comment.