def available_actions(self): if self.enemy.is_alive(): #UNUSED CODE, KEPT FOR REFERENCE #return [actions.Flee(tile=self), actions.Attack(enemy=self.enemy)] return [actions.Flee(tile=self), actions.Attack()] else: return self.adjacent_moves()# actions.Heal() DOES NOT WORK, MUST CHANGE TO OTHER METHOD OF USER INPUT
def available_actions(self): if self.enemy.is_alive(): return [actions.Attack(enemy=self.enemy)] else: moves = self.adjacent_moves() moves.append(actions.ViewInventory()) return moves
def battle(self, player): while self.fight: self.displayBattle(self.wildPokemon) self.displayBattle(self.currentPokemon) input() util.getActions( [ actions.Run(tile=self), actions.Attack(wildPokemon=self.wildPokemon), actions.ViewInventory(), ], ["Leave battle", "Select Attacks", "View Inventory"], player, ) input() enemyAttack = self.wildPokemon.getHighestAttack() self.currentPokemon.hp -= enemyAttack.damage print(f"\n{self.wildPokemon.name} used {enemyAttack.name}!") if self.wildPokemon.hp <= 0: print(f"Enemy {self.wildPokemon.name} fainted!") self.fight = False elif self.currentPokemon.hp <= 0: print(f"oh no {self.currentPokemon.name} fainted!") player.hp = 0 self.fight = False
def avaliable_actions(self): if self.enemy.is_alive(): return [ actions.Flee(tile=self), actions.Attack(enemy=self.enemy), actions.ViewEnemy() ] else: return self.adjacent_moves()
def available_actions(self): if self.enemy.is_alive(): return [ actions.Attack(enemy=self.enemy), actions.Fortification(), actions.Overdrive() ] else: return self.go_next_stage()
def available_actions(self): if self.enemy.is_alive(): return [ actions.Flee(tile=self), actions.Attack(enemy=self.enemy), actions.DrinkRhum() ] else: return super().available_actions()
def available_actions(self): if self.ailment.is_suffering(): result = self.adjacent_moves() result.append(actions.ViewInventory()) result.append(actions.Attack(ailment=self.ailment)) return result else: result = self.adjacent_moves() result.append(actions.ViewInventory()) return result
def available_actions(self): if old_pirate.is_alive() and self.is_here and not old_pirate.is_drunk: return [ actions.Attack(enemy=old_pirate), actions.Negociate(tile=self), actions.Flee(tile=self) ] else: old_pirate.is_drunk = False return super().available_actions()
def available_actions(self): if self.enemy.is_alive(): return [actions.Flee(tile=self), actions.Attack(enemy=self.enemy), actions.Rest(), actions.Save()] else: moves = self.adjacent_moves() moves.append(actions.ViewInventory()) moves.append(actions.Rest()) moves.append(actions.RestFull()) moves.append(actions.ViewStats()) moves.append(actions.Save()) return moves
def available_actions(self): if self.enemy.is_alive(): return [ actions.Flee(tile=self), actions.Attack(enemy=self.enemy), actions.ViewInventory(), actions.CheckStats(), actions.CheckMap(), actions.Heal() ] else: return self.adjacent_moves()
def available_actions(self, player): if self.enemy.is_alive(): moves = [actions.Flee(tile=self), actions.Attack(enemy=self.enemy)] if player.has_potion(): moves.append(actions.UsePotion()) return moves else: moves = self.adjacent_moves() moves.append(actions.ViewInventory()) moves.append(actions.ViewCurrency()) if player.has_potion(): moves.append(actions.UsePotion()) return moves
def available_actions(self, player): """Returns all of the available actions in a room containing an enemy""" moves, avail_actions, descriptors = self.generic_moves(player) movements = ["west", "east", "north", "south"] if self.enemy.is_alive(): for direction in movements: if direction in moves: moves.pop(direction) moves, avail_actions = self.update(moves, avail_actions, actions.Flee(noun=player.prev_tile, enemy=self.enemy, direction=player.prev_tile)) moves, avail_actions = self.update(moves, avail_actions, actions.Flee(noun=None, enemy=self.enemy, direction=player.prev_tile)) moves, avail_actions = self.update(moves, avail_actions, actions.Flee(noun=self.enemy.name, enemy=self.enemy, direction=player.prev_tile)) moves, avail_actions = self.update(moves, avail_actions, actions.ViewOrbs()) for potion in player.available_potions(): moves, avail_actions = self.update(moves, avail_actions, actions.UsePotion(potion=potion, tile=self, enemy=self.enemy)) for orb in items.Orb.orb_types(): moves, avail_actions = self.update(moves, avail_actions, actions.Cast(orb=orb)) moves, avail_actions = self.update(moves, avail_actions, actions.Attack(enemy=self.enemy, tile=self, weapon=None)) a = actions.Attack(enemy=self.enemy, tile=self, weapon=None) noun, verbs = a.add_actions() weapons = player.available_weapons() for weapon in weapons: moves[weapon.name] = verbs return moves, avail_actions, descriptors
def available_actions(self, the_player): if self.enemy.is_alive() and self.enemy.aggro: moves = [] moves.append(actions.ViewInventory()) moves.append(actions.Use(tile=self)) moves.append(actions.Flee(tile=self)) moves.append(actions.Attack(enemy=self.enemy)) moves.append(actions.Talk(tile=self, enemy=self.enemy)) moves.append(actions.Quit()) if the_player.fsm: moves.extend(self.devcommands(the_player)) return moves elif self.enemy.is_alive() and not self.enemy.aggro: moves = self.adjacent_moves() moves.append(actions.ViewInventory()) moves.append(actions.Use(tile=self)) moves.append(actions.Quit()) moves.append(actions.Attack(enemy=self.enemy)) moves.append(actions.Talk(tile=self, enemy=self.enemy)) if the_player.fsm: moves.extend(self.devcommands(the_player)) return moves else: moves = self.adjacent_moves() moves.append(actions.ViewInventory()) moves.append(actions.Use(tile=self)) moves.append(actions.Quit()) if len(self.item) != 0: moves.append(actions.Grab(tile=self)) if the_player.fsm: moves.extend(self.devcommands(the_player)) return moves
def __init__(self, x, y): self.x = x self.y = y self.actions = { "help": [actions.Help(), self.handle_help], "move": [actions.Move(), self.handle_move], "attack": [actions.Attack(), self.handle_attack], "loot": [actions.Loot(), self.handle_loot], "examine": [actions.Examine(), self.handle_examine] } self.generator = generation.Generator() self.armor = armor.Cloth() self.weapon = weapon.Dagger() self.hp = 15 self.is_dead = False self.won = False
def available_actions(self,player): moves = self.adjacent_moves() if self.item: moves.append(actions.PickUpItem()) if self.enemy.is_alive(): moves.append(actions.Attack(enemy=self.enemy)) if player.Potion_Of_Life: moves.append(actions.Undead()) moves.append(actions.ViewInventory()) moves.append(actions.CheckHP()) moves.append(actions.EquipWep()) if player.HealingPotions > 0: moves.append(actions.Heal()) if player.beer > 0: moves.append(actions.Drink()) return moves
def get_valid_moves(self): move_list = [] move_list.append(actions.AdvanceTurn(is_sim=self.is_sim)) if self.opponent.board.get_occupied_monster_spaces() == 0: for monster in self.player.board.get_monsters(): if monster.attacked_this_turn == False: move = actions.DirectAttack(self.player, self.opponent, monster, is_sim=self.is_sim) move_list.append(move) else: for monster in self.player.board.get_monsters(): if monster.attacked_this_turn == False: for target in self.opponent.board.get_monsters(): move = actions.Attack(self.player, self.opponent, monster, target, is_sim=self.is_sim) move_list.append(move) return move_list
def availableActions(self): if self.enemy.isAlive(): return [actions.Flee(tile=self), actions.Attack(enemy=self.enemy)] else: return self.adjacentMoves()
def available_actions(self): if self.enemy.is_alive(): return [actions.Attack(enemy=self.enemy)] else: pass
def available_actions(self): if self.enemy.is_alive(): return [actions.Flee(self), actions.Attack(self.enemy)] else: return self.adjacent_moves()
def available_actions(self): """Determines the available actions when facing an enemy""" if self._enemy.is_alive(): return [actions.Flee(tile=self), actions.Attack(enemy=self._enemy)] else: return self.adjacent_moves()
def available_actions(self): # The player gets some new actions here. They can either attack or flee if self.enemy.is_alive(): return [actions.Flee(tile=self), actions.Attack(enemy=self.enemy)] else: return self.adjacent_moves()
def available_actions(self): if self.enemy.is_alive(): return [actions.Flee(), actions.Attack(enemy=self.enemy)] else: return [actions.Flee(), actions.Attack(self.revive())]
def available_actions(self): if self.enemy.is_alive(): return [actions.Flee(tile=self), actions.Attack(enemy=self.enemy)] else: moves = self.adjacent_moves() return moves
def available_actions(self): #make non-default actions available if self.enemy.is_alive(): return [actions.Flee(tile=self), actions.Attack(enemy=self.enemy)] else: return self.adjacent_moves()
def available_actions(self): if self.enemy.is_alive(): return [actions.Attack(enemy=self.enemy), actions.ViewInventory()] else: return self.adjacent_moves()