989c737e by Barry

Bug fixes and lots of new adds for pankration

1 parent 2deabd3e
......@@ -87,7 +87,7 @@ class Blackjack:
self.player_hand.add_cards(self.deck.draw(1))
def dealer_draw(self):
while self.dealer_hand.get_points() <= 21 and (self.dealer_hand.get_points() < 17 or self.dealer_hand.get_points() < self.player_hand.get_points()):
while self.dealer_hand.get_points() <= 21 and (self.dealer_hand.get_points() < 17 and self.dealer_hand.get_points() < self.player_hand.get_points()):
self.dealer_hand.add_cards(self.deck.draw(1))
def is_busted(self):
......@@ -114,12 +114,12 @@ class Blackjack:
# TODO: Check for blackjack Ace + 10 pt
if self.dealer_points > 21:
return (int(self.bet * 2), 'Dealer Busts. Total Winnings {}')
elif self.player_points == self.dealer_points:
return (self.bet, 'push your bet is returned: {}')
elif self.dealer_hand.is_blackjack():
return (0, 'You lose. Total Winnings: {}')
elif self.player_points > self.dealer_points:
return (int(self.bet * 2), 'You win! Total Winnings: {}')
elif self.player_points == self.dealer_points:
return (self.bet, 'push your bet is returned: {}')
else:
return (0, 'You lose. Total Winnings: {}')
......@@ -129,8 +129,7 @@ class Blackjack:
dealers = ' '.join(self.dealer_hand.get_cards())
out_string += "Dealer's Hand: {} showing for {} points\n".format(dealers, self.dealer_hand.get_points())
else:
dealers = ' '.join(self.dealer_hand.get_cards()[1:])
out_string += "Dealer's Hand: {} showing\n".format(dealers)
out_string += "Dealer's Hand: {} showing\n".format(self.dealer_hand.get_cards()[0])
self.player_points = self.player_hand.get_points()
out_string += "Player's Hand: {} for {} points".format(' '.join(self.player_hand.get_cards()), self.player_hand.get_points())
......
No preview for this file type
......@@ -483,11 +483,13 @@ Games:
!whoplayed <gamename> - Returns a list of players who have played the game.
Minigames:
!gimmecredits - Gives you some extra credits in case you run out.
!credits - Lists your current credits.
!bet <amount> - Start a game of BlackJack.
!slots <amount> - Spin the slot machine (max 10 credit bet).
!hit - Draw a card
!stand - Show the cards
""".format(message.author.mention()))
client.send_message(message.channel, """
!balance - Lists your current credits and tickets
!buyticket - Purchases a raffle ticket for 100 credits
!raffle - Shows information about the current raffle
!ticketrank - Shows the percentage of the tickets on the system
......@@ -683,12 +685,13 @@ Stuff:
else:
ticket_count = 0
for member in members:
log(member)
ticket_count += member['tickets']
if member['discord_id'] != '78767557628133376':
log(member)
ticket_count += member['tickets']
log("Ticket Count: {}".format(ticket_count))
out_string = ""
for member in members:
if member['tickets'] > 0:
if member['tickets'] > 0 and member['discord_id'] != '78767557628133376':
percent = (float(member['tickets']) / float(ticket_count)) * 100.0
out_string += "{} - {}%\n".format(member['member_name'], int(percent))
client.send_message(message.channel, out_string)
......@@ -697,14 +700,24 @@ Stuff:
if message.content.startswith('!raffle'):
client.send_message(message.channel, """Current Raffle Item:
**1st Place**
Game: **The Witness**
Description:
*Inspired by Myst, The Witness has the player explore an open world island filled with a number of natural and man-made structures. The player progresses by solving puzzles which are based on interactions with mazes presented on panels around the island.*
**2nd Place**
2 Random Steam Keys
**3rd Place**
1 Random Steam Key
Raffle Date: **1/29/2016**
You will be contacted if you win. To win you must purchase tickets with the !buyticket command for 100 credits.
You can get extra credits by playing !slots and !bet <amount> on BlackJack.
You can get extra credits by playing !slots <amount> and !bet <amount> on BlackJack.
""")
return
if message.content.startswith('!buyticket'):
......@@ -721,13 +734,12 @@ You can get extra credits by playing !slots and !bet <amount> on BlackJack.
client.send_message(message.author, "Raffle ticket purchased. Tickets: {} Credits: {}".format(response, credits))
return
if message.content.startswith('!credits'):
if message.content.startswith('!balance'):
member = db_get_member(message.author.id)
if not member:
client.send_message(message.author, "There was a problem looking up your information.")
else:
credits = db_get_credit(member['member_id'])
client.send_message(message.author, "Credits: {}".format(credits))
client.send_message(message.author, "Credits: {}\nTickets: {}".format(member['credits'], member['tickets']))
return
if message.content.startswith('!slotsrules'):
......@@ -743,7 +755,11 @@ You can get extra credits by playing !slots and !bet <amount> on BlackJack.
:black_square_button:\tblank space
All payouts are in credits. Each pull costs 1 credit. To Play: !slots""")
All payouts are in credits. Each pull costs 1 credit.
Max Bet: 10 credits
To Play: !slots <bet>""")
return
if message.content.startswith('!slots'):
member = db_get_member(message.author.id)
......@@ -753,10 +769,13 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""")
elif type(message.channel) is not discord.channel.PrivateChannel:
client.send_message(message.author, "You must make all bets / gaming via private message.")
return
result, error_message = db_update_credit(member['member_id'], -1)
if not result:
client.send_message(message.author, error_message)
bet_amount = message.content[7:]
log("Member: {} Slots Bet: {}".format(member['member_name'], bet_amount))
if not bet_amount.isdigit() or int(bet_amount) > 10 or int(bet_amount) < 0:
client.send_message(message.author, "Please provide a bet amount up to 10 credits.")
return
result, error_message = db_update_credit(member['member_id'], -int(bet_amount))
reel1 = [':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':cherries:', ':cherries:', ':cherries:', ':spades:', ':spades:', ':spades:', ':hearts:', ':hearts:', ':diamonds:', ':bell:', ':moneybag:']
reel2 = [':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':black_square_button:', ':cherries:', ':cherries:', ':cherries:', ':spades:', ':spades:', ':spades:', ':hearts:', ':hearts:', ':diamonds:', ':bell:', ':moneybag:']
......@@ -770,9 +789,10 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""")
cherries = reels.count(":cherries:")
spades = reels.count(":spades:")
diamonds = reels.count(":diamonds:")
bells = reels.count(":bells:")
bells = reels.count(":bell:")
moneybags = reels.count(":moneybag:")
if moneybags == 3:
out_string += "JACKPOT!!"
winnings = 250
elif bells == 3 or (bells == 2 and moneybags == 1):
winnings = 20
......@@ -787,9 +807,8 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""")
elif cherries == 1:
winnings = 2
out_string = """| {} | {} | {} |\n\n""".format(val1, val2, val3)
if winnings == 250:
out_string += "You Won the JACKPOT! Total Winnings: {}".format(winnings,)
elif winnings > 0:
winnings = int(winnings * int(bet_amount))
if winnings > 0:
out_string += "You Won! Total Winnings: {}".format(winnings,)
else:
out_string += "You lose. Total Winnings: {}".format(winnings,)
......
class Jobs:
WAR = 1
MNK = 2
BLM = 3
WHM = 4
THF = 5
RDM = 6
PLD = 7
DRK = 8
BST = 9
BRD = 10
RNG = 11
SAM = 12
NIN = 13
DRG = 14
SMN = 15
BLU = 16
COR = 17
PUP = 18
DNC = 19
SCH = 20
GEO = 21
RUN = 22
PhysicalDamageTypes = {
'blunt': ['Hand-to-Hand', 'Club', 'Staff', 'Harlequin Frame', 'Stormwaker Frame', 'Sharpshot Frame'],
'slashing': ['Axe', 'Great Axe', 'Great Sword', 'Sword', 'Scythe', 'Katana', 'Great Katana', 'Valoredge Frame'],
'piercing': ['Dagger', 'Polearm', 'Archery', 'Marksmanship', 'Shuriken', 'Boomerang']
}
FeralSkills = {
'Airy Shield': {'type': 'Enhancing', 'sub_type': 'arrow shield', 'shadows': 'ignore', 'range': None, 'aoe': False, 'spell': 'arrow shield'},
'Binding Wave': {'type': 'Enfeebling', 'shadows': 'ignore', 'range': 15, 'aoe': True, 'spell': 'bind'},
'Dire Straight': {'type': 'Physical', 'shadows': 'wipe', 'range': None, 'aoe': False},
'Dismemberment': {'type': 'Piercing', 'shadows': 'absorb', 'range': None, 'aoe': False}, # causes the monster to lose a body part
'Earthshatter': {'type': 'Piercing', 'shadows': 'wipe', 'range': None, 'aoe': True},
'Eyes On Me': {'type': 'Magical', 'sub_type': 'Dark', 'mp_cost': 112, 'shadows': 'absorb', 'range': 13, 'aoe': False},
'Hypnosis': {'type': 'Enfeebling', 'sub_type': 'sleep', 'shadows': 'ignore', 'range': 'gaze', 'aoe': True},
'Magic Barrier': {'type': 'Magical', 'sub_type': 'Dark', 'mp_cost': 29, 'shadows': 'absorb', 'range': None, 'aoe': True},
'Sinker Drill': {'type': 'Physical', 'sub_type': 'Piercing', 'shadows': 'absorb', 'range': None, 'aoe': False},
}
Families = {
'acrolith': {
'base_fp': 50,
'fp_per_level': 0.1,
'max_fp': 55,
'main_job': Jobs.WAR,
'support_job': None,
'innate_feral_skills': ['Sinker Drill', 'Dire Straight', 'Dismemberment', 'Earthshatter'],
'type': 'Arcana',
'strong_vs': ['Dark'],
'charmable': False,
'aspir': False,
'drain': False
},
'ahriman': {
'base_fp': 65,
'fp_per_level': 0.3,
'max_fp': 80,
'main_job': Jobs.WAR,
'support_job': Jobs.BLM,
'innate_feral_skills': ['Binding Wave', 'Magic Barrier', 'Hypnosis', 'Eyes On Me', 'Airy Shield'],
'type': 'Demon',
'traits': ['magic defence bonus +25%'],
'charmable': False,
'aspir': True,
'drain': True
}
}
Monsters = {
'Mechanical Menace': {
'family': 'acrolith',
'zone': 'Abyssea - Uleguerand'
},
'Floating Eye': {
'family': 'ahriman',
'zone': 'Ranguemont Pass'
}
}
print Families
class Pankration:
def __init__(self, arena_name):
pass
def start_battle(self, monster1, monster2, battle_type):
pass
def get_seeking_monsters(self):
pass
def get_action():
return ""
class Monster:
def __init__(self, monster_data):
self.Family
self.level
self.main_job
self.support_job
self.FP_capacity
self.innate_feral_skills = []
self.equipped_feral_skills
self.discipline_level
self.temperament
pass
def calculate_fp_gain(self):
pass
def set_strategy(self, strategy_type):
if strategy_type not in self.monster_data['strategies']:
return False
else:
self.strategy = strategy_type
class Battle:
pass
class Arena:
pass
......