Browse Source

fix 2 bugs: gen_statistics called multiple times, dist_cards accepts values too large

master
JerryXiao 8 months ago
parent
commit
bb66ce364f
Signed by: Jerry <[email protected]> GPG Key ID: 9D9CE43650FF2BAA
2 changed files with 4 additions and 2 deletions
  1. +3
    -1
      cards.py
  2. +1
    -1
      mscore.py

+ 3
- 1
cards.py View File

@@ -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())


+ 1
- 1
mscore.py View File

@@ -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…
Cancel
Save