🧹 Cleaned up starwars funcs
This commit is contained in:
@ -239,7 +239,7 @@ class StarWarsRoll():
|
||||
return random.choice(table)
|
||||
|
||||
# Rolls for critical injury
|
||||
def critRoll(self, addington : int):
|
||||
async def critRoll(self, ctx, addington : int):
|
||||
dd = "<:difficulty:690973992470708296>"
|
||||
sd = "<:setback:690972157890658415>"
|
||||
bd = "<:boost:690972178216386561>"
|
||||
@ -253,14 +253,14 @@ class StarWarsRoll():
|
||||
"**Discouraging Wound**: Flip one light side Destiny point to a dark side Destiny point (reverse if NPC), "+dd] * 5 + [
|
||||
"**Stunned**: The target is staggered until the end of his next turn, "+dd] * 5 + [
|
||||
"**Stinger**: Increase the difficulty of next check by one, "+dd] * 5 + [
|
||||
"**Bowled Over**: The target is knocked prone and suffers 1 sttrain, "+dd+dd] * 5 + [
|
||||
"**Bowled Over**: The target is knocked prone and suffers 1 strain, "+dd+dd] * 5 + [
|
||||
"**Head Ringer**: The target increases the difficulty of all Intellect and Cunning checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||
"**Fearsome Wound**: The target increases the difficulty of all Presence and Willpower checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||
"**Agonizing Wound**: The target increases the difficulty of all Brawn and Agility checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||
"**Slightly Dazed**: The target is disoriented until the end of the encounter, "+dd+dd] * 5 + [
|
||||
"**Scattered Senses**: The target removes all "+bd+" from skill checks until the end of the encounter, "+dd+dd] * 5 + [
|
||||
"**Hamstrung**: The target loses his free maneuver until the end of the encounter, "+dd+dd] * 5 + [
|
||||
"**Overpowered**: The target leaves himselp open, and the attacker may immediately attempt another free attack agains him, using the exact same pool as the original, "+dd+dd] * 5 + [
|
||||
"**Overpowered**: The target leaves himself open, and the attacker may immediately attempt another free attack agains him, using the exact same pool as the original, "+dd+dd] * 5 + [
|
||||
"**Winded**: Until the end of the encounter, the target cannot voluntarily suffer strain to activate any abilities or gain additional maneuvers, "+dd+dd] * 5 + [
|
||||
"**Compromised**: Incerase difficulty of all skill checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||
"**At the brink**: The target suffers 1 strain each time he performs an action, "+dd+dd+dd] * 5 + [
|
||||
@ -288,56 +288,64 @@ class StarWarsRoll():
|
||||
characteristic = random.choice(["brawn"] * 3 + ["agility"] * 3 + ["intellect", "cunning", "presence"])
|
||||
results = "**Gruesome Injury**: The target's "+characteristic+" is permanently one lower, "+dd+dd+dd+dd
|
||||
|
||||
return "Roll: "+str(roll)+"\nInjury:\n"+results
|
||||
sendMessage = "Roll: "+str(roll)+"\nInjury:\n"+results
|
||||
|
||||
messageList = sendMessage.split("\n")
|
||||
await ctx.send(messageList[0])
|
||||
if len(messageList) > 1:
|
||||
for messageItem in messageList[1:]:
|
||||
await ctx.channel.send(messageItem)
|
||||
|
||||
# Parses the command into something the other functions understand
|
||||
def parseRoll(self, user : str,cmd : str = ""):
|
||||
async def parseRoll(self, ctx, cmd : str = ""):
|
||||
user = f"#{ctx.author.id}"
|
||||
cmd = re.sub(' +',' ',cmd.upper()) + " "
|
||||
if cmd[0] == " ":
|
||||
cmd = cmd[1:]
|
||||
cmd = self.bot.starwarschar.replaceSpaces(string.capwords(cmd))
|
||||
cmd = self.bot.starWars.character.replaceSpaces(string.capwords(cmd))
|
||||
commands = cmd.split(" ")
|
||||
validCommand = False
|
||||
|
||||
if commands[0] == "":
|
||||
rollParameters = [1,0,3,0,0,0,0]
|
||||
else:
|
||||
rollParameters = [0,0,0,0,0,0,0]
|
||||
|
||||
if string.capwords(commands[0]) == "Obligations":
|
||||
try:
|
||||
return self.obligationRoll()
|
||||
except:
|
||||
self.bot.log("Obligation fucked up (error code 911)")
|
||||
return "An error ocurred (error code 911)"
|
||||
sendMessage = self.obligationRoll()
|
||||
|
||||
elif string.capwords(commands[0]) in skillData:
|
||||
self.bot.log("Oh look! This guy has skills!")
|
||||
if self.bot.starwarschar.userHasChar:
|
||||
if self.bot.starWars.character.userHasChar(user):
|
||||
self.bot.log("They have a character. That much we know")
|
||||
skillLevel = self.bot.starwarschar.charData(user,"Skills " + string.capwords(commands[0]))
|
||||
skillLevel = self.bot.starWars.character.charData(user,"Skills " + string.capwords(commands[0]))
|
||||
|
||||
if string.capwords(commands[0]) == "Lightsaber":
|
||||
self.bot.log("The skill is lightsaber")
|
||||
charLevel = self.bot.starwarschar.charData(user,"Characteristics " + self.bot.starwarschar.lightsaberChar(user))
|
||||
charLevel = self.bot.starWars.character.charData(user,"Characteristics " + self.bot.starWars.character.lightsaberChar(user))
|
||||
else:
|
||||
charLevel = self.bot.starwarschar.charData(user,"Characteristics " + skillData[string.capwords(commands[0])])
|
||||
charLevel = self.bot.starWars.character.charData(user,"Characteristics " + skillData[string.capwords(commands[0])])
|
||||
|
||||
abilityDice = abs(charLevel-skillLevel)
|
||||
proficiencyDice = min(skillLevel,charLevel)
|
||||
|
||||
commands = [str(abilityDice)] + [str(proficiencyDice)] + commands[1:]
|
||||
self.bot.log("Converted skill to dice")
|
||||
validCommand = True
|
||||
else:
|
||||
self.bot.log("Okay, no they don't i guess (error code 912)")
|
||||
return "You don't have a user. You can make one with /starwarscharacter (error code 912)"
|
||||
self.bot.log("Okay, no they don't i guess")
|
||||
sendMessage = "You don't have a user. You can make one with /starwarscharacter"
|
||||
|
||||
elif string.capwords(commands[0]) in ["Ranged","Piloting"]:
|
||||
self.bot.log("They fucked up writing the name of a ranged or piloting skill")
|
||||
if string.capwords(commands[0]) == "Ranged":
|
||||
return "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\" (error code 913)"
|
||||
sendMessage = "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\" (error code 913)"
|
||||
else:
|
||||
return "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\" (error code 913)"
|
||||
sendMessage = "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\" (error code 913)"
|
||||
else:
|
||||
validCommand = True
|
||||
|
||||
try:
|
||||
if validCommand:
|
||||
self.bot.log("Converting commands to dice")
|
||||
for x, command in enumerate(commands):
|
||||
if command != "":
|
||||
@ -358,21 +366,26 @@ class StarWarsRoll():
|
||||
rollParameters[6] = int(command.replace("F",""))
|
||||
else:
|
||||
rollParameters[x] = int(command)
|
||||
except:
|
||||
self.bot.log("Someone fucked u-up! (it was them) (error code 914)")
|
||||
return "Invalid input! (error code 914)"
|
||||
|
||||
self.bot.log("Rolling "+str(rollParameters))
|
||||
rollResults, diceResults = self.roll(rollParameters[0],rollParameters[1],rollParameters[2],rollParameters[3],rollParameters[4],rollParameters[5],rollParameters[6])
|
||||
self.bot.log("Rolling "+str(rollParameters))
|
||||
rollResults, diceResults = self.roll(rollParameters[0],rollParameters[1],rollParameters[2],rollParameters[3],rollParameters[4],rollParameters[5],rollParameters[6])
|
||||
|
||||
simplified = self.simplify(rollResults)
|
||||
simplified = self.simplify(rollResults)
|
||||
|
||||
name = self.bot.starwarschar.getCharName(user)
|
||||
name = self.bot.starWars.character.getCharName(user)
|
||||
|
||||
self.bot.log("Returns results and simplified results")
|
||||
self.bot.log("Returns results and simplified results")
|
||||
|
||||
if simplified == "":
|
||||
return name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\nEverything cancels out!"
|
||||
else:
|
||||
return name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\n" + self.resultToEmoji(simplified)
|
||||
if simplified == "":
|
||||
sendMessage = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\nEverything cancels out!"
|
||||
else:
|
||||
sendMessage = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\n" + self.resultToEmoji(simplified)
|
||||
|
||||
messageList = sendMessage.split("\n")
|
||||
await ctx.send(messageList[0])
|
||||
if len(messageList) > 1:
|
||||
for messageItem in messageList[1:]:
|
||||
if messageItem == "":
|
||||
self.bot.log("Tried to send empty message")
|
||||
else:
|
||||
await ctx.channel.send(messageItem)
|
||||
|
Reference in New Issue
Block a user