def watchmessage(self): retchat = [[], []] tempj = JobManager() mes = "" for i in range(self.player.playernum()): mes += "{}: {}\n".format( self.player.playerid[i].mention, tempj.get_job_name(self.player.playerjob[i])) mes += "山札: {}, {}".format( tempj.get_job_name(self.player.playerjob[-2]), tempj.get_job_name(self.player.playerjob[-1])) for w in self.player.watcherid: retchat[0].append(w) retchat[1] = mes return retchat
def getresult(self): humanlist, wolflist = [], [] tempj = JobManager() for i in range(self.player.playernum()): if tempj.jobs[self.player.playerjob[i]].iamteamwolf: wolflist.append(i) else: humanlist.append(i) humans, wolfs = [], [] for h in humanlist: humans.append("{}: {}\n".format( self.player.playerid[h].mention, tempj.jobs[self.player.playerjob[h]].jobname)) for w in wolflist: wolfs.append("{}: {}\n".format( self.player.playerid[w].mention, tempj.jobs[self.player.playerjob[w]].jobname)) if self.winloseflag == 0: mes = "村人チームの勝利です。\n" for h in humans: mes += ":trophy: " + h for w in wolfs: mes += ":flag_white: " + w else: mes = "人狼チームの勝利です。\n" for w in wolfs: mes += ":trophy: " + w for h in humans: mes += ":flag_white: " + h self.initiate() return mes
def getcardslist(self): retchat = "現在のカード構成は以下の通りです。\n" tempj = JobManager() for i in range(self.player.playernum() + 2): c = tempj.cards[self.player.playernum()][i] retchat += tempj.jobs[c].jobname + " " return retchat
def thief(self, author, id): self.chatflag = "dm" actorid = self.player.playerid.index(author) tempj = JobManager() if self.player.playerjob[actorid] == 2 and self.thiefflag: try: id = int(id) self.chat = "{}と役職を入れ替えました。あなたは現在{}です。".format( self.player.playerid[id].mention, tempj.get_job_name(self.player.playerjob[id])) self.thiefflag = False self.thiefid = actorid self.thieftarget = id except: self.chat = ":tired_face: 無効なコマンドです。上記よりコマンドをコピーしてご利用ください。" else: self.chat = ":thinking: あなたは怪盗ではない、もしくはすでに怪盗が完了しているようです。"
def setjob(self): self.phase = "night" self.player.shufflejob() retchat = [[], []] for i in range(self.player.playernum()): retchat[0].append(self.player.playerid[i]) retchat[1].append("{} あなたの役職は{}です。".format( retchat[0][i].mention, JobManager().get_job_name(self.player.playerjob[i]))) return retchat
def watchmessage_thief(self): retchat = [[], []] for w in self.player.watcherid: retchat[0].append(w) if self.thiefflag == True: retchat[1] = "怪盗は行動をしませんでした。" else: retchat[1] = "怪盗は{}と役職を交換し、{}になりました。".format( self.player.playerid[self.thieftarget].mention, JobManager().jobs[self.player.playerjob[self.thiefid]].jobname) return retchat
def diviner(self, author, id): self.chatflag = "dm" actorid = self.player.playerid.index(author) tempj = JobManager() if self.player.playerjob[actorid] == 1 and self.divinerflag: if id == "d": self.chat = "山札は{}と{}です。".format( tempj.get_job_name(self.player.playerjob[-2]), tempj.get_job_name(self.player.playerjob[-1])) self.divinerflag = False else: try: id = int(id) self.chat = "{}は{}です。".format( self.player.playerid[id].mention, tempj.get_job_name(self.player.playerjob[id])) self.divinerflag = False except: self.chat = ":tired_face: 無効なコマンドです。上記よりコマンドをコピーしてご利用ください。" else: self.chat = ":thinking: あなたは占い師ではない、もしくはすでに占いが完了しているようです。"
def __init__(self): self.playerid = [] self.playerjob = [] self.votetarget = [] self.watcherid = [] self.job = JobManager()
def initiate(self): self.playerid = [] self.playerjob = [] self.votetarget = [] self.watcherid = [] self.job = JobManager()