added HW5_final with suggestion system and repo cleanup
This commit is contained in:
+7
-5
@@ -78,7 +78,7 @@ class Pokemon:
|
||||
break
|
||||
return effect
|
||||
|
||||
def _useMove(self, move, opponent):
|
||||
def _useMove(self, move, opponent, game_status = None):
|
||||
if random.random() < move['accuracy']:
|
||||
if move['category'] == 'physical':
|
||||
attack = self.ActStats['attack']
|
||||
@@ -97,17 +97,19 @@ class Pokemon:
|
||||
opponent.curr_hp -= damage
|
||||
if opponent.curr_hp < 0:
|
||||
opponent.curr_hp = 0
|
||||
#print(f"{self.name} used {move['name']} and dealt {damage} damage to {opponent.name}!")
|
||||
if not game_status == 'new_random_battle':
|
||||
print(f"{self.name} used {move['name']} and dealt {damage} damage to {opponent.name}!")
|
||||
else:
|
||||
damage = 0
|
||||
#print(f"{self.name}'s attack missed!")
|
||||
if not game_status == 'new_random_battle':
|
||||
print(f"{self.name}'s attack missed!")
|
||||
return damage
|
||||
|
||||
def useMove(self, move_name, opponent):
|
||||
def useMove(self, move_name, opponent, game_status = None):
|
||||
if move_name not in self.moves_dict:
|
||||
raise ValueError(f"{self.name} does not know the move {move_name}.")
|
||||
else:
|
||||
return self._useMove(self.moves_dict[move_name], opponent)
|
||||
return self._useMove(self.moves_dict[move_name], opponent, game_status)
|
||||
|
||||
def print_move(self,move):
|
||||
print(f"Move: {self.moves_dict[move]['name']}")
|
||||
|
||||
Reference in New Issue
Block a user