9ca4643d by Barry

Added a couple commands and fixed some pankration issues.

1 parent 6b1b3f46
No preview for this file type
...@@ -27,6 +27,7 @@ import wolframalpha ...@@ -27,6 +27,7 @@ import wolframalpha
27 import sqlite3 27 import sqlite3
28 from blackjack import Blackjack 28 from blackjack import Blackjack
29 import data 29 import data
30 from pankration import Pankration, HuntResponse, Jobs
30 31
31 VERSION = 2.3 32 VERSION = 2.3
32 33
...@@ -82,6 +83,8 @@ registered_commands = {'!help': 'do_help', '!commands': 'do_help', ...@@ -82,6 +83,8 @@ registered_commands = {'!help': 'do_help', '!commands': 'do_help',
82 '!squid': 'do_squid', 83 '!squid': 'do_squid',
83 '!stars': 'do_stars', 84 '!stars': 'do_stars',
84 '!rigged': 'do_rigged', 85 '!rigged': 'do_rigged',
86 '!listzones': 'do_list_zones',
87 '!huntmonster': 'do_hunt_monster',
85 } 88 }
86 89
87 90
...@@ -1008,6 +1011,22 @@ def do_rigged(client, message_parts, message): ...@@ -1008,6 +1011,22 @@ def do_rigged(client, message_parts, message):
1008 send_message(client, message.channel, ":musical_note: {} :musical_note:".format(random.choice(lines))) 1011 send_message(client, message.channel, ":musical_note: {} :musical_note:".format(random.choice(lines)))
1009 return 1012 return
1010 1013
1014 def do_hunt_monster(client, message_parts, message):
1015 p = Pankration()
1016 hunt_response = p.hunt_monster(' '.join(message_parts))
1017 str_out = hunt_response.message
1018 if hunt_response.result == HuntResponse.SUCCESS:
1019 monster = hunt_response.monster
1020 str_out += "\n\n**Stats:**\nFamily: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}".format(monster.family_name, monster.level, Jobs().get_job_name(monster.main_job), Jobs().get_job_name(monster.support_job))
1021 send_message(client, message.channel, str_out)
1022
1023 return
1024
1025 def do_list_zones(client, message_parts, message):
1026 p = Pankration()
1027 send_message(client, message.channel, ', '.join(p.list_zones()))
1028 return
1029
1011 def start_timer(client): 1030 def start_timer(client):
1012 needs_loot = True 1031 needs_loot = True
1013 while not quitting: 1032 while not quitting:
......
...@@ -52,28 +52,32 @@ exp_table = { ...@@ -52,28 +52,32 @@ exp_table = {
52 -15: 40, 52 -15: 40,
53 } 53 }
54 class Jobs: 54 class Jobs:
55 WAR = 1 55 BLM = 1
56 MNK = 2 56 BLU = 2
57 BLM = 3 57 BRD = 3
58 WHM = 4 58 BST = 4
59 THF = 5 59 COR = 5
60 RDM = 6 60 DNC = 6
61 PLD = 7 61 DRG = 7
62 DRK = 8 62 DRK = 8
63 BST = 9 63 GEO = 9
64 BRD = 10 64 MNK = 10
65 RNG = 11 65 NIN = 11
66 SAM = 12 66 PLD = 12
67 NIN = 13 67 PUP = 13
68 DRG = 14 68 RDM = 14
69 SMN = 15 69 RNG = 15
70 BLU = 16 70 RUN = 16
71 COR = 17 71 SAM = 17
72 PUP = 18 72 SCH = 18
73 DNC = 19 73 SMN = 19
74 SCH = 20 74 THF = 20
75 GEO = 21 75 WAR = 21
76 RUN = 22 76 WHM = 22
77
78 def get_job_name(self, job):
79 members = [attr for attr in dir(Jobs()) if not callable(attr) and not attr.startswith("__") and not attr.startswith("get_job_name")]
80 return members[job-1]
77 81
78 TemperamentPosture = { 82 TemperamentPosture = {
79 4: {"name": "Very Agressive", "message": "Show no mercy!", "value": 4}, 83 4: {"name": "Very Agressive", "message": "Show no mercy!", "value": 4},
...@@ -232,10 +236,12 @@ class Pankration: ...@@ -232,10 +236,12 @@ class Pankration:
232 weapon_base_damage = monster_data['weapon_base_damage'] 236 weapon_base_damage = monster_data['weapon_base_damage']
233 print("Monster: {} Data: {}".format(monster_name, monster_data)) 237 print("Monster: {} Data: {}".format(monster_name, monster_data))
234 family_name = monster_data['family'] 238 family_name = monster_data['family']
235 level = monster_data['initial_level']
236 family = Families[family_name] 239 family = Families[family_name]
240 level = monster_data['initial_level']
237 main_job = random.choice(family['available_main_job']) 241 main_job = random.choice(family['available_main_job'])
238 support_job = random.choice(family['available_support_job']) 242 support_job = random.choice(family['available_support_job'])
243 while support_job == main_job:
244 support_job = random.choice(family['available_support_job'])
239 feral_skills = [] 245 feral_skills = []
240 skills = random.sample(family['innate_feral_skills'], 3) 246 skills = random.sample(family['innate_feral_skills'], 3)
241 if random.randint(1, 100) < SKILL_PERCENT: 247 if random.randint(1, 100) < SKILL_PERCENT:
...@@ -246,9 +252,9 @@ class Pankration: ...@@ -246,9 +252,9 @@ class Pankration:
246 feral_skills.append(skills[2]) 252 feral_skills.append(skills[2])
247 dicipline_level = 1 253 dicipline_level = 1
248 254
249 monster = Monster(monster_name, family, hp, level, weapon_base_damage, main_job, support_job, feral_skills, 255 monster = Monster(monster_name, family_name, family, hp, level, weapon_base_damage, main_job, support_job, feral_skills,
250 [], dicipline_level) 256 [], dicipline_level)
251 return HuntResponse(HuntResponse.SUCCESS, "You captured the monster!", 257 return HuntResponse(HuntResponse.SUCCESS, "You captured a *{}*!".format(monster_name),
252 monster) 258 monster)
253 else: 259 else:
254 return HuntResponse(HuntResponse.FAILURE, "You were unable to capture a monster's soul.", 260 return HuntResponse(HuntResponse.FAILURE, "You were unable to capture a monster's soul.",
...@@ -259,9 +265,10 @@ class Pankration: ...@@ -259,9 +265,10 @@ class Pankration:
259 265
260 266
261 class Monster: 267 class Monster:
262 def __init__(self, monster_type, family, hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills, 268 def __init__(self, monster_type, family_name, family, hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills,
263 equipped_feral_skills, dicipline_level): 269 equipped_feral_skills, dicipline_level):
264 self.monster_type = monster_type 270 self.monster_type = monster_type
271 self.family_name = family_name
265 self.family = family 272 self.family = family
266 self.max_hp = hp 273 self.max_hp = hp
267 self.hp = hp 274 self.hp = hp
...@@ -483,17 +490,18 @@ class Arena: ...@@ -483,17 +490,18 @@ class Arena:
483 return actions 490 return actions
484 491
485 492
486 #print Families 493 if __name__ == "__main__":
494 #print Families
487 495
488 p = Pankration() 496 p = Pankration()
489 print("Zones: \n\n{}".format('\n'.join(p.list_zones()))) 497 print("Zones: \n\n{}".format('\n'.join(p.list_zones())))
490 hunt_zone = p.list_zones()[0] 498 hunt_zone = p.list_zones()[0]
491 print("Hunting for monster in zone: {}\n".format(hunt_zone)) 499 print("Hunting for monster in zone: {}\n".format(hunt_zone))
492 hunt_response = p.hunt_monster(hunt_zone) 500 hunt_response = p.hunt_monster(hunt_zone)
493 print("hunt_response") 501 print("hunt_response")
494 print(str(hunt_response.result)) 502 print(str(hunt_response.result))
495 time.sleep(0.5) 503 time.sleep(0.5)
496 if hunt_response.result == HuntResponse.SUCCESS: 504 if hunt_response.result == HuntResponse.SUCCESS:
497 print(hunt_response.message) 505 print(hunt_response.message)
498 monster = hunt_response.monster 506 monster = hunt_response.monster
499 # print("The Soul Plate Shows: \n\n{}".format(monster)) 507 # print("The Soul Plate Shows: \n\n{}".format(monster))
...@@ -508,13 +516,13 @@ if hunt_response.result == HuntResponse.SUCCESS: ...@@ -508,13 +516,13 @@ if hunt_response.result == HuntResponse.SUCCESS:
508 # print(monster.get_base_defense()) 516 # print(monster.get_base_defense())
509 # monster.add_xp(222900) 517 # monster.add_xp(222900)
510 # print(monster.get_base_defense()) 518 # print(monster.get_base_defense())
511 else: 519 else:
512 print(hunt_response.message) 520 print(hunt_response.message)
513 521
514 522
515 hunt_zone = p.list_zones()[1] 523 hunt_zone = p.list_zones()[1]
516 hunt_response = p.hunt_monster(hunt_zone) 524 hunt_response = p.hunt_monster(hunt_zone)
517 if hunt_response.result == HuntResponse.SUCCESS: 525 if hunt_response.result == HuntResponse.SUCCESS:
518 monster2 = hunt_response.monster 526 monster2 = hunt_response.monster
519 monster2.add_xp(16900) 527 monster2.add_xp(16900)
520 phy_damage = monster2.attack(monster) 528 phy_damage = monster2.attack(monster)
...@@ -523,9 +531,9 @@ if hunt_response.result == HuntResponse.SUCCESS: ...@@ -523,9 +531,9 @@ if hunt_response.result == HuntResponse.SUCCESS:
523 531
524 532
525 533
526 battle_arena = p.start_battle(monster, monster2, "derp") 534 battle_arena = p.start_battle(monster, monster2, "derp")
527 fighting = True 535 fighting = True
528 while fighting: 536 while fighting:
529 actions = battle_arena.step() 537 actions = battle_arena.step()
530 time.sleep(2) 538 time.sleep(2)
531 for action in actions: 539 for action in actions:
......