Exemple #1
0
 async def retire_rpg_character(self, ctx: commands.Context):
     if not ChannelUtil.hasChannel(ctx.guild.id, ctx.channel.id,
                                   Util.ChannelType.RPG_GUILD):
         return
     if not RPGCharacterUtil.hasAdventureStared(ctx.author.id):
         await ctx.send("看起來你還沒開始你的旅程呢. 在開始前就放棄的概念?")
         return
     if StatusUtil.isResting(ctx.author, ctx.guild.id):
         await ctx.send("你正在休息. 休息的人是不會申請退休的(~~除非你在夢遊~~).")
         return
     author: RPGCharacter = RPGCharacterUtil.getRPGCharacter(ctx.author.id)
     if StatusUtil.isComa(ctx.author, ctx.guild.id):
         await ctx.send(f"你都沒有體力了! 先去休息啦!")
         return
     if author.last_attack + timedelta(hours=12) > datetime.now():
         await ctx.send(f"由於你在過去12個小時內攻擊過其他人, 所以不能退休哦")
         return
     RPGCharacterUtil.retireRPGCharacter(ctx.author.id)
     await ctx.send(f"冒險者{ctx.author.display_name}申請退休成功, 辛苦你了!")
Exemple #2
0
 def test_retireCharacter_success(self):
     member = self.database.add_member(33)
     RPGCharacterUtil.createNewRPGCharacter(member)
     RPGCharacterUtil.retireRPGCharacter(member.member_id)
     assert not RPGCharacterUtil.hasAdventureStared(member.member_id)
Exemple #3
0
 def test_retireCharacter_notAdventurer(self):
     member = self.database.add_member(33)
     assert not RPGCharacterUtil.retireRPGCharacter(member.member_id)
Exemple #4
0
 def test_retireCharacter_notExist(self):
     assert not RPGCharacterUtil.retireRPGCharacter(123)