comparison gamelib/tests/test_scene_interactions_cryo.py @ 816:eed75a1d50c4 pyntnclick

Better Item handling.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 27 Jan 2013 22:19:39 +0200
parents bdaffaa8b6bf
children
comparison
equal deleted inserted replaced
815:8f94fbf05ab9 816:eed75a1d50c4
21 "The door is closed and we touch it with the titanium leg. It opens." 21 "The door is closed and we touch it with the titanium leg. It opens."
22 22
23 self.state.add_inventory_item('titanium_leg') 23 self.state.add_inventory_item('titanium_leg')
24 self.assert_game_data('door', 'shut', 'cryo.door') 24 self.assert_game_data('door', 'shut', 'cryo.door')
25 25
26 self.interact_thing('cryo.door', 'titanium_leg') 26 self.interact_thing('cryo.door', 'titanium_leg:')
27 27
28 self.assert_game_data('door', 'shut', 'cryo.door') 28 self.assert_game_data('door', 'shut', 'cryo.door')
29 self.assert_inventory_item('titanium_leg', True) 29 self.assert_inventory_item('titanium_leg:', True)
30 30
31 def test_cryo_door_ajar_hand(self): 31 def test_cryo_door_ajar_hand(self):
32 "The door is ajar and we touch it with the hand. No change." 32 "The door is ajar and we touch it with the hand. No change."
33 33
34 self.set_game_data('door', 'ajar', 'cryo.door') 34 self.set_game_data('door', 'ajar', 'cryo.door')
41 "The door is ajar and we touch it with the titanium leg. It opens." 41 "The door is ajar and we touch it with the titanium leg. It opens."
42 42
43 self.state.add_inventory_item('titanium_leg') 43 self.state.add_inventory_item('titanium_leg')
44 self.set_game_data('door', 'ajar', 'cryo.door') 44 self.set_game_data('door', 'ajar', 'cryo.door')
45 45
46 self.interact_thing('cryo.door', 'titanium_leg') 46 self.interact_thing('cryo.door', 'titanium_leg:')
47 47
48 self.assert_game_data('door', 'open', 'cryo.door') 48 self.assert_game_data('door', 'open', 'cryo.door')
49 self.assert_inventory_item('titanium_leg', True) 49 self.assert_inventory_item('titanium_leg:', True)
50 50
51 def test_cryo_door_open_hand(self): 51 def test_cryo_door_open_hand(self):
52 "The door is open and we touch it with the hand. We go to the map." 52 "The door is open and we touch it with the hand. We go to the map."
53 53
54 self.set_game_data('door', 'open', 'cryo.door') 54 self.set_game_data('door', 'open', 'cryo.door')
62 "The door is open and we touch it with the titanium leg. No change." 62 "The door is open and we touch it with the titanium leg. No change."
63 63
64 self.state.add_inventory_item('titanium_leg') 64 self.state.add_inventory_item('titanium_leg')
65 self.set_game_data('door', 'open', 'cryo.door') 65 self.set_game_data('door', 'open', 'cryo.door')
66 66
67 self.interact_thing('cryo.door', 'titanium_leg') 67 self.interact_thing('cryo.door', 'titanium_leg:')
68 68
69 self.assert_game_data('door', 'open', 'cryo.door') 69 self.assert_game_data('door', 'open', 'cryo.door')
70 self.assert_current_scene('cryo') 70 self.assert_current_scene('cryo')
71 71
72 def test_cryo_unit_alpha_full_hand(self): 72 def test_cryo_unit_alpha_full_hand(self):
73 "The cryo unit has the leg in it and we touch it. We get the leg." 73 "The cryo unit has the leg in it and we touch it. We get the leg."
74 74
75 self.interact_thing('cryo.unit.1') 75 self.interact_thing('cryo.unit.1')
76 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1') 76 self.assert_game_data('contains_titanium_leg', True, 'cryo.unit.1')
77 self.assert_inventory_item('titanium_leg', False) 77 self.assert_inventory_item('titanium_leg:', False)
78 self.assert_detail_thing('cryo.titanium_leg', True) 78 self.assert_detail_thing('cryo.titanium_leg', True)
79 79
80 self.interact_thing('cryo.titanium_leg', detail='cryo_detail') 80 self.interact_thing('cryo.titanium_leg', detail='cryo_detail')
81 81
82 self.assert_inventory_item('titanium_leg', True) 82 self.assert_inventory_item('titanium_leg:', True)
83 self.assert_detail_thing('cryo.titanium_leg', False) 83 self.assert_detail_thing('cryo.titanium_leg', False)
84 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1') 84 self.assert_game_data('contains_titanium_leg', False, 'cryo.unit.1')
85 85
86 def test_cryo_unit_detail(self): 86 def test_cryo_unit_detail(self):
87 "The cryo unit thing opens a detail window." 87 "The cryo unit thing opens a detail window."
126 126
127 self.state.add_inventory_item('machete') 127 self.state.add_inventory_item('machete')
128 self.assert_game_data('fixed', True, 'cryo.pipe.left') 128 self.assert_game_data('fixed', True, 'cryo.pipe.left')
129 self.assert_game_data('fixed', True, 'cryo.pipe.right.top') 129 self.assert_game_data('fixed', True, 'cryo.pipe.right.top')
130 self.assert_game_data('fixed', True, 'cryo.pipe.right.bottom') 130 self.assert_game_data('fixed', True, 'cryo.pipe.right.bottom')
131 self.assert_item_exists('cryo_pipe.0', False) 131 self.assert_item_exists('cryo_pipe:0', False)
132 self.assert_item_exists('cryo_pipe.1', False) 132 self.assert_item_exists('cryo_pipe:1', False)
133 self.assert_item_exists('cryo_pipe.2', False) 133 self.assert_item_exists('cryo_pipe:2', False)
134 134
135 self.assertNotEquals( 135 self.assertNotEquals(
136 None, self.interact_thing('cryo.pipe.left', 'machete')) 136 None, self.interact_thing('cryo.pipe.left', 'machete:'))
137 self.assertNotEquals( 137 self.assertNotEquals(
138 None, self.interact_thing('cryo.pipe.right.top', 'machete')) 138 None, self.interact_thing('cryo.pipe.right.top', 'machete:'))
139 self.assertNotEquals( 139 self.assertNotEquals(
140 None, self.interact_thing('cryo.pipe.right.bottom', 'machete')) 140 None, self.interact_thing('cryo.pipe.right.bottom', 'machete:'))
141 141
142 self.assert_game_data('fixed', False, 'cryo.pipe.left') 142 self.assert_game_data('fixed', False, 'cryo.pipe.left')
143 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') 143 self.assert_game_data('fixed', False, 'cryo.pipe.right.top')
144 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') 144 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom')
145 self.assert_item_exists('tube_fragment.0') 145 self.assert_item_exists('tube_fragment:0')
146 self.assert_item_exists('tube_fragment.1') 146 self.assert_item_exists('tube_fragment:1')
147 self.assert_item_exists('tube_fragment.2') 147 self.assert_item_exists('tube_fragment:2')
148 self.assert_inventory_item('tube_fragment.0', True) 148 self.assert_inventory_item('tube_fragment:0', True)
149 self.assert_inventory_item('tube_fragment.1', True) 149 self.assert_inventory_item('tube_fragment:1', True)
150 self.assert_inventory_item('tube_fragment.2', True) 150 self.assert_inventory_item('tube_fragment:2', True)
151 151
152 def test_pipes_chopped_machete(self): 152 def test_pipes_chopped_machete(self):
153 "Touch the chopped cryopipes with the machete. No change." 153 "Touch the chopped cryopipes with the machete. No change."
154 154
155 self.state.add_inventory_item('machete') 155 self.state.add_inventory_item('machete')
156 self.set_game_data('fixed', False, 'cryo.pipe.left') 156 self.set_game_data('fixed', False, 'cryo.pipe.left')
157 self.set_game_data('fixed', False, 'cryo.pipe.right.top') 157 self.set_game_data('fixed', False, 'cryo.pipe.right.top')
158 self.set_game_data('fixed', False, 'cryo.pipe.right.bottom') 158 self.set_game_data('fixed', False, 'cryo.pipe.right.bottom')
159 159
160 self.assertEquals( 160 self.assertEquals(
161 None, self.interact_thing('cryo.pipe.left', 'machete')) 161 None, self.interact_thing('cryo.pipe.left', 'machete:'))
162 self.assertEquals( 162 self.assertEquals(
163 None, self.interact_thing('cryo.pipe.right.top', 'machete')) 163 None, self.interact_thing('cryo.pipe.right.top', 'machete:'))
164 self.assertEquals( 164 self.assertEquals(
165 None, self.interact_thing('cryo.pipe.right.bottom', 'machete')) 165 None, self.interact_thing('cryo.pipe.right.bottom', 'machete:'))
166 166
167 self.assert_game_data('fixed', False, 'cryo.pipe.left') 167 self.assert_game_data('fixed', False, 'cryo.pipe.left')
168 self.assert_game_data('fixed', False, 'cryo.pipe.right.top') 168 self.assert_game_data('fixed', False, 'cryo.pipe.right.top')
169 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom') 169 self.assert_game_data('fixed', False, 'cryo.pipe.right.bottom')