def meleeroll(): #Will do a basic WeaponSkill roll for the selected character z = random.randrange(1, 101) meleebasic = char[1] + basic_char_skill[18] sl = (meleebasic - z)/10 print(f"You rolled {z}.") if z <= (meleebasic): print(f"You Hit by {sl} SLs!") if (crittable.checkcritical(z)): print("You Crit! They suffer: ") crittable.crit() else: print(f"You Miss by {sl} SLs!") if (crittable.checkcritical(z)): print("You Crit Failed!")
async def rangedroll(ctx): await playercharacterstatus(ctx) try: await ctx.message.delete() except: logging.info("Message already deleted.") rp = random.randrange(1, 101) ro = random.randrange(1, 101) ododge = 30 pskill = 0 oskill = 0 embed = discord.Embed( colour=discord.Colour.dark_purple(), title="Please type the Ranged Skill that you would like to use.") for x in Skills: #get all the names of the skills in no_combat_skill_name_list if x.name.find("Ranged") != -1: embed.add_field(name=f"{str(x.name)}", value=f"Skill Value: {int(x.current)}") embed.add_field(name="BS", value=f"Skill Value: {int(value_field.get('BSCurrent'))}") await ctx.send(embed=embed) channel = ctx.message.channel response = await client.wait_for('message') z = response.content for x in Skills: if z == x.name: pskill = x.current break elif z == 'BS': pskill = int(value_field.get('BSCurrent')) break await clear(ctx, 1) psl = (pskill - rp) / 10 osl = (ododge - ro) / 10 time.sleep(1) embed = discord.Embed(colour=discord.Colour.dark_purple(), title=f"{z} Roll for {ctx.author.name}") embed.add_field(name="Roll", value=f"{rp}") if rp <= pskill: embed.add_field(name="Success Levels", value=f"{psl}") if crittable.checkcritical(rp): embed.add_field(name="Crit", value="You Crit!") temp_crit = crittable.crit() embed.add_field(name="Crit Location", value=temp_crit, inline=False) if temp_crit != "": embed.add_field(name="They Suffer:", value=crittable.doescritical(temp_crit), inline=False) elif rp >= pskill: embed.add_field(name="Success Levels", value=f"{psl} SLs") if crittable.checkcritical(rp): embed.add_field(name="Crit", value="You Crit Failed!") if psl >= osl and crittable.checkcritical(rp) == False: embed.add_field(name="Hit Status", value="You Hit The Opponent", inline=False) #Make sure to put opponent name in {} #^^Calculate Damage from STR/10, SL, and weapon damage vs opponent's toughness and armour.^^ elif psl <= osl and crittable.checkcritical(rp) == False: embed.add_field(name="Hit Status", value="The Opponent Dodged/Parried", inline=False) #Make sure to put opponent name in {} await ctx.send(embed=embed)
async def rangedroll(ctx): await playercharacterstatus(ctx) try: await ctx.message.delete() except: logging.info("Message already deleted.") rp = random.randrange(1, 101) ro = random.randrange(1, 101) ododge = 30 pskill = 0 oskill = 0 embed = discord.Embed(colour=discord.Colour.dark_purple(), title="Which Ranged would you like to use?") y = 0 for x in ranged_skill_name_list: #get all the names of the skills in no_combat_skill_name_list embed.add_field(name=f"{x}", value=f"[{y}]") if y <= len(ranged_skill_name_list): y = y + 1 embed.add_field(name="Pure BS", value=f"[{y}]") await ctx.send(embed=embed) channel = ctx.message.channel response = await client.wait_for('message') z = response.content try: pskill = int(skilladv_value.get(ranged_skill_name_list[int(z)])) + int( value_field.get("BSCurrent") ) #search through skilladv_value for the value that matches the no_combat_skill_name_list skill name except: pskill = int(value_field.get("BSCurrent")) psl = (pskill - rp) / 10 osl = (ododge - ro) / 10 embed = discord.Embed(colour=discord.Colour.dark_purple(), title=f"Ranged Roll for {ctx.author.name}") embed.add_field(name="Roll", value=f"{rp}") if rp <= pskill: embed.add_field(name="Success Levels", value=f"{psl}") if crittable.checkcritical(rp): embed.add_field(name="Crit", value="You Crit!") temp_crit = crittable.crit() embed.add_field(name="Crit Location", value=temp_crit, inline=False) if temp_crit != "": embed.add_field(name="They Suffer:", value=crittable.doescritical(temp_crit), inline=False) elif rp >= pskill: embed.add_field(name="Success Levels", value=f"{psl} SLs") if crittable.checkcritical(rp): embed.add_field(name="Crit", value="You Crit Failed!") if psl >= osl and crittable.checkcritical(rp) == False: embed.add_field(name="Hit Status", value="You Hit The Opponent", inline=False) #Make sure to put opponent name in {} #^^Calculate Damage from STR/10, SL, and weapon damage vs opponent's toughness and armour.^^ elif psl <= osl and crittable.checkcritical(rp) == False: embed.add_field(name="Hit Status", value="The Opponent Dodged/Parried", inline=False) #Make sure to put opponent name in {} await ctx.send(embed=embed)