989c737e by Barry

Bug fixes and lots of new adds for pankration

1 parent 2deabd3e
...@@ -87,7 +87,7 @@ class Blackjack: ...@@ -87,7 +87,7 @@ class Blackjack:
87 self.player_hand.add_cards(self.deck.draw(1)) 87 self.player_hand.add_cards(self.deck.draw(1))
88 88
89 def dealer_draw(self): 89 def dealer_draw(self):
90 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()): 90 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()):
91 self.dealer_hand.add_cards(self.deck.draw(1)) 91 self.dealer_hand.add_cards(self.deck.draw(1))
92 92
93 def is_busted(self): 93 def is_busted(self):
...@@ -114,12 +114,12 @@ class Blackjack: ...@@ -114,12 +114,12 @@ class Blackjack:
114 # TODO: Check for blackjack Ace + 10 pt 114 # TODO: Check for blackjack Ace + 10 pt
115 if self.dealer_points > 21: 115 if self.dealer_points > 21:
116 return (int(self.bet * 2), 'Dealer Busts. Total Winnings {}') 116 return (int(self.bet * 2), 'Dealer Busts. Total Winnings {}')
117 elif self.player_points == self.dealer_points:
118 return (self.bet, 'push your bet is returned: {}')
117 elif self.dealer_hand.is_blackjack(): 119 elif self.dealer_hand.is_blackjack():
118 return (0, 'You lose. Total Winnings: {}') 120 return (0, 'You lose. Total Winnings: {}')
119 elif self.player_points > self.dealer_points: 121 elif self.player_points > self.dealer_points:
120 return (int(self.bet * 2), 'You win! Total Winnings: {}') 122 return (int(self.bet * 2), 'You win! Total Winnings: {}')
121 elif self.player_points == self.dealer_points:
122 return (self.bet, 'push your bet is returned: {}')
123 else: 123 else:
124 return (0, 'You lose. Total Winnings: {}') 124 return (0, 'You lose. Total Winnings: {}')
125 125
...@@ -129,8 +129,7 @@ class Blackjack: ...@@ -129,8 +129,7 @@ class Blackjack:
129 dealers = ' '.join(self.dealer_hand.get_cards()) 129 dealers = ' '.join(self.dealer_hand.get_cards())
130 out_string += "Dealer's Hand: {} showing for {} points\n".format(dealers, self.dealer_hand.get_points()) 130 out_string += "Dealer's Hand: {} showing for {} points\n".format(dealers, self.dealer_hand.get_points())
131 else: 131 else:
132 dealers = ' '.join(self.dealer_hand.get_cards()[1:]) 132 out_string += "Dealer's Hand: {} showing\n".format(self.dealer_hand.get_cards()[0])
133 out_string += "Dealer's Hand: {} showing\n".format(dealers)
134 133
135 self.player_points = self.player_hand.get_points() 134 self.player_points = self.player_hand.get_points()
136 out_string += "Player's Hand: {} for {} points".format(' '.join(self.player_hand.get_cards()), self.player_hand.get_points()) 135 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: ...@@ -483,11 +483,13 @@ Games:
483 !whoplayed <gamename> - Returns a list of players who have played the game. 483 !whoplayed <gamename> - Returns a list of players who have played the game.
484 Minigames: 484 Minigames:
485 !gimmecredits - Gives you some extra credits in case you run out. 485 !gimmecredits - Gives you some extra credits in case you run out.
486 !credits - Lists your current credits.
487 !bet <amount> - Start a game of BlackJack. 486 !bet <amount> - Start a game of BlackJack.
487 !slots <amount> - Spin the slot machine (max 10 credit bet).
488 !hit - Draw a card 488 !hit - Draw a card
489 !stand - Show the cards 489 !stand - Show the cards
490 490 """.format(message.author.mention()))
491 client.send_message(message.channel, """
492 !balance - Lists your current credits and tickets
491 !buyticket - Purchases a raffle ticket for 100 credits 493 !buyticket - Purchases a raffle ticket for 100 credits
492 !raffle - Shows information about the current raffle 494 !raffle - Shows information about the current raffle
493 !ticketrank - Shows the percentage of the tickets on the system 495 !ticketrank - Shows the percentage of the tickets on the system
...@@ -683,12 +685,13 @@ Stuff: ...@@ -683,12 +685,13 @@ Stuff:
683 else: 685 else:
684 ticket_count = 0 686 ticket_count = 0
685 for member in members: 687 for member in members:
688 if member['discord_id'] != '78767557628133376':
686 log(member) 689 log(member)
687 ticket_count += member['tickets'] 690 ticket_count += member['tickets']
688 log("Ticket Count: {}".format(ticket_count)) 691 log("Ticket Count: {}".format(ticket_count))
689 out_string = "" 692 out_string = ""
690 for member in members: 693 for member in members:
691 if member['tickets'] > 0: 694 if member['tickets'] > 0 and member['discord_id'] != '78767557628133376':
692 percent = (float(member['tickets']) / float(ticket_count)) * 100.0 695 percent = (float(member['tickets']) / float(ticket_count)) * 100.0
693 out_string += "{} - {}%\n".format(member['member_name'], int(percent)) 696 out_string += "{} - {}%\n".format(member['member_name'], int(percent))
694 client.send_message(message.channel, out_string) 697 client.send_message(message.channel, out_string)
...@@ -697,14 +700,24 @@ Stuff: ...@@ -697,14 +700,24 @@ Stuff:
697 if message.content.startswith('!raffle'): 700 if message.content.startswith('!raffle'):
698 client.send_message(message.channel, """Current Raffle Item: 701 client.send_message(message.channel, """Current Raffle Item:
699 702
703 **1st Place**
704
700 Game: **The Witness** 705 Game: **The Witness**
701 Description: 706 Description:
702 *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.* 707 *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.*
703 708
709 **2nd Place**
710
711 2 Random Steam Keys
712
713 **3rd Place**
714
715 1 Random Steam Key
716
704 Raffle Date: **1/29/2016** 717 Raffle Date: **1/29/2016**
705 718
706 You will be contacted if you win. To win you must purchase tickets with the !buyticket command for 100 credits. 719 You will be contacted if you win. To win you must purchase tickets with the !buyticket command for 100 credits.
707 You can get extra credits by playing !slots and !bet <amount> on BlackJack. 720 You can get extra credits by playing !slots <amount> and !bet <amount> on BlackJack.
708 """) 721 """)
709 return 722 return
710 if message.content.startswith('!buyticket'): 723 if message.content.startswith('!buyticket'):
...@@ -721,13 +734,12 @@ You can get extra credits by playing !slots and !bet <amount> on BlackJack. ...@@ -721,13 +734,12 @@ You can get extra credits by playing !slots and !bet <amount> on BlackJack.
721 client.send_message(message.author, "Raffle ticket purchased. Tickets: {} Credits: {}".format(response, credits)) 734 client.send_message(message.author, "Raffle ticket purchased. Tickets: {} Credits: {}".format(response, credits))
722 return 735 return
723 736
724 if message.content.startswith('!credits'): 737 if message.content.startswith('!balance'):
725 member = db_get_member(message.author.id) 738 member = db_get_member(message.author.id)
726 if not member: 739 if not member:
727 client.send_message(message.author, "There was a problem looking up your information.") 740 client.send_message(message.author, "There was a problem looking up your information.")
728 else: 741 else:
729 credits = db_get_credit(member['member_id']) 742 client.send_message(message.author, "Credits: {}\nTickets: {}".format(member['credits'], member['tickets']))
730 client.send_message(message.author, "Credits: {}".format(credits))
731 return 743 return
732 744
733 if message.content.startswith('!slotsrules'): 745 if message.content.startswith('!slotsrules'):
...@@ -743,7 +755,11 @@ You can get extra credits by playing !slots and !bet <amount> on BlackJack. ...@@ -743,7 +755,11 @@ You can get extra credits by playing !slots and !bet <amount> on BlackJack.
743 755
744 :black_square_button:\tblank space 756 :black_square_button:\tblank space
745 757
746 All payouts are in credits. Each pull costs 1 credit. To Play: !slots""") 758 All payouts are in credits. Each pull costs 1 credit.
759
760 Max Bet: 10 credits
761
762 To Play: !slots <bet>""")
747 return 763 return
748 if message.content.startswith('!slots'): 764 if message.content.startswith('!slots'):
749 member = db_get_member(message.author.id) 765 member = db_get_member(message.author.id)
...@@ -753,10 +769,13 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""") ...@@ -753,10 +769,13 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""")
753 elif type(message.channel) is not discord.channel.PrivateChannel: 769 elif type(message.channel) is not discord.channel.PrivateChannel:
754 client.send_message(message.author, "You must make all bets / gaming via private message.") 770 client.send_message(message.author, "You must make all bets / gaming via private message.")
755 return 771 return
756 result, error_message = db_update_credit(member['member_id'], -1) 772 bet_amount = message.content[7:]
757 if not result: 773 log("Member: {} Slots Bet: {}".format(member['member_name'], bet_amount))
758 client.send_message(message.author, error_message) 774
775 if not bet_amount.isdigit() or int(bet_amount) > 10 or int(bet_amount) < 0:
776 client.send_message(message.author, "Please provide a bet amount up to 10 credits.")
759 return 777 return
778 result, error_message = db_update_credit(member['member_id'], -int(bet_amount))
760 779
761 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:'] 780 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:']
762 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:'] 781 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""") ...@@ -770,9 +789,10 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""")
770 cherries = reels.count(":cherries:") 789 cherries = reels.count(":cherries:")
771 spades = reels.count(":spades:") 790 spades = reels.count(":spades:")
772 diamonds = reels.count(":diamonds:") 791 diamonds = reels.count(":diamonds:")
773 bells = reels.count(":bells:") 792 bells = reels.count(":bell:")
774 moneybags = reels.count(":moneybag:") 793 moneybags = reels.count(":moneybag:")
775 if moneybags == 3: 794 if moneybags == 3:
795 out_string += "JACKPOT!!"
776 winnings = 250 796 winnings = 250
777 elif bells == 3 or (bells == 2 and moneybags == 1): 797 elif bells == 3 or (bells == 2 and moneybags == 1):
778 winnings = 20 798 winnings = 20
...@@ -787,9 +807,8 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""") ...@@ -787,9 +807,8 @@ All payouts are in credits. Each pull costs 1 credit. To Play: !slots""")
787 elif cherries == 1: 807 elif cherries == 1:
788 winnings = 2 808 winnings = 2
789 out_string = """| {} | {} | {} |\n\n""".format(val1, val2, val3) 809 out_string = """| {} | {} | {} |\n\n""".format(val1, val2, val3)
790 if winnings == 250: 810 winnings = int(winnings * int(bet_amount))
791 out_string += "You Won the JACKPOT! Total Winnings: {}".format(winnings,) 811 if winnings > 0:
792 elif winnings > 0:
793 out_string += "You Won! Total Winnings: {}".format(winnings,) 812 out_string += "You Won! Total Winnings: {}".format(winnings,)
794 else: 813 else:
795 out_string += "You lose. Total Winnings: {}".format(winnings,) 814 out_string += "You lose. Total Winnings: {}".format(winnings,)
......
1 class Jobs:
2 WAR = 1
3 MNK = 2
4 BLM = 3
5 WHM = 4
6 THF = 5
7 RDM = 6
8 PLD = 7
9 DRK = 8
10 BST = 9
11 BRD = 10
12 RNG = 11
13 SAM = 12
14 NIN = 13
15 DRG = 14
16 SMN = 15
17 BLU = 16
18 COR = 17
19 PUP = 18
20 DNC = 19
21 SCH = 20
22 GEO = 21
23 RUN = 22
24
25 PhysicalDamageTypes = {
26 'blunt': ['Hand-to-Hand', 'Club', 'Staff', 'Harlequin Frame', 'Stormwaker Frame', 'Sharpshot Frame'],
27 'slashing': ['Axe', 'Great Axe', 'Great Sword', 'Sword', 'Scythe', 'Katana', 'Great Katana', 'Valoredge Frame'],
28 'piercing': ['Dagger', 'Polearm', 'Archery', 'Marksmanship', 'Shuriken', 'Boomerang']
29 }
30
31 FeralSkills = {
32 'Airy Shield': {'type': 'Enhancing', 'sub_type': 'arrow shield', 'shadows': 'ignore', 'range': None, 'aoe': False, 'spell': 'arrow shield'},
33 'Binding Wave': {'type': 'Enfeebling', 'shadows': 'ignore', 'range': 15, 'aoe': True, 'spell': 'bind'},
34 'Dire Straight': {'type': 'Physical', 'shadows': 'wipe', 'range': None, 'aoe': False},
35 'Dismemberment': {'type': 'Piercing', 'shadows': 'absorb', 'range': None, 'aoe': False}, # causes the monster to lose a body part
36 'Earthshatter': {'type': 'Piercing', 'shadows': 'wipe', 'range': None, 'aoe': True},
37 'Eyes On Me': {'type': 'Magical', 'sub_type': 'Dark', 'mp_cost': 112, 'shadows': 'absorb', 'range': 13, 'aoe': False},
38 'Hypnosis': {'type': 'Enfeebling', 'sub_type': 'sleep', 'shadows': 'ignore', 'range': 'gaze', 'aoe': True},
39 'Magic Barrier': {'type': 'Magical', 'sub_type': 'Dark', 'mp_cost': 29, 'shadows': 'absorb', 'range': None, 'aoe': True},
40 'Sinker Drill': {'type': 'Physical', 'sub_type': 'Piercing', 'shadows': 'absorb', 'range': None, 'aoe': False},
41 }
42 Families = {
43 'acrolith': {
44 'base_fp': 50,
45 'fp_per_level': 0.1,
46 'max_fp': 55,
47 'main_job': Jobs.WAR,
48 'support_job': None,
49 'innate_feral_skills': ['Sinker Drill', 'Dire Straight', 'Dismemberment', 'Earthshatter'],
50 'type': 'Arcana',
51 'strong_vs': ['Dark'],
52 'charmable': False,
53 'aspir': False,
54 'drain': False
55 },
56 'ahriman': {
57 'base_fp': 65,
58 'fp_per_level': 0.3,
59 'max_fp': 80,
60 'main_job': Jobs.WAR,
61 'support_job': Jobs.BLM,
62 'innate_feral_skills': ['Binding Wave', 'Magic Barrier', 'Hypnosis', 'Eyes On Me', 'Airy Shield'],
63 'type': 'Demon',
64 'traits': ['magic defence bonus +25%'],
65 'charmable': False,
66 'aspir': True,
67 'drain': True
68 }
69 }
70
71 Monsters = {
72 'Mechanical Menace': {
73 'family': 'acrolith',
74 'zone': 'Abyssea - Uleguerand'
75 },
76 'Floating Eye': {
77 'family': 'ahriman',
78 'zone': 'Ranguemont Pass'
79 }
80 }
81
82 print Families
83 class Pankration:
84 def __init__(self, arena_name):
85 pass
86
87 def start_battle(self, monster1, monster2, battle_type):
88 pass
89
90 def get_seeking_monsters(self):
91 pass
92
93 def get_action():
94 return ""
95
96 class Monster:
97 def __init__(self, monster_data):
98 self.Family
99 self.level
100 self.main_job
101 self.support_job
102 self.FP_capacity
103 self.innate_feral_skills = []
104 self.equipped_feral_skills
105 self.discipline_level
106 self.temperament
107 pass
108
109 def calculate_fp_gain(self):
110 pass
111
112 def set_strategy(self, strategy_type):
113 if strategy_type not in self.monster_data['strategies']:
114 return False
115 else:
116 self.strategy = strategy_type
117
118 class Battle:
119 pass
120
121 class Arena:
122 pass
123
......