diff options
Diffstat (limited to 'internal/game/cmd_agility.go')
| -rw-r--r-- | internal/game/cmd_agility.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/game/cmd_agility.go b/internal/game/cmd_agility.go new file mode 100644 index 0000000..3bd777f --- /dev/null +++ b/internal/game/cmd_agility.go @@ -0,0 +1,37 @@ +package game + +import ( + "fmt" + + "thehouseoficarus/internal/combat" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" +) + +func (g *Game) doObstacle(sess *net.Session, verb string) { + p := sess.Player.(*player.Player) + + if combat.GetCombat(p.Name) != nil { + sess.WriteLine("You can't do that during combat!") + return + } + + info := g.CourseStore.GetObstacle(p.RoomID) + if info == nil || info.Verb != verb { + sess.WriteLine("You can't do that here.") + return + } + + agilityLevel := p.Level(player.Agility) + if agilityLevel < info.RequiredLevel { + sess.WriteLine(fmt.Sprintf("You need level %d agility to attempt this course.", info.RequiredLevel)) + return + } + + if p.Action != nil { + g.CancelAction(p) + } + g.CancelBackgroundAction(p) + + g.startObstacle(sess, p, info) +} |
