1
Fork 0
mirror of https://github.com/RYGhub/royal-mifia.git synced 2024-11-22 22:04:18 +00:00
royal-mifia/roles/Disastro.py

45 lines
1.7 KiB
Python
Raw Normal View History

2017-07-06 16:49:06 +00:00
from .Role import Role
import strings as s
class Disastro(Role):
"""L'investigatore sbadato investiga, ma giunge a conclusioni sbagliate..."""
icon = s.detective_icon
team = 'Good'
name = s.detective_name
powerdesc = s.detective_power_description
refillpoweruses = 1
def __init__(self, player):
super().__init__(player)
self.poweruses = self.refillpoweruses
def __repr__(self) -> str:
return "<Role: Investigatore, {uses} uses left>".format(uses=self.poweruses)
def power(self, arg):
2017-07-06 16:49:06 +00:00
# Indaga sul vero ruolo di una persona, se sono ancora disponibili usi del potere.
if self.poweruses > 0:
target = self.player.game.findplayerbyusername(arg)
2017-07-06 16:49:06 +00:00
if target is not None:
self.poweruses -= 1
randomrole = self.player.game.getrandomrole()
2017-07-08 12:31:37 +00:00
while isinstance(target.role, randomrole):
2017-07-13 15:31:41 +00:00
# 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,
2017-07-06 16:49:06 +00:00
icon=randomrole.icon,
role=randomrole.name,
left=self.poweruses))
else:
self.player.message(s.error_username)
2017-07-06 16:49:06 +00:00
else:
self.player.message(s.error_no_uses)
2017-07-06 16:49:06 +00:00
def onendday(self):
2017-07-06 16:49:06 +00:00
# Ripristina il potere
self.poweruses = self.refillpoweruses
def ondeath(self):
2017-07-06 16:49:06 +00:00
self.icon = s.disaster_icon
self.name = s.disaster_name