summaryrefslogtreecommitdiff
path: root/resources.tcl
blob: de0a7304c475cbb374dbe3c402304cc702fa3475 (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
38
39
40
oo::class create food {
  method title {} {
    my variable name
    return $name
  }

  method value {} {
    my variable satiation
    return $satiation
  }
  
  method eat {} {
    my variable consumption
    puts $consumption
  }
}

oo::class create water {
  superclass food

  constructor {} {
    my variable satiation consumption name
    set satiation 5
    set name water
    set consumption "You enjoy some fresh water."
    puts "You gather some clean water from the nearby river."
  }
}

oo::class create apples {
  superclass food

  constructor {} {
    my variable satiation consumption name
    set satiation [expr int(rand() * 5) + 8]
    set name apples
    set consumption "You enjoy a crisp, red apple."
    puts "You gather some ripe apples from the forest."
  }
}