1
Fork 0
mirror of https://github.com/RYGhub/royal-mifia.git synced 2025-02-16 13:24:06 +00:00

Balanced game

This commit is contained in:
Steffo 2017-07-16 00:25:47 +02:00
parent 2d1eb8b27e
commit 69f9ea0a15
5 changed files with 20 additions and 24 deletions

View file

@ -352,10 +352,10 @@ class Game:
players = len(self.players)
while True:
players = math.floor(players / (maxmifia + 1))
if players <= 0:
if players <= maxmifia:
break
maxmifia += 1 # Sono sicuro che questo si potrebbe fare meglio
self.roleconfig["Mifioso"] = random.randint(math.ceil(unassignedplayers / maxmifia / 2), math.ceil(unassignedplayers / maxmifia))
self.roleconfig["Mifioso"] = random.randint(math.ceil(maxmifia / 2), maxmifia)
unassignedplayers -= self.roleconfig["Mifioso"]
balance += Mifioso.value * self.roleconfig["Mifioso"]
# Ruoli positivi
@ -628,7 +628,7 @@ def join(bot, update):
return
p = Player(update.message.from_user.id, update.message.from_user.username)
try:
p.message(bot, s.you_joined.format(game=game.name, adminname=game.admin.tusername))
p.message(bot, s.you_joined.format(game=game.name, adminname=game.admin.tusername if game.admin is not None else p.tusername))
except Unauthorized:
# Bot bloccato dall'utente
game.message(bot, s.error_chat_unavailable)

View file

@ -8,7 +8,7 @@ class Angelo(Role):
team = 'Good'
name = s.angel_name
powerdesc = s.angel_power_description
value = 50
value = 70
def __init__(self, player):
super().__init__(player)
@ -43,4 +43,4 @@ class Angelo(Role):
# Resetta la protezione
if self.protecting is not None:
self.protecting.protectedby = None
self.protecting = None
self.protecting = None

View file

@ -8,7 +8,7 @@ class Mamma(Role):
team = 'Good'
name = s.mom_name
powerdesc = s.mom_power_description
value = 25
value = 40
def __repr__(self) -> str:
return "<Role: Mamma>"

View file

@ -38,15 +38,11 @@ class Mifioso(Role):
# Uccidi il bersaglio se non è protetto da un Angelo.
if self.target is not None:
if self.target.protectedby is None:
if game.missingmifia and random.randrange(0, 100) < game.misschance:
# Colpo mancato
game.message(bot, s.mifia_target_missed.format(target=self.target.tusername))
else:
# Uccisione riuscita
self.target.kill(bot, self)
game.message(bot, s.mifia_target_killed.format(target=self.target.tusername,
icon=self.target.role.icon,
role=self.target.role.name))
# Uccisione riuscita
self.target.kill(bot, self)
game.message(bot, s.mifia_target_killed.format(target=self.target.tusername,
icon=self.target.role.icon,
role=self.target.role.name))
else:
# Bersaglio protetto da un angelo
game.message(bot, s.mifia_target_protected.format(target=self.target.tusername,

View file

@ -413,22 +413,22 @@ preset_advanced_selected = "Selezionato il preset *Avanzato*.\n" \
"Inoltre, ogni mifioso può uccidere una persona diversa ogni giorno...\n"
# Partita in cui i Mifiosi hanno un grande vantaggio (<-30)
balance_mifia_big = "La mifia ha un grande vantaggio in questa partita." \
"Buona fortuna, Royal Games, ne avrete bisogno!"
balance_mifia_big = "_La mifia ha un grande vantaggio in questa partita.\n" \
"Buona fortuna, Royal Games, ne avrete bisogno!_"
# Partita in cui i Royal hanno un grande vantaggio (>+30)
balance_royal_big = "La Royal Games ha un grande vantaggio in questa partita." \
"State attenti, Mifiosi!"
balance_royal_big = "_La Royal Games ha un grande vantaggio in questa partita.\n" \
"State attenti, Mifiosi!_"
# Partita in cui i Mifiosi hanno un leggero vantaggio (>-30)
balance_mifia_small = "La mifia è leggermente avvantaggiata in questa partita."
balance_mifia_small = "_La mifia è leggermente avvantaggiata in questa partita._"
# Partita in cui i Royal hanno un leggero vantaggio (<+30)
balance_royal_small = "La Royal Games è leggermente avvantaggiata in questa partita."
balance_royal_small = "_La Royal Games è leggermente avvantaggiata in questa partita._"
# Partita bilanciata (-5<x<5)
balance_perfect = "La partita è perfettamente bilanciata per entrambe le squadre, nessuno sembra avere un grosso vantaggio.\n" \
"Buona fortuna a tutti!"
balance_perfect = "_La partita sembra bilanciata per entrambe le squadre, nessuno sembra avere un grosso vantaggio.\n" \
"Buona fortuna a tutti!_"
# Preset con uno di tutti
preset_oneofall = "Round Robin"
@ -445,4 +445,4 @@ preset_selected = "Preset selezionato: {selected}"
group_name = "{phase} - Mifia {name}"
# Giorno
day = "Day {day}"
day = "Day {day}"