From 8b105bf6af12114df47270c8e4579119b1c49423 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Thu, 14 Jun 2012 15:30:26 +0200 Subject: [PATCH] GoodDeceny --- historien.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/historien.py b/historien.py index c3f0ce6..18635ea 100755 --- a/historien.py +++ b/historien.py @@ -91,6 +91,9 @@ config_noscore=["[20-100]","[20-100]_"] # parce que 20-100 est nul en histoire class GoodCentury(Exception): pass +class GoodDeceny(Exception): + pass + def reussi(message,answer,auteur): if auteur in config_level3: return answer in message @@ -110,6 +113,8 @@ def reussi(message,answer,auteur): score+=config_score_mois if date[2]==realdate[2]: score+=config_score_jour + elif date[0]/10 == realdate[0]/10: + raise GoodDeceny elif date[0]/100 == realdate[0]/100: raise GoodCentury return score @@ -188,7 +193,7 @@ class Historien(ircbot.SingleServerIRCBot): log(self.serveur,channel,u"$Date$".encode("utf8"),("%s : %s"%(date, evenement)).encode("utf8")) serv.privmsg(channel,evenement.encode("utf8")) token=time.time() - # le 0 est le flag "bon siècle" n' pas encore été dit + # le 0 est le flag "bon siècle" n'a pas encore été dit self.play_status[channel]=[1,date,evenement,0,token] serv.execute_delayed(random.randrange(ttrig*3,ttrig*5),self.give_indice,(serv,channel,token)) elif ok=="refuse": @@ -584,6 +589,11 @@ class Historien(ircbot.SingleServerIRCBot): serv.privmsg(canal,"%s: C'est le bon siècle, mais pas la bonne année, cherche encore ;)"%(auteur)) self.play_status[canal][3]=1 return + except GoodDeceny: + if flag_century in [0,1]: + serv.privmsg(canal,"%s: C'est la bonne décennie, mais la bonne année, encore un effort ;)"%(auteur)) + self.play_status[canal][3]=2 + return if score_obtenu: if self.play_status[canal][0]==1: bonusmsg=u" [+bonus_mois"*(score_obtenu>config_score_annee)+u"+bonus_jour"*(score_obtenu>config_score_annee+config_score_mois)+u"]" -- 2.39.2