diff options
Diffstat (limited to 'internal/game/cmd_trigger.go')
| -rw-r--r-- | internal/game/cmd_trigger.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/internal/game/cmd_trigger.go b/internal/game/cmd_trigger.go index 7d637ca..0acbeff 100644 --- a/internal/game/cmd_trigger.go +++ b/internal/game/cmd_trigger.go @@ -22,7 +22,7 @@ func (g *Game) doTrigger(sess *net.Session, input string) { return } - mod, targetArg := g.parseTriggerArgs(input) + mod, targetArg := g.parseTriggerArgs(input, p.Level(player.Science)) if mod == nil { sess.WriteLine("Unknown mod. Type 'mods' to see available mods.") return @@ -50,12 +50,12 @@ func (g *Game) doTrigger(sess *net.Session, input string) { } } -func (g *Game) parseTriggerArgs(input string) (*ModDef, string) { +func (g *Game) parseTriggerArgs(input string, sciLevel int) (*ModDef, string) { lower := strings.ToLower(input) words := strings.Fields(lower) for i := len(words); i > 0; i-- { candidate := strings.Join(words[:i], " ") - mod := FindMod(candidate) + mod := FindModForPlayer(candidate, sciLevel) if mod != nil { target := strings.TrimSpace(strings.Join(words[i:], " ")) return mod, target @@ -66,8 +66,8 @@ func (g *Game) parseTriggerArgs(input string) (*ModDef, string) { func (g *Game) triggerCombatMod(sess *net.Session, p *player.Player, mod *ModDef, targetArg string) { if cs := combat.GetCombat(p.Name); cs != nil { - p.AutotriggerMod = mod.ID - sess.WriteLine(fmt.Sprintf("You switch to triggering %s.", mod.Name)) + p.QueuedTrigger = mod.ID + sess.WriteLine(fmt.Sprintf("You queue %s for your next attack.", mod.Name)) return } @@ -106,6 +106,10 @@ func (g *Game) triggerCombatMod(sess *net.Session, p *player.Player, mod *ModDef return } - p.AutotriggerMod = mod.ID + if g.hasDeckEquipped(p) { + p.AutotriggerMod = mod.ID + } else { + p.QueuedTrigger = mod.ID + } g.startCombat(sess, p, mob) } |
