mirror of
https://github.com/RYGhub/royal-mifia.git
synced 2025-02-16 13:24:06 +00:00
Rework dell'Investigatore e del Carabiniere
Adesso non scoprono più ruoli con certezza ma hanno rispettivamente l'82% e il 18% di scoprire il ruolo corretto.
This commit is contained in:
parent
a8fa36e29b
commit
801e999883
3 changed files with 39 additions and 29 deletions
|
@ -1,5 +1,6 @@
|
|||
from .Role import Role
|
||||
import strings as s
|
||||
import random
|
||||
|
||||
class Disastro(Role):
|
||||
"""L'investigatore sbadato investiga, ma giunge a conclusioni sbagliate..."""
|
||||
|
@ -7,37 +8,39 @@ class Disastro(Role):
|
|||
team = 'Good'
|
||||
name = s.detective_name
|
||||
powerdesc = s.detective_power_description
|
||||
refillpoweruses = 1
|
||||
|
||||
def __init__(self, player):
|
||||
super().__init__(player)
|
||||
self.poweruses = self.refillpoweruses
|
||||
self.power_was_used = False
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "<Role: Investigatore, {uses} uses left>".format(uses=self.poweruses)
|
||||
return "<Role: Investigatore>"
|
||||
|
||||
def power(self, arg):
|
||||
# Indaga sul vero ruolo di una persona, se sono ancora disponibili usi del potere.
|
||||
if self.poweruses > 0:
|
||||
target = self.player.game.findplayerbyusername(arg)
|
||||
if target is not None:
|
||||
self.poweruses -= 1
|
||||
randomrole = self.player.game.getrandomrole()
|
||||
while isinstance(target.role, randomrole):
|
||||
# TODO: se ci fossero solo disastri in una partita cosa succederebbe?
|
||||
randomrole = self.player.game.getrandomrole()
|
||||
self.player.message(s.detective_discovery.format(target=target.tusername,
|
||||
icon=randomrole.icon,
|
||||
role=randomrole.name,
|
||||
left=self.poweruses))
|
||||
else:
|
||||
self.player.message(s.error_username)
|
||||
else:
|
||||
if self.power_was_used:
|
||||
# Non hai abbastanza cariche!
|
||||
self.player.message(s.error_no_uses)
|
||||
return
|
||||
target = self.player.game.findplayerbyusername(arg)
|
||||
if target is None:
|
||||
# Username non valido
|
||||
self.player.message(s.error_username)
|
||||
return
|
||||
# Utilizza il potere su quella persona
|
||||
self.power_was_used = True
|
||||
# Tira per investigare
|
||||
target = random.randrange(0, 25) + 1
|
||||
score = random.randrange(0, 100) + 1
|
||||
if score < target:
|
||||
role = target.role.name
|
||||
else:
|
||||
role = self.player.game.getrandomrole().name
|
||||
self.player.message(s.detective_discovery.format(target_score=100-target, target=target.tusername, icon=target.role.icon, role=role))
|
||||
|
||||
def onendday(self):
|
||||
# Ripristina il potere
|
||||
self.poweruses = self.refillpoweruses
|
||||
self.power_was_used = False
|
||||
|
||||
def ondeath(self):
|
||||
self.icon = s.disaster_icon
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from .Role import Role
|
||||
import strings as s
|
||||
import random
|
||||
|
||||
class Investigatore(Role):
|
||||
"""L'investigatore può indagare sul vero ruolo di una persona una volta al giorno."""
|
||||
|
@ -7,18 +8,17 @@ class Investigatore(Role):
|
|||
team = 'Good'
|
||||
name = s.detective_name
|
||||
powerdesc = s.detective_power_description
|
||||
refillpoweruses = 1
|
||||
|
||||
def __init__(self, player):
|
||||
super().__init__(player)
|
||||
self.poweruses = self.refillpoweruses
|
||||
self.power_was_used = False
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "<Role: Investigatore, {uses} uses left>".format(uses=self.poweruses)
|
||||
return "<Role: Investigatore>"
|
||||
|
||||
def power(self, arg):
|
||||
# Indaga sul vero ruolo di una persona, se sono ancora disponibili usi del potere.
|
||||
if self.poweruses <= 0:
|
||||
if self.power_was_used:
|
||||
# Non hai abbastanza cariche!
|
||||
self.player.message(s.error_no_uses)
|
||||
return
|
||||
|
@ -28,9 +28,16 @@ class Investigatore(Role):
|
|||
self.player.message(s.error_username)
|
||||
return
|
||||
# Utilizza il potere su quella persona
|
||||
self.poweruses -= 1
|
||||
self.player.message(s.detective_discovery.format(target=target.tusername, icon=target.role.icon, role=target.role.name, left=self.poweruses))
|
||||
self.power_was_used = True
|
||||
# Tira per investigare
|
||||
target = random.randrange(0, 25) + 1
|
||||
score = random.randrange(0, 100) + 1
|
||||
if score > target:
|
||||
role = target.role.name
|
||||
else:
|
||||
role = self.player.game.getrandomrole().name
|
||||
self.player.message(s.detective_discovery.format(target_score=100-target, target=target.tusername, icon=target.role.icon, role=role))
|
||||
|
||||
def onendday(self):
|
||||
# Ripristina il potere
|
||||
self.poweruses = self.refillpoweruses
|
||||
self.power_was_used = False
|
||||
|
|
|
@ -41,11 +41,11 @@ detective_icon = "\U0001F575"
|
|||
detective_name = "Investigatore"
|
||||
|
||||
# Investigatore: scoperta nuove informazioni
|
||||
detective_discovery = "@{target} è un *{icon} {role}*.\n" \
|
||||
"Puoi usare il tuo potere ancora *{left}* volte oggi."
|
||||
detective_discovery = "Sei sicuro al *{target_score}%* che @{target} sia un *{icon} {role}*."
|
||||
|
||||
# Investigatore: descrizione del potere
|
||||
detective_power_description = "Puoi indagare sul vero ruolo di una persona una volta al giorno.\n" \
|
||||
detective_power_description = "Puoi provare a scoprire il ruolo di una persona ogni giorno.\n" \
|
||||
"Non è garantito che l'investigazione abbia successo, ma la probabilità è piuttosto alta e ti verrà annunciata." \
|
||||
"Per indagare su qualcuno, scrivi in questa chat:\n" \
|
||||
"`/power {gamename} nomeutentebersaglio`\n"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue