Intro message, ask for player name, improve wand's representation (readability)
This commit is contained in:
parent
b20532ae4a
commit
7cbcf4dbf4
26
game.py
26
game.py
@ -28,4 +28,28 @@ def round_end(player1: Player, player2: Player):
|
||||
p1_name=player1.name, p1_hp=player1.health, p1_effects=player1.get_queued_effects(), p1_stunned=player1.stunned_rounds,
|
||||
p2_name=player2.name, p2_hp=player2.health, p2_effects=player2.get_queued_effects(), p2_stunned=player2.stunned_rounds
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
##
|
||||
## ENTRY
|
||||
##
|
||||
print()
|
||||
print("Welcome! You're about to perform a wizard duel!")
|
||||
print("After joining in, you have to select a wand. Your wand will affect the power of your spells. Spells have three atrributes that modify the power of spells:")
|
||||
print("1- DAMAGE: Damage can either deal damage to health points, or it can stun your a player for X amount of moves (DAMAGE below zero = amount of moves a player is stunned)")
|
||||
print("2- SUCCES CHANCE: How much succes chance of performing a spell. Some spells are difficult to pronounce and thus could fail..")
|
||||
print("3- SPEED: If both players succesfully cast a spell, the spell with the greatest speed will succeed and the other one will not")
|
||||
print()
|
||||
#GET: USERNAMES
|
||||
while True:
|
||||
player1_name = input("Player 1 - What's your name? ")
|
||||
player2_name = input("And now player 2 - What's your name? ")
|
||||
|
||||
if len(player1_name) < 2 or len(player2_name) < 2:
|
||||
print("<!> Oops! Names must be at least 2 characters long! Please try again")
|
||||
else: break
|
||||
|
||||
#GET: WANDS
|
||||
print("Welcome {p1_name} and {p2_name}! You're about to choose a wand to use in this duel! Available wands are:".format(p1_name=player1_name, p2_name=player2_name))
|
||||
for i in Wand.wandList:
|
||||
print(i)
|
9
wands.py
9
wands.py
@ -8,6 +8,7 @@ WAND_WOOD_APPLE = 2 #Damage -5%
|
||||
|
||||
class Wand:
|
||||
_next_wand_id = 1
|
||||
wandList = []
|
||||
|
||||
def __init__(self, wand_core: int, wand_wood: int):
|
||||
self.id = Wand._next_wand_id
|
||||
@ -33,13 +34,13 @@ class Wand:
|
||||
elif self.wood == WAND_WOOD_APPLE:
|
||||
self.damage *= 0.95
|
||||
|
||||
Wand.wandList.append(self)
|
||||
Wand._next_wand_id += 1
|
||||
|
||||
def __repr__(self):
|
||||
succes_rate = round(self.succes_rate * 100, 3)
|
||||
speed = round(self.speed * 100, 3)
|
||||
damage = round(self.dmg * 100, 3)
|
||||
return "Modifiers: SUCCES RATE: {srate}%\tSPEED: {speed}\tDAMAGE: {dmg}".format(srate=succes_rate, speed=speed, dmg=damage)
|
||||
return"\t{id}: {wood} wand with core: {core}\n\t\t-- SPEED: {info_speed}\tDAMAGE: {info_dmg}\tSUCCES RATE: {info_srate}".format(
|
||||
id=self.id, wood=self.get_wand_wood(), core=self.get_wand_core(), info_srate=round(self.succes_rate, 2), info_speed=self.speed, info_dmg=self.damage
|
||||
)
|
||||
|
||||
def get_wand_core(self):
|
||||
if self.core == WAND_CORE_UNICORN: return "Unicorn hair"
|
||||
|
Loading…
x
Reference in New Issue
Block a user