91bd9972 by Barry

Fix for msg to handle days

Updates to pankration adding acc, dex
1 parent 9ca4643d
No preview for this file type
...@@ -839,6 +839,9 @@ def do_msg(client, message_parts, message): ...@@ -839,6 +839,9 @@ def do_msg(client, message_parts, message):
839 elif message_bits[4].startswith('hour'): 839 elif message_bits[4].startswith('hour'):
840 msg_datetime = msg_datetime + datetime.timedelta(hours=time) 840 msg_datetime = msg_datetime + datetime.timedelta(hours=time)
841 msg_idx = 5 841 msg_idx = 5
842 elif message_bits[4].startswith('day'):
843 msg_datetime = msg_datetime + datetime.timedelta(days=time)
844 msg_idx = 5
842 else: # minutes by default 845 else: # minutes by default
843 msg_datetime = msg_datetime + datetime.timedelta(minutes=time) 846 msg_datetime = msg_datetime + datetime.timedelta(minutes=time)
844 msg_idx = 5 847 msg_idx = 5
...@@ -1014,10 +1017,10 @@ def do_rigged(client, message_parts, message): ...@@ -1014,10 +1017,10 @@ def do_rigged(client, message_parts, message):
1014 def do_hunt_monster(client, message_parts, message): 1017 def do_hunt_monster(client, message_parts, message):
1015 p = Pankration() 1018 p = Pankration()
1016 hunt_response = p.hunt_monster(' '.join(message_parts)) 1019 hunt_response = p.hunt_monster(' '.join(message_parts))
1017 str_out = hunt_response.message 1020 str_out = hunt_response.message + "\n\n"
1018 if hunt_response.result == HuntResponse.SUCCESS: 1021 if hunt_response.result == HuntResponse.SUCCESS:
1019 monster = hunt_response.monster 1022 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)) 1023 str_out += str(monster)
1021 send_message(client, message.channel, str_out) 1024 send_message(client, message.channel, str_out)
1022 1025
1023 return 1026 return
......
...@@ -49,7 +49,7 @@ exp_table = { ...@@ -49,7 +49,7 @@ exp_table = {
49 -12: 40, 49 -12: 40,
50 -13: 40, 50 -13: 40,
51 -14: 40, 51 -14: 40,
52 -15: 40, 52 -15: 20,
53 } 53 }
54 class Jobs: 54 class Jobs:
55 BLM = 1 55 BLM = 1
...@@ -129,6 +129,8 @@ Families = { ...@@ -129,6 +129,8 @@ Families = {
129 'str_per_level': 0.8934, 129 'str_per_level': 0.8934,
130 'base_agi': 7, 130 'base_agi': 7,
131 'agi_per_level': 0.76, 131 'agi_per_level': 0.76,
132 'base_dex': 10,
133 'dex_per_level': 0.76,
132 'temperament_attitude': { 134 'temperament_attitude': {
133 'initial_value': 4, 135 'initial_value': 4,
134 'actions': { 136 'actions': {
...@@ -166,6 +168,8 @@ Families = { ...@@ -166,6 +168,8 @@ Families = {
166 'str_per_level': 0.8534, 168 'str_per_level': 0.8534,
167 'base_agi': 9, 169 'base_agi': 9,
168 'agi_per_level': 0.88, 170 'agi_per_level': 0.88,
171 'base_dex': 10,
172 'dex_per_level': 0.714,
169 'temperament_attitude': { 173 'temperament_attitude': {
170 'initial_value': 4, 174 'initial_value': 4,
171 'actions': { 175 'actions': {
...@@ -192,15 +196,15 @@ Monsters = { ...@@ -192,15 +196,15 @@ Monsters = {
192 'initial_level': 9, 196 'initial_level': 9,
193 'family': 'acrolith', 197 'family': 'acrolith',
194 'zone': 'Abyssea - Uleguerand', 198 'zone': 'Abyssea - Uleguerand',
195 'hp': 1000, 199 'hp': 20,
196 'weapon_base_damage': 40 200 'weapon_base_damage': 14
197 }, 201 },
198 'Floating Eye': { 202 'Floating Eye': {
199 'initial_level': 3, 203 'initial_level': 10,
200 'family': 'ahriman', 204 'family': 'ahriman',
201 'zone': 'Ranguemont Pass', 205 'zone': 'Ranguemont Pass',
202 'hp': 1000, 206 'hp': 15,
203 'weapon_base_damage': 120 207 'weapon_base_damage': 15
204 } 208 }
205 } 209 }
206 210
...@@ -265,13 +269,12 @@ class Pankration: ...@@ -265,13 +269,12 @@ class Pankration:
265 269
266 270
267 class Monster: 271 class Monster:
268 def __init__(self, monster_type, family_name, family, hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills, 272 def __init__(self, monster_type, family_name, family, base_hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills,
269 equipped_feral_skills, dicipline_level): 273 equipped_feral_skills, dicipline_level):
270 self.monster_type = monster_type 274 self.monster_type = monster_type
271 self.family_name = family_name 275 self.family_name = family_name
272 self.family = family 276 self.family = family
273 self.max_hp = hp 277 self.base_hp = base_hp
274 self.hp = hp
275 self.level = level 278 self.level = level
276 self.main_job = main_job 279 self.main_job = main_job
277 self.support_job = support_job 280 self.support_job = support_job
...@@ -291,12 +294,20 @@ class Monster: ...@@ -291,12 +294,20 @@ class Monster:
291 self.str_per_level = family['str_per_level'] 294 self.str_per_level = family['str_per_level']
292 self.base_agi = family['base_agi'] 295 self.base_agi = family['base_agi']
293 self.agi_per_level = family['agi_per_level'] 296 self.agi_per_level = family['agi_per_level']
297 self.base_dex = family['base_dex']
298 self.dex_per_level = family['dex_per_level']
299 self.hp = self.get_hp()
294 300
295 def __str__(self): 301 def __str__(self):
296 return "Family: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nDicipline Level: {}\nTemperament...".format(self.family, self.level, self.main_job, self.support_job, self.innate_feral_skills, self.equipped_feral_skills, self.discipline_level) 302 return "**Stats:**\nFamily: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nFeral Points: {}".format(self.family_name, self.level, Jobs().get_job_name(self.main_job), Jobs().get_job_name(self.support_job), ', '.join(self.innate_feral_skills), ', '.join(self.equipped_feral_skills), self.get_fp())
303 #return "Family: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nDicipline Level: {}\nTemperament...".format(self.family, self.level, self.main_job, self.support_job, self.innate_feral_skills, self.equipped_feral_skills, self.discipline_level)
304
305 def get_hp(self):
306 #this is a bit dumb but it's close enough.
307 return int((self.level * 20) + self.base_hp)
297 308
298 def get_fp(self): 309 def get_fp(self):
299 return int(self.level / self.family['fp_per_level']) 310 return int(self.level / self.family['fp_per_level'] + self.family['base_fp'])
300 311
301 def add_xp(self, exp_to_add): 312 def add_xp(self, exp_to_add):
302 self.exp += exp_to_add 313 self.exp += exp_to_add
...@@ -307,12 +318,7 @@ class Monster: ...@@ -307,12 +318,7 @@ class Monster:
307 self.level = i 318 self.level = i
308 #print("Start level: {} New Level: {}".format(self.level, i)) 319 #print("Start level: {} New Level: {}".format(self.level, i))
309 else: 320 else:
310 pass#print("Just another brick in the wall...")
311 else:
312 break 321 break
313 # calc level based on xp
314 # stop at 50
315 pass
316 322
317 def get_current_posture(self): 323 def get_current_posture(self):
318 return TemperamentPosture(self.temperament_posture) 324 return TemperamentPosture(self.temperament_posture)
...@@ -330,6 +336,12 @@ class Monster: ...@@ -330,6 +336,12 @@ class Monster:
330 else: 336 else:
331 return "Obedient" 337 return "Obedient"
332 338
339 def get_dexterity(self):
340 return int(round(max(self.base_dex, self.level * self.dex_per_level)))
341
342 def get_accuracy(self):
343 return int(math.floor(3*self.get_dexterity()/4) + 100)
344
333 def get_vitality(self): 345 def get_vitality(self):
334 return int(round(max(self.base_vit, self.level * self.vit_per_level))) 346 return int(round(max(self.base_vit, self.level * self.vit_per_level)))
335 347
...@@ -343,17 +355,18 @@ class Monster: ...@@ -343,17 +355,18 @@ class Monster:
343 return (math.floor(self.get_vitality()/2) + 8 + self.level) 355 return (math.floor(self.get_vitality()/2) + 8 + self.level)
344 356
345 def get_hp_percent(self): 357 def get_hp_percent(self):
346 return max(0, int(round((self.hp/self.max_hp)*100))) 358 print(self.hp)
359 return max(0, int(round((self.hp/self.get_hp())*100)))
347 360
348 # Calculate the base damage against the provided defense 361 # Calculate the base damage against the provided defense
349 # attack_type can be 'ranged' or 'melee' 362 # attack_type can be 'ranged' or 'melee'
350 def get_physical_base_damage(self, defense, attack_type, level_difference): 363 def get_physical_base_damage(self, defense, attack_type, level_difference, enemy_vit):
351 #print("Defense: {} Type: {} Level diff: {}".format(defense, attack_type, level_difference)) 364 #print("Defense: {} Type: {} Level diff: {}".format(defense, attack_type, level_difference))
352 # Calculate the attack/defense ratio 365 # Calculate the attack/defense ratio
353 bd = float(self.weapon_base_damage) 366 bd = float(self.weapon_base_damage)
354 if attack_type == 'ranged': 367 if attack_type == 'ranged':
355 bd += self.ammo_damage 368 bd += self.ammo_damage
356 # NOTE: We are not using fStr1 or fStr2 since we are not keeping str / vit as data 369
357 if defense == 0: 370 if defense == 0:
358 ratio = 99 371 ratio = 99
359 else: 372 else:
...@@ -398,11 +411,14 @@ class Monster: ...@@ -398,11 +411,14 @@ class Monster:
398 # Some fuckery since python doesn't let you do a rand between decimals 411 # Some fuckery since python doesn't let you do a rand between decimals
399 pDif_rand = float(random.randint(int(pDif_min*100000), int(pDif_max*100000))) / 100000.0 412 pDif_rand = float(random.randint(int(pDif_min*100000), int(pDif_max*100000))) / 100000.0
400 413
401 final_damage = bd * (pDif_rand * cRatio) 414 fstr = ((self.get_strength() - enemy_vit)+4) / 4
415 print("Str: {} Vit: {} fstr: {}".format(self.get_strength(), enemy_vit, fstr))
416 bd = bd + fstr
417 final_damage = (bd * (pDif_rand * cRatio))
402 return final_damage 418 return final_damage
403 419
404 def attack(self, monster): 420 def attack(self, monster):
405 phy_damage = self.get_physical_base_damage(monster.get_base_defense(), 'melee', monster.level - self.level) 421 phy_damage = self.get_physical_base_damage(monster.get_base_defense(), 'melee', monster.level - self.level, monster.get_vitality())
406 return (phy_damage, 'hits') 422 return (phy_damage, 'hits')
407 423
408 424
...@@ -477,15 +493,21 @@ class Arena: ...@@ -477,15 +493,21 @@ class Arena:
477 secondary.apply_damage(result1[0]) 493 secondary.apply_damage(result1[0])
478 actions.append(AttackAction(primary, secondary, result1[0], result1[1])) 494 actions.append(AttackAction(primary, secondary, result1[0], result1[1]))
479 if secondary.hp <= 0: 495 if secondary.hp <= 0:
480 xp = 200 + (20 * (primary.level - secondary.level)) 496 level_difference = secondary.level - primary.level
481 actions.append(DefeatAction(secondary, primary, 'was defeated', xp)) 497 if level_difference in exp_table:
498 xp = exp_table[level_difference]
499 elif level_difference > 15:
500 xp = exp_table[15]
501 else:
502 xp = 0
503 actions.append(DefeatAction(primary, secondary, 'was defeated', xp))
482 return actions 504 return actions
483 result2 = secondary.attack(primary) 505 result2 = secondary.attack(primary)
484 primary.apply_damage(result2[0]) 506 primary.apply_damage(result2[0])
485 actions.append(AttackAction(secondary, primary, result2[0], result2[1])) 507 actions.append(AttackAction(secondary, primary, result2[0], result2[1]))
486 if primary.hp <= 0: 508 if primary.hp <= 0:
487 xp = 200 + (20 * (secondary.level - primary.level)) 509 xp = 200 + (20 * (primary.level - secondary.level))
488 actions.append(DefeatAction(primary, secondary, 'was defeated', xp)) 510 actions.append(DefeatAction(secondary, primary, 'was defeated', xp))
489 return actions 511 return actions
490 return actions 512 return actions
491 513
...@@ -524,12 +546,13 @@ if __name__ == "__main__": ...@@ -524,12 +546,13 @@ if __name__ == "__main__":
524 hunt_response = p.hunt_monster(hunt_zone) 546 hunt_response = p.hunt_monster(hunt_zone)
525 if hunt_response.result == HuntResponse.SUCCESS: 547 if hunt_response.result == HuntResponse.SUCCESS:
526 monster2 = hunt_response.monster 548 monster2 = hunt_response.monster
527 monster2.add_xp(16900) 549 #monster2.add_xp(16900)
528 phy_damage = monster2.attack(monster) 550 phy_damage = monster2.attack(monster)
529 print("Phys Attack: {}".format(phy_damage)) 551 print("Phys Attack: {}".format(phy_damage))
530 552
531 553
532 554 print("Acc: {}".format(monster.get_accuracy()))
555 print("Acc: {}".format(monster2.get_accuracy()))
533 556
534 battle_arena = p.start_battle(monster, monster2, "derp") 557 battle_arena = p.start_battle(monster, monster2, "derp")
535 fighting = True 558 fighting = True
......