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,59 +490,60 @@ class Arena: ...@@ -483,59 +490,60 @@ class Arena:
483 return actions 490 return actions
484 491
485 492
486 #print Families 493 if __name__ == "__main__":
487 494 #print Families
488 p = Pankration() 495
489 print("Zones: \n\n{}".format('\n'.join(p.list_zones()))) 496 p = Pankration()
490 hunt_zone = p.list_zones()[0] 497 print("Zones: \n\n{}".format('\n'.join(p.list_zones())))
491 print("Hunting for monster in zone: {}\n".format(hunt_zone)) 498 hunt_zone = p.list_zones()[0]
492 hunt_response = p.hunt_monster(hunt_zone) 499 print("Hunting for monster in zone: {}\n".format(hunt_zone))
493 print("hunt_response") 500 hunt_response = p.hunt_monster(hunt_zone)
494 print(str(hunt_response.result)) 501 print("hunt_response")
495 time.sleep(0.5) 502 print(str(hunt_response.result))
496 if hunt_response.result == HuntResponse.SUCCESS: 503 time.sleep(0.5)
497 print(hunt_response.message) 504 if hunt_response.result == HuntResponse.SUCCESS:
498 monster = hunt_response.monster 505 print(hunt_response.message)
499 # print("The Soul Plate Shows: \n\n{}".format(monster)) 506 monster = hunt_response.monster
500 # print(monster.set_strategy(4, 3)) 507 # print("The Soul Plate Shows: \n\n{}".format(monster))
501 # print(monster.set_strategy(1, 1)) 508 # print(monster.set_strategy(4, 3))
502 # print(monster.set_strategy(1, 2)) 509 # print(monster.set_strategy(1, 1))
503 #monster.add_xp(22900) 510 # print(monster.set_strategy(1, 2))
504 # phy_damage = monster.get_physical_base_damage(100, 'melee', -15) 511 #monster.add_xp(22900)
505 # print("Phys Attack: {}".format(phy_damage)) 512 # phy_damage = monster.get_physical_base_damage(100, 'melee', -15)
506 # print(monster.get_base_defense()) 513 # print("Phys Attack: {}".format(phy_damage))
507 # monster.add_xp(22900) 514 # print(monster.get_base_defense())
508 # print(monster.get_base_defense()) 515 # monster.add_xp(22900)
509 # monster.add_xp(222900) 516 # print(monster.get_base_defense())
510 # print(monster.get_base_defense()) 517 # monster.add_xp(222900)
511 else: 518 # print(monster.get_base_defense())
512 print(hunt_response.message) 519 else:
513 520 print(hunt_response.message)
514 521
515 hunt_zone = p.list_zones()[1] 522
516 hunt_response = p.hunt_monster(hunt_zone) 523 hunt_zone = p.list_zones()[1]
517 if hunt_response.result == HuntResponse.SUCCESS: 524 hunt_response = p.hunt_monster(hunt_zone)
518 monster2 = hunt_response.monster 525 if hunt_response.result == HuntResponse.SUCCESS:
519 monster2.add_xp(16900) 526 monster2 = hunt_response.monster
520 phy_damage = monster2.attack(monster) 527 monster2.add_xp(16900)
521 print("Phys Attack: {}".format(phy_damage)) 528 phy_damage = monster2.attack(monster)
522 529 print("Phys Attack: {}".format(phy_damage))
523 530
524 531
525 532
526 battle_arena = p.start_battle(monster, monster2, "derp") 533
527 fighting = True 534 battle_arena = p.start_battle(monster, monster2, "derp")
528 while fighting: 535 fighting = True
529 actions = battle_arena.step() 536 while fighting:
530 time.sleep(2) 537 actions = battle_arena.step()
531 for action in actions: 538 time.sleep(2)
532 if isinstance(action, AttackAction): 539 for action in actions:
533 print("{} {} {} for {}.".format(action.attacker.monster_type, action.message, action.target.monster_type, action.damage)) 540 if isinstance(action, AttackAction):
534 if isinstance(action, DefeatAction): 541 print("{} {} {} for {}.".format(action.attacker.monster_type, action.message, action.target.monster_type, action.damage))
535 print("{} {}. {} gains {} xp.".format(action.target.monster_type, action.message, action.attacker.monster_type, action.xp)) 542 if isinstance(action, DefeatAction):
536 fighting = False 543 print("{} {}. {} gains {} xp.".format(action.target.monster_type, action.message, action.attacker.monster_type, action.xp))
537 break 544 fighting = False
538 print("\n{} {}% - {} {}%\n".format(monster.monster_type, monster.get_hp_percent(), monster2.monster_type, monster2.get_hp_percent())) 545 break
546 print("\n{} {}% - {} {}%\n".format(monster.monster_type, monster.get_hp_percent(), monster2.monster_type, monster2.get_hp_percent()))
539 547
540 548
541 549
......