View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Jesse Shieh

knife := AGObject named: 'knife'.
knife description: 'A dangerous knife'.
knife longDescription: 'A long and dangerous looking knife, probably used to peel apples.'.

kitten := AGObject named: 'kitten'.
kitten description: 'An adorable kitten.'.

kitchen := AGRoom named: 'kitchen'.
kitchen description: 'A bright and cheery kitchen.'.
kitchen longDescription: 'A bright and cheery kitchen, with daisies on the wallpaper and sunlight streaming through the window.'.

livingRoom := AGRoom named: 'living room'.
livingRoom description: 'A comfortable living room.'.

kitchen to: #north attach: livingRoom.
kitchen contain: knife.
kitchen contain: kitten.

troll := AGCharacter named: 'troll'.
troll description: 'A fierce troll'.
troll longDescription: 'A fierce troll, with murderous intent!'.
livingRoom contain: troll.

troll when: [:player :me :world |
(me container = player container) and: [(me flag: 'attacking') isNil] ] do:
[:player :me :world |world print: 'The troll starts to come toward you, with fangs bared and claws outstretched'.
me flag: 'attacking' value: 1. ].


troll when: [:player :me :world | (me flag: 'attacking') isNil not and: [(me flag: 'attacking') < 5]]
do: [:player :me :world |
me flag: 'attacking' value: (1 + (me flag: 'attacking')).].
troll when: [:player :me :world | (me flag: 'attacking') isNil not and:
[(me flag: 'attacking') >= 5]]
do: [:player :me :world |
world print: 'The troll has you! You die!'. world quit.].

knife verbMatch: 'use' do:
[:player :me :world |
(player container has: (world character: 'troll')) ifTrue:
[world print: 'The knife flies through the air and the troll is killed!'.
player drop: me.
(world character: 'troll') die.
(world character: 'troll') description: 'A seriously dead troll']
ifFalse: [world print: 'On what? I do not see any apples around here!']].
knife verbMatch: 'throw' do: (knife verbHandler: 'use').

kitten verbMatch: 'use' do:
[:player :me :world |
(player container has: (world character: 'troll')) ifTrue:
[world print: 'The kitten flies through the air and the troll swallows it!'.
player drop: me.
me die.
me destroy.]
ifFalse: [world print: 'Exactly how does one use a kitten?']].
kitten verbMatch: 'throw' do: (kitten verbHandler: 'use').

houseWorld := AGWorld named: 'The Household World'.
houseWorld startAt: kitchen.
houseWorld add: livingRoom.
houseWorld start.

Links to this Page