blob: 084c5cfe48488698fff180986d09e441e12d0010 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
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)
}
|