Merge pull request #11 from KW46/fix-issue-10
FIX: New rounds starting while a player has 0 hp (fixes #10)
This commit is contained in:
		
							
								
								
									
										17
									
								
								game.py
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								game.py
									
									
									
									
									
								
							@@ -118,6 +118,16 @@ try:
 | 
			
		||||
            # Weird, right? To have round_end() at the start of a round.
 | 
			
		||||
            # There will be multiple conditions where the current iteration will end.
 | 
			
		||||
            # I'm lazy, hence why it's here :-)
 | 
			
		||||
 | 
			
		||||
            if player1.health == 0:
 | 
			
		||||
                print("END! {name} has been defeated. Congratulations {name2}!".format(name=player1.name, name2=player2.name))
 | 
			
		||||
                game_running = False
 | 
			
		||||
                break
 | 
			
		||||
            elif player2.health == 0:
 | 
			
		||||
                print("END! {name} has been defeated. Congratulations {name2}!".format(name=player2.name, name2=player1.name))
 | 
			
		||||
                game_running = False
 | 
			
		||||
                break
 | 
			
		||||
 | 
			
		||||
            round_end() 
 | 
			
		||||
        
 | 
			
		||||
        print("== Round {round} ==".format(round=current_round))
 | 
			
		||||
@@ -202,13 +212,6 @@ try:
 | 
			
		||||
        slowest_caster.active_spell = spell_object_none
 | 
			
		||||
        slowest_caster.active_spell_levenshtein_distance = 0
 | 
			
		||||
 | 
			
		||||
        if player1.health == 0:
 | 
			
		||||
            print("END! {name} has been defeated. Congratulations {name2}!".format(name=player1.name, name2=player2.name))
 | 
			
		||||
            game_running = False
 | 
			
		||||
        elif player2.health == 0:
 | 
			
		||||
            print("END! {name} has been defeated. Congratulations {name2}!".format(name=player2.name, name2=player1.name))
 | 
			
		||||
            game_running = False
 | 
			
		||||
 | 
			
		||||
except KeyboardInterrupt:
 | 
			
		||||
    print()
 | 
			
		||||
    print("<!> Duel ended because both {} and {} suddenly decided to test out their apparition skill!".format(player1.name, player2.name))
 | 
			
		||||
		Reference in New Issue
	
	Block a user