diff options
| author | historia <[not public]> | 2026-06-19 21:20:32 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-19 21:20:32 -0400 |
| commit | 5ea082ab4e82409aebc889b496f43e52b003d4f7 (patch) | |
| tree | 942f2c4a18ecbee42ba25726048d09827ea68894 /internal/game/sys_science.go | |
| parent | 8ee8982b8759bcae116647cc993867f4c8b0a6ce (diff) | |
| download | thehouseoficarus-5ea082ab4e82409aebc889b496f43e52b003d4f7.tar.gz | |
feat: science combat/triggers overhauled. decks now use autotrigger attacks.
Diffstat (limited to 'internal/game/sys_science.go')
| -rw-r--r-- | internal/game/sys_science.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/internal/game/sys_science.go b/internal/game/sys_science.go index 23aeef4..e35105a 100644 --- a/internal/game/sys_science.go +++ b/internal/game/sys_science.go @@ -81,6 +81,59 @@ func FindMod(input string) *ModDef { return nil } +func findAllModMatches(input string) []*ModDef { + inputWords := strings.Fields(strings.ToLower(input)) + if len(inputWords) == 0 { + return nil + } + var matches []*ModDef + for _, m := range AllMods { + lowerName := strings.ToLower(m.Name) + lowerID := strings.ToLower(m.ID) + allMatch := true + for _, word := range inputWords { + if !strings.Contains(lowerName, word) && !strings.Contains(lowerID, word) { + allMatch = false + break + } + } + if allMatch { + matches = append(matches, m) + } + } + return matches +} + +func FindModForPlayer(input string, sciLevel int) *ModDef { + if m, ok := modByID[input]; ok { + return m + } + lower := strings.ToLower(strings.ReplaceAll(input, " ", "_")) + for _, m := range AllMods { + if strings.HasPrefix(m.ID, lower) { + return m + } + } + + matches := findAllModMatches(input) + if len(matches) == 0 { + return nil + } + if len(matches) == 1 { + return matches[0] + } + + sort.Slice(matches, func(i, j int) bool { + return matches[i].Level > matches[j].Level + }) + for _, m := range matches { + if m.Level <= sciLevel { + return m + } + } + return matches[len(matches)-1] +} + type chipEntry struct { Input string Output string |
