Add decreased_spell_speed/damage to Player class and cast_spell_result()- used to print outcome message of a spell cast
This commit is contained in:
		
							
								
								
									
										16
									
								
								player.py
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								player.py
									
									
									
									
									
								
							| @@ -10,6 +10,9 @@ class Player: | |||||||
|         self.wand = wand |         self.wand = wand | ||||||
|  |  | ||||||
|         self.stunned_rounds = 0 |         self.stunned_rounds = 0 | ||||||
|  |         self.decreased_spell_speed = False | ||||||
|  |         self.decreased_spell_damage = False | ||||||
|  |  | ||||||
|         self.lumos = False |         self.lumos = False | ||||||
|  |  | ||||||
|     def give_health(self, health: int): |     def give_health(self, health: int): | ||||||
| @@ -25,4 +28,15 @@ class Player: | |||||||
|         return self.health |         return self.health | ||||||
|      |      | ||||||
|     def get_spell_succes_rate(self, spell: Spell): |     def get_spell_succes_rate(self, spell: Spell): | ||||||
|         return 1 * self.wand.succes_rate * spell.succes_rate |         return 1 * self.wand.succes_rate * spell.succes_rate | ||||||
|  |      | ||||||
|  |     def cast_spell_result(self, spell: Spell, succes: bool): | ||||||
|  |         if (succes): | ||||||
|  |             message = "{name} casted '{spell}' with succes" | ||||||
|  |         else: | ||||||
|  |             if (spell.type == SPELL_TYPE_UNFORGIVABLE): | ||||||
|  |                 message = "{name} tried to cast '{spell}' but didn't truly mean it. Cast FAILED!" | ||||||
|  |             elif (spell.type == SPELL_TYPE_USELESS): | ||||||
|  |                 return "{name} must not be feeling well, since they casted a non existing spell. Cast FAILED!".format(name=self.name) | ||||||
|  |             else: message = "{name} tried to cast '{spell}' but mispronounced it. Cast FAILED!" | ||||||
|  |         return message.format(name=self.name, spell=spell.name) | ||||||
		Reference in New Issue
	
	Block a user