fix 2 bugs: gen_statistics called multiple times, dist_cards accepts values too large
This commit is contained in:
parent
5f0a45583f
commit
bb66ce364f
2 changed files with 4 additions and 2 deletions
4
cards.py
4
cards.py
|
@ -53,7 +53,8 @@ def getperm(update, context):
|
|||
else:
|
||||
tuser = from_user
|
||||
tplayer = get_player(int(tuser.id))
|
||||
update.message.reply_text(f"{display_username(tuser)} 等级为 {tplayer.permission}",
|
||||
update.message.reply_text((f"{display_username(tuser)} 等级为 {tplayer.permission}\n"
|
||||
f"口袋里有 {tplayer.immunity_cards} 张免疫卡"),
|
||||
parse_mode="Markdown")
|
||||
|
||||
@run_async
|
||||
|
@ -235,6 +236,7 @@ def dist_cards(update, context):
|
|||
(cards, damount) = [int(a) for a in context.args]
|
||||
assert (cards > 0 and damount > 0)
|
||||
fplayer = get_player(int(from_user.id))
|
||||
assert fplayer.immunity_cards >= cards
|
||||
fplayer.immunity_cards -= cards
|
||||
fplayer.save()
|
||||
red_packets = context.chat_data.setdefault('red_packets', dict())
|
||||
|
|
|
@ -152,7 +152,7 @@ class Board():
|
|||
self.__open(row, col)
|
||||
|
||||
def gen_statistics(self):
|
||||
if self.__op != 0:
|
||||
if self.__3bv != 0:
|
||||
return (self.__op, self.__is, self.__3bv)
|
||||
self.__visited = np.zeros((self.height, self.width), dtype=np.int8)
|
||||
def scan_open(row, col):
|
||||
|
|
Loading…
Reference in a new issue