data/states/battle.py (view raw)
1"""This is the state that handles battles against
2monsters"""
3import random
4import pygame as pg
5from .. import tools, battlegui, observer, setup
6from .. components import person, attack, attackitems
7from .. import constants as c
8
9
10class Battle(tools._State):
11 def __init__(self):
12 super(Battle, self).__init__()
13 self.name = 'battle'
14 self.music = setup.MUSIC['high_action']
15
16 def startup(self, current_time, game_data):
17 """Initialize state attributes"""
18 self.current_time = current_time
19 self.timer = current_time
20 self.allow_input = False
21 self.game_data = game_data
22 self.inventory = game_data['player inventory']
23 self.state = 'transition in'
24 self.next = game_data['last state']
25 self.run_away = False
26
27 self.player = self.make_player()
28 self.attack_animations = pg.sprite.Group()
29 self.sword = attackitems.Sword(self.player)
30 self.enemy_group, self.enemy_pos_list, self.enemy_list = self.make_enemies()
31 self.experience_points = self.get_experience_points()
32 self.new_gold = self.get_new_gold()
33 self.background = self.make_background()
34 self.info_box = battlegui.InfoBox(game_data,
35 self.experience_points,
36 self.new_gold)
37 self.arrow = battlegui.SelectArrow(self.enemy_pos_list,
38 self.info_box)
39 self.select_box = battlegui.SelectBox()
40 self.player_health_box = battlegui.PlayerHealth(self.select_box.rect,
41 self.game_data)
42
43 self.select_action_state_dict = self.make_selection_state_dict()
44 self.observers = [observer.Battle(self),
45 observer.MusicChange()]
46 self.player.observers.extend(self.observers)
47 self.observers.append(observer.SoundEffects())
48 self.damage_points = pg.sprite.Group()
49 self.player_actions = []
50 self.player_action_dict = self.make_player_action_dict()
51 self.player_level = self.game_data['player stats']['Level']
52 self.enemies_to_attack = []
53 self.action_selected = False
54 self.just_leveled_up = False
55 self.transition_rect = setup.SCREEN.get_rect()
56 self.transition_alpha = 255
57
58 def make_player_action_dict(self):
59 """
60 Make the dict to execute player actions.
61 """
62 action_dict = {c.PLAYER_ATTACK: self.enter_player_attack_state,
63 c.CURE_SPELL: self.cast_cure,
64 c.FIRE_SPELL: self.cast_fire_blast,
65 c.DRINK_HEALING_POTION: self.enter_drink_healing_potion_state,
66 c.DRINK_ETHER_POTION: self.enter_drink_ether_potion_state}
67
68 return action_dict
69
70 def make_enemy_level_dict(self):
71 new_dict = {c.OVERWORLD: 1,
72 c.DUNGEON: 2,
73 c.DUNGEON2: 2,
74 c.DUNGEON3: 3,
75 c.DUNGEON4: 2,
76 c.DUNGEON5: 5}
77
78 return new_dict
79
80 def set_enemy_level(self, enemy_list):
81 dungeon_level_dict = self.make_enemy_level_dict()
82
83 for enemy in enemy_list:
84 enemy.level = dungeon_level_dict[self.previous]
85
86 def get_experience_points(self):
87 """
88 Calculate experience points based on number of enemies
89 and their levels.
90 """
91 experience_total = 0
92
93 for enemy in self.enemy_list:
94 experience_total += (random.randint(5,10)*enemy.level)
95
96 return experience_total
97
98 def get_new_gold(self):
99 """
100 Calculate the gold collected at the end of the battle.
101 """
102 gold = 0
103
104 for enemy in self.enemy_list:
105 max_gold = enemy.level * 20
106 gold += (random.randint(1, max_gold))
107
108 return gold
109
110 def make_background(self):
111 """Make the blue/black background"""
112 background = pg.sprite.Sprite()
113 surface = pg.Surface(c.SCREEN_SIZE).convert()
114 surface.fill(c.BLACK_BLUE)
115 background.image = surface
116 background.rect = background.image.get_rect()
117 background_group = pg.sprite.Group(background)
118
119 return background_group
120
121 def make_enemies(self):
122 """Make the enemies for the battle. Return sprite group"""
123 pos_list = []
124
125 for column in range(3):
126 for row in range(3):
127 x = (column * 100) + 100
128 y = (row * 100) + 100
129 pos_list.append([x, y])
130
131 enemy_group = pg.sprite.Group()
132
133 if self.game_data['battle type']:
134 enemy = person.Enemy('evilwizard', 0, 0,
135 'down', 'battle resting')
136 enemy_group.add(enemy)
137 else:
138 for enemy in range(random.randint(1, 6)):
139 enemy_group.add(person.Enemy('devil', 0, 0,
140 'down', 'battle resting'))
141
142 for i, enemy in enumerate(enemy_group):
143 enemy.rect.topleft = pos_list[i]
144 enemy.image = pg.transform.scale2x(enemy.image)
145 enemy.index = i
146 enemy.level = self.make_enemy_level_dict()[self.previous]
147 enemy.health = enemy.level * 7
148
149 enemy_list = [enemy for enemy in enemy_group]
150
151 return enemy_group, pos_list[0:len(enemy_group)], enemy_list
152
153 def make_player(self):
154 """Make the sprite for the player's character"""
155 player = person.Player('left', self.game_data, 630, 220, 'battle resting', 1)
156 player.image = pg.transform.scale2x(player.image)
157 return player
158
159 def make_selection_state_dict(self):
160 """
161 Make a dictionary of states with arrow coordinates as keys.
162 """
163 pos_list = self.arrow.make_select_action_pos_list()
164 state_list = [self.enter_select_enemy_state, self.enter_select_item_state,
165 self.enter_select_magic_state, self.try_to_run_away]
166 return dict(zip(pos_list, state_list))
167
168 def update(self, surface, keys, current_time):
169 """Update the battle state"""
170 self.current_time = current_time
171 self.check_input(keys)
172 self.check_timed_events()
173 self.check_if_battle_won()
174 self.enemy_group.update(current_time)
175 self.player.update(keys, current_time)
176 self.attack_animations.update()
177 self.info_box.update()
178 self.arrow.update(keys)
179 self.sword.update(current_time)
180 self.damage_points.update()
181 self.execute_player_actions()
182
183 self.draw_battle(surface)
184
185 def check_input(self, keys):
186 """
187 Check user input to navigate GUI.
188 """
189 if self.allow_input:
190 if keys[pg.K_RETURN]:
191 self.end_battle()
192
193 elif keys[pg.K_SPACE]:
194 if self.state == c.SELECT_ACTION:
195 enter_state_function = self.select_action_state_dict[
196 self.arrow.rect.topleft]
197 enter_state_function()
198
199 elif self.state == c.SELECT_ENEMY:
200 self.player_actions.append(c.PLAYER_ATTACK)
201 self.enemies_to_attack.append(self.get_enemy_to_attack())
202 self.action_selected = True
203
204 elif self.state == c.SELECT_ITEM:
205 if self.arrow.index == (len(self.arrow.pos_list) - 1):
206 self.enter_select_action_state()
207 elif self.info_box.item_text_list[self.arrow.index][:14] == 'Healing Potion':
208 self.player_actions.append(c.DRINK_HEALING_POTION)
209 self.action_selected = True
210 elif self.info_box.item_text_list[self.arrow.index][:5] == 'Ether':
211 self.player_actions.append(c.DRINK_ETHER_POTION)
212 self.action_selected = True
213 elif self.state == c.SELECT_MAGIC:
214 if self.arrow.index == (len(self.arrow.pos_list) - 1):
215 self.enter_select_action_state()
216 elif self.info_box.magic_text_list[self.arrow.index] == 'Cure':
217 magic_points = self.game_data['player inventory']['Cure']['magic points']
218 if self.game_data['player stats']['magic']['current'] >= magic_points:
219 self.player_actions.append(c.CURE_SPELL)
220 self.action_selected = True
221 elif self.info_box.magic_text_list[self.arrow.index] == 'Fire Blast':
222 magic_points = self.game_data['player inventory']['Fire Blast']['magic points']
223 if self.game_data['player stats']['magic']['current'] >= magic_points:
224 self.player_actions.append(c.FIRE_SPELL)
225 self.action_selected = True
226
227 self.allow_input = False
228
229 if keys[pg.K_RETURN] == False and keys[pg.K_SPACE] == False:
230 self.allow_input = True
231
232 def check_timed_events(self):
233 """
234 Check if amount of time has passed for timed events.
235 """
236 timed_states = [c.PLAYER_DAMAGED,
237 c.ENEMY_DAMAGED,
238 c.ENEMY_DEAD,
239 c.DRINK_HEALING_POTION,
240 c.DRINK_ETHER_POTION]
241 long_delay = timed_states[1:]
242
243 if self.state in long_delay:
244 if (self.current_time - self.timer) > 1000:
245 if self.state == c.ENEMY_DAMAGED:
246 if self.player_actions:
247 self.player_action_dict[self.player_actions[0]]()
248 self.player_actions.pop(0)
249 else:
250 if len(self.enemy_list):
251 self.enter_enemy_attack_state()
252 else:
253 self.enter_battle_won_state()
254 elif (self.state == c.DRINK_HEALING_POTION or
255 self.state == c.CURE_SPELL or
256 self.state == c.DRINK_ETHER_POTION):
257 if self.player_actions:
258 self.player_action_dict[self.player_actions[0]]()
259 self.player_actions.pop(0)
260 else:
261 if len(self.enemy_list):
262 self.enter_enemy_attack_state()
263 else:
264 self.enter_battle_won_state()
265 self.timer = self.current_time
266
267 elif self.state == c.FIRE_SPELL or self.state == c.CURE_SPELL:
268 if (self.current_time - self.timer) > 1500:
269 if self.player_actions:
270 self.player_action_dict[self.player_actions[0]]()
271 self.player_actions.pop(0)
272 else:
273 if len(self.enemy_list):
274 self.enter_enemy_attack_state()
275 else:
276 self.enter_battle_won_state()
277 self.timer = self.current_time
278
279 elif self.state == c.RUN_AWAY:
280 if (self.current_time - self.timer) > 1500:
281 self.end_battle()
282
283 elif self.state == c.BATTLE_WON:
284 if (self.current_time - self.timer) > 1800:
285 self.enter_show_gold_state()
286
287 elif self.state == c.SHOW_GOLD:
288 if (self.current_time - self.timer) > 1800:
289 self.enter_show_experience_state()
290
291 elif self.state == c.LEVEL_UP:
292 if (self.current_time - self.timer) > 2200:
293 if self.game_data['player stats']['Level'] == 3:
294 self.enter_two_actions_per_turn_state()
295 else:
296 self.end_battle()
297
298 elif self.state == c.TWO_ACTIONS:
299 if (self.current_time - self.timer) > 3000:
300 self.end_battle()
301
302 elif self.state == c.SHOW_EXPERIENCE:
303 if (self.current_time - self.timer) > 2200:
304 player_stats = self.game_data['player stats']
305 player_stats['experience to next level'] -= self.experience_points
306 if player_stats['experience to next level'] <= 0:
307 player_stats['Level'] += 1
308 player_stats['health']['maximum'] += int(player_stats['health']['maximum']*.25)
309 player_stats['magic']['maximum'] += int(player_stats['magic']['maximum']*.20)
310 new_experience = int((player_stats['Level'] * 50) * .75)
311 player_stats['experience to next level'] = new_experience
312 self.enter_level_up_state()
313 self.just_leveled_up = True
314 else:
315 self.end_battle()
316
317 elif self.state == c.PLAYER_DAMAGED:
318 if (self.current_time - self.timer) > 600:
319 if self.enemy_index == (len(self.enemy_list) - 1):
320 if self.run_away:
321 self.enter_run_away_state()
322 else:
323 self.enter_select_action_state()
324 else:
325 self.switch_enemy()
326 self.timer = self.current_time
327
328 def check_if_battle_won(self):
329 """
330 Check if state is SELECT_ACTION and there are no enemies left.
331 """
332 if self.state == c.SELECT_ACTION:
333 if len(self.enemy_group) == 0:
334 self.enter_battle_won_state()
335
336 def notify(self, event):
337 """
338 Notify observer of event.
339 """
340 for new_observer in self.observers:
341 new_observer.on_notify(event)
342
343 def end_battle(self):
344 """
345 End battle and flip back to previous state.
346 """
347 if self.game_data['battle type'] == 'evilwizard':
348 self.game_data['crown quest'] = True
349 self.game_data['last state'] = self.name
350 self.game_data['battle counter'] = random.randint(50, 255)
351 self.game_data['battle type'] = None
352 self.state = 'transition out'
353
354 def attack_enemy(self, enemy_damage):
355 enemy = self.player.attacked_enemy
356 enemy.health -= enemy_damage
357 self.set_enemy_indices()
358
359 if enemy:
360 enemy.enter_knock_back_state()
361 if enemy.health <= 0:
362 self.enemy_list.pop(enemy.index)
363 enemy.state = c.FADE_DEATH
364 self.arrow.remove_pos(self.player.attacked_enemy)
365 self.enemy_index = 0
366
367 def set_enemy_indices(self):
368 for i, enemy in enumerate(self.enemy_list):
369 enemy.index = i
370
371 def draw_battle(self, surface):
372 """Draw all elements of battle state"""
373 self.background.draw(surface)
374 self.enemy_group.draw(surface)
375 self.attack_animations.draw(surface)
376 self.sword.draw(surface)
377 surface.blit(self.player.image, self.player.rect)
378 surface.blit(self.info_box.image, self.info_box.rect)
379 surface.blit(self.select_box.image, self.select_box.rect)
380 surface.blit(self.arrow.image, self.arrow.rect)
381 self.player_health_box.draw(surface)
382 self.damage_points.draw(surface)
383 self.draw_transition(surface)
384
385 def draw_transition(self, surface):
386 """
387 Fade in and out of state.
388 """
389 if self.state == 'transition in':
390
391 transition_image = pg.Surface(self.transition_rect.size)
392 transition_image.fill(c.TRANSITION_COLOR)
393 transition_image.set_alpha(self.transition_alpha)
394 surface.blit(transition_image, self.transition_rect)
395 self.transition_alpha -= c.TRANSITION_SPEED
396 if self.transition_alpha <= 0:
397 self.state = c.SELECT_ACTION
398 self.transition_alpha = 0
399
400 elif self.state == 'transition out':
401 transition_image = pg.Surface(self.transition_rect.size)
402 transition_image.fill(c.TRANSITION_COLOR)
403 transition_image.set_alpha(self.transition_alpha)
404 surface.blit(transition_image, self.transition_rect)
405 self.transition_alpha += c.TRANSITION_SPEED
406 if self.transition_alpha >= 255:
407 self.done = True
408
409 def player_damaged(self, damage):
410 self.game_data['player stats']['health']['current'] -= damage
411
412 def player_healed(self, heal, magic_points=0):
413 """
414 Add health from potion to game data.
415 """
416 health = self.game_data['player stats']['health']
417
418 health['current'] += heal
419 if health['current'] > health['maximum']:
420 health['current'] = health['maximum']
421
422 if self.state == c.DRINK_HEALING_POTION:
423 self.game_data['player inventory']['Healing Potion']['quantity'] -= 1
424 if self.game_data['player inventory']['Healing Potion']['quantity'] == 0:
425 del self.game_data['player inventory']['Healing Potion']
426 elif self.state == c.CURE_SPELL:
427 self.game_data['player stats']['magic']['current'] -= magic_points
428
429 def magic_boost(self, magic_points):
430 """
431 Add magic from ether to game data.
432 """
433 magic = self.game_data['player stats']['magic']
434 magic['current'] += magic_points
435 if magic['current'] > magic['maximum']:
436 magic['current'] = magic['maximum']
437
438 self.game_data['player inventory']['Ether Potion']['quantity'] -= 1
439 if not self.game_data['player inventory']['Ether Potion']['quantity']:
440 del self.game_data['player inventory']['Ether Potion']
441
442 def set_timer_to_current_time(self):
443 """Set the timer to the current time."""
444 self.timer = self.current_time
445
446 def cast_fire_blast(self):
447 """
448 Cast fire blast on all enemies.
449 """
450 self.notify(c.FIRE)
451 self.state = self.info_box.state = c.FIRE_SPELL
452 POWER = self.inventory['Fire Blast']['power']
453 POWER += self.game_data['player stats']['Level'] * 5
454 MAGIC_POINTS = self.inventory['Fire Blast']['magic points']
455 self.game_data['player stats']['magic']['current'] -= MAGIC_POINTS
456 for enemy in self.enemy_list:
457 DAMAGE = random.randint(POWER//2, POWER)
458 self.damage_points.add(
459 attackitems.HealthPoints(DAMAGE, enemy.rect.topright))
460 enemy.health -= DAMAGE
461 posx = enemy.rect.x - 32
462 posy = enemy.rect.y - 64
463 fire_sprite = attack.Fire(posx, posy)
464 self.attack_animations.add(fire_sprite)
465 if enemy.health <= 0:
466 enemy.kill()
467 self.arrow.remove_pos(enemy)
468 else:
469 enemy.enter_knock_back_state()
470 self.enemy_list = [enemy for enemy in self.enemy_list if enemy.health > 0]
471 self.enemy_index = 0
472 self.arrow.index = 0
473 self.arrow.state = 'invisible'
474 self.set_timer_to_current_time()
475
476 def cast_cure(self):
477 """
478 Cast cure spell on player.
479 """
480 self.state = c.CURE_SPELL
481 HEAL_AMOUNT = self.inventory['Cure']['power']
482 MAGIC_POINTS = self.inventory['Cure']['magic points']
483 self.player.healing = True
484 self.set_timer_to_current_time()
485 self.arrow.state = 'invisible'
486 self.enemy_index = 0
487 self.damage_points.add(
488 attackitems.HealthPoints(HEAL_AMOUNT, self.player.rect.topright, False))
489 self.player_healed(HEAL_AMOUNT, MAGIC_POINTS)
490 self.info_box.state = c.DRINK_HEALING_POTION
491 self.notify(c.POWERUP)
492
493 def enter_select_enemy_state(self):
494 """
495 Transition battle into the select enemy state.
496 """
497 self.state = self.arrow.state = c.SELECT_ENEMY
498 self.arrow.index = 0
499
500 def enter_select_item_state(self):
501 """
502 Transition battle into the select item state.
503 """
504 self.state = self.info_box.state = c.SELECT_ITEM
505 self.arrow.become_select_item_state()
506
507 def enter_select_magic_state(self):
508 """
509 Transition battle into the select magic state.
510 """
511 self.state = self.info_box.state = c.SELECT_MAGIC
512 self.arrow.become_select_magic_state()
513
514 def try_to_run_away(self):
515 """
516 Transition battle into the run away state.
517 """
518 self.run_away = True
519 self.arrow.state = 'invisible'
520 self.enemy_index = 0
521 self.enter_enemy_attack_state()
522
523 def enter_enemy_attack_state(self):
524 """
525 Transition battle into the Enemy attack state.
526 """
527 self.state = self.info_box.state = c.ENEMY_ATTACK
528 enemy = self.enemy_list[self.enemy_index]
529 enemy.enter_enemy_attack_state()
530
531 def enter_player_attack_state(self):
532 """
533 Transition battle into the Player attack state.
534 """
535 self.state = self.info_box.state = c.PLAYER_ATTACK
536 enemy_to_attack = self.enemies_to_attack.pop(0)
537 if enemy_to_attack in self.enemy_list:
538 self.player.enter_attack_state(enemy_to_attack)
539 else:
540 if self.enemy_list:
541 self.player.enter_attack_state(self.enemy_list[0])
542 else:
543 self.enter_battle_won_state()
544 self.arrow.state = 'invisible'
545
546 def get_enemy_to_attack(self):
547 """
548 Get enemy for player to attack by arrow position.
549 """
550 enemy_posx = self.arrow.rect.x + 60
551 enemy_posy = self.arrow.rect.y - 20
552 enemy_pos = (enemy_posx, enemy_posy)
553 enemy_to_attack = None
554
555 for enemy in self.enemy_list:
556 if enemy.rect.topleft == enemy_pos:
557 enemy_to_attack = enemy
558
559 return enemy_to_attack
560
561
562 def enter_drink_healing_potion_state(self):
563 """
564 Transition battle into the Drink Healing Potion state.
565 """
566 self.state = self.info_box.state = c.DRINK_HEALING_POTION
567 self.player.healing = True
568 self.set_timer_to_current_time()
569 self.arrow.state = 'invisible'
570 self.enemy_index = 0
571 self.damage_points.add(
572 attackitems.HealthPoints(30,
573 self.player.rect.topright,
574 False))
575 self.player_healed(30)
576 self.notify(c.POWERUP)
577
578 def enter_drink_ether_potion_state(self):
579 """
580 Transition battle into the Drink Ether Potion state.
581 """
582 self.state = self.info_box.state = c.DRINK_ETHER_POTION
583 self.player.healing = True
584 self.arrow.state = 'invisible'
585 self.enemy_index = 0
586 self.damage_points.add(
587 attackitems.HealthPoints(30,
588 self.player.rect.topright,
589 False,
590 True))
591 self.magic_boost(30)
592 self.set_timer_to_current_time()
593 self.notify(c.POWERUP)
594
595 def enter_select_action_state(self):
596 """
597 Transition battle into the select action state
598 """
599 self.state = self.info_box.state = c.SELECT_ACTION
600 self.arrow.index = 0
601 self.arrow.state = self.state
602
603 def enter_player_damaged_state(self):
604 """
605 Transition battle into the player damaged state.
606 """
607 self.state = self.info_box.state = c.PLAYER_DAMAGED
608 if self.enemy_index > len(self.enemy_list) - 1:
609 self.enemy_index = 0
610 enemy = self.enemy_list[self.enemy_index]
611 player_damage = enemy.calculate_hit(self.inventory['equipped armor'],
612 self.inventory)
613 self.damage_points.add(
614 attackitems.HealthPoints(player_damage,
615 self.player.rect.topright))
616 self.info_box.set_player_damage(player_damage)
617 self.set_timer_to_current_time()
618 self.player_damaged(player_damage)
619 if player_damage:
620 sfx_num = random.randint(1,3)
621 self.notify('punch{}'.format(sfx_num))
622 self.player.damaged = True
623 self.player.enter_knock_back_state()
624
625 def enter_enemy_damaged_state(self):
626 """
627 Transition battle into the enemy damaged state.
628 """
629 self.state = self.info_box.state = c.ENEMY_DAMAGED
630 enemy_damage = self.player.calculate_hit()
631 self.damage_points.add(
632 attackitems.HealthPoints(enemy_damage,
633 self.player.attacked_enemy.rect.topright))
634
635 self.info_box.set_enemy_damage(enemy_damage)
636
637 self.arrow.index = 0
638 self.attack_enemy(enemy_damage)
639 self.set_timer_to_current_time()
640
641 def switch_enemy(self):
642 """
643 Switch which enemy the player is attacking.
644 """
645 if self.enemy_index < len(self.enemy_list) - 1:
646 self.enemy_index += 1
647 self.enter_enemy_attack_state()
648
649 def enter_run_away_state(self):
650 """
651 Transition battle into the run away state.
652 """
653 self.state = self.info_box.state = c.RUN_AWAY
654 self.arrow.state = 'invisible'
655 self.player.state = c.RUN_AWAY
656 self.set_timer_to_current_time()
657
658 def enter_battle_won_state(self):
659 """
660 Transition battle into the battle won state.
661 """
662 self.notify(c.BATTLE_WON)
663 self.state = self.info_box.state = c.BATTLE_WON
664 self.player.state = c.VICTORY_DANCE
665 self.set_timer_to_current_time()
666
667 def enter_show_gold_state(self):
668 """
669 Transition battle into the show gold state.
670 """
671 self.inventory['GOLD']['quantity'] += self.new_gold
672 self.state = self.info_box.state = c.SHOW_GOLD
673 self.set_timer_to_current_time()
674
675 def enter_show_experience_state(self):
676 """
677 Transition battle into the show experience state.
678 """
679 self.state = self.info_box.state = c.SHOW_EXPERIENCE
680 self.set_timer_to_current_time()
681
682 def enter_level_up_state(self):
683 """
684 Transition battle into the LEVEL UP state.
685 """
686 self.state = self.info_box.state = c.LEVEL_UP
687 self.info_box.reset_level_up_message()
688 self.set_timer_to_current_time()
689
690 def enter_two_actions_per_turn_state(self):
691 self.state = self.info_box.state = c.TWO_ACTIONS
692 self.set_timer_to_current_time()
693
694 def execute_player_actions(self):
695 """
696 Execute the player actions.
697 """
698 if self.player_level < 3:
699 if self.player_actions:
700 enter_state = self.player_action_dict[self.player_actions[0]]
701 enter_state()
702 self.player_actions.pop(0)
703 else:
704 if len(self.player_actions) == 2:
705 enter_state = self.player_action_dict[self.player_actions[0]]
706 enter_state()
707 self.player_actions.pop(0)
708 self.action_selected = False
709 else:
710 if self.action_selected:
711 self.enter_select_action_state()
712 self.action_selected = False
713
714
715
716
717
718
719
720
721