june revised this gist 2 days ago. Go to revision
1 file changed, 45 insertions
game.nv(file created)
| @@ -0,0 +1,45 @@ | |||
| 1 | + | ||:@include: lib/math.nv | |
| 2 | + | ||
| 3 | + | | :enemies: spawn enemies | | |
| 4 | + | :enemies: automaton hp 10 | |
| 5 | + | :enemies: slime hp 4 | |
| 6 | + | :enemies: skeleton hp 5 | |
| 7 | + | ||
| 8 | + | |# handle player stats #| | |
| 9 | + | || :player atk: 1 | |
| 10 | + | | :equipped: sword? :player atk: 1| | |
| 11 | + | :player atk: 5 | |
| 12 | + | ||
| 13 | + | |# handle attacking enemies #| | |
| 14 | + | | :actions: attack $enemy :enemies: $enemy hp $val :player atk: $dmg?| | |
| 15 | + | :enemies: $enemy hp temp :@math: subtract $val $dmg | |
| 16 | + | ||
| 17 | + | | :enemies: $name hp temp :@math: $val | | |
| 18 | + | :enemies: $name hp $val | |
| 19 | + | ||
| 20 | + | |# searching for item #| | |
| 21 | + | | :actions: equip $item :equipment: $item| | |
| 22 | + | :equipped: $item | |
| 23 | + | :actions: re-pack equipment | |
| 24 | + | :log: equipped sword | |
| 25 | + | ||
| 26 | + | | :actions: equip $item? :equipment: $other| | |
| 27 | + | :temp equipment: $other | |
| 28 | + | :log: looking for $item put $other in temp | |
| 29 | + | ||
| 30 | + | | :actions: equip $item| | |
| 31 | + | :actions: re-pack equipment | |
| 32 | + | :log: failed to equip $item | |
| 33 | + | ||
| 34 | + | |# rules to restore equipment after search #| | |
| 35 | + | | :actions: re-pack equipment? :temp equipment: $item | | |
| 36 | + | :equipment: $item | |
| 37 | + | ||
| 38 | + | | :actions: re-pack equipment | | |
| 39 | + | :log: cleanup finished | |
| 40 | + | ||
| 41 | + | || :enemies: spawn enemies | |
| 42 | + | || :equipment: ( apple sword ) | |
| 43 | + | || :actions: equip egg | |
| 44 | + | || :actions: equip sword | |
| 45 | + | || :actions: attack automaton | |
Newer
Older