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):
elif message_bits[4].startswith('hour'):
msg_datetime = msg_datetime + datetime.timedelta(hours=time)
msg_idx = 5
elif message_bits[4].startswith('day'):
msg_datetime = msg_datetime + datetime.timedelta(days=time)
msg_idx = 5
else: # minutes by default
msg_datetime = msg_datetime + datetime.timedelta(minutes=time)
msg_idx = 5
......@@ -1014,10 +1017,10 @@ def do_rigged(client, message_parts, message):
def do_hunt_monster(client, message_parts, message):
p = Pankration()
hunt_response = p.hunt_monster(' '.join(message_parts))
str_out = hunt_response.message
str_out = hunt_response.message + "\n\n"
if hunt_response.result == HuntResponse.SUCCESS:
monster = hunt_response.monster
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))
str_out += str(monster)
send_message(client, message.channel, str_out)
return
......
......@@ -49,7 +49,7 @@ exp_table = {
-12: 40,
-13: 40,
-14: 40,
-15: 40,
-15: 20,
}
class Jobs:
BLM = 1
......@@ -129,6 +129,8 @@ Families = {
'str_per_level': 0.8934,
'base_agi': 7,
'agi_per_level': 0.76,
'base_dex': 10,
'dex_per_level': 0.76,
'temperament_attitude': {
'initial_value': 4,
'actions': {
......@@ -166,6 +168,8 @@ Families = {
'str_per_level': 0.8534,
'base_agi': 9,
'agi_per_level': 0.88,
'base_dex': 10,
'dex_per_level': 0.714,
'temperament_attitude': {
'initial_value': 4,
'actions': {
......@@ -192,15 +196,15 @@ Monsters = {
'initial_level': 9,
'family': 'acrolith',
'zone': 'Abyssea - Uleguerand',
'hp': 1000,
'weapon_base_damage': 40
'hp': 20,
'weapon_base_damage': 14
},
'Floating Eye': {
'initial_level': 3,
'initial_level': 10,
'family': 'ahriman',
'zone': 'Ranguemont Pass',
'hp': 1000,
'weapon_base_damage': 120
'hp': 15,
'weapon_base_damage': 15
}
}
......@@ -265,13 +269,12 @@ class Pankration:
class Monster:
def __init__(self, monster_type, family_name, family, hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills,
def __init__(self, monster_type, family_name, family, base_hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills,
equipped_feral_skills, dicipline_level):
self.monster_type = monster_type
self.family_name = family_name
self.family = family
self.max_hp = hp
self.hp = hp
self.base_hp = base_hp
self.level = level
self.main_job = main_job
self.support_job = support_job
......@@ -291,12 +294,20 @@ class Monster:
self.str_per_level = family['str_per_level']
self.base_agi = family['base_agi']
self.agi_per_level = family['agi_per_level']
self.base_dex = family['base_dex']
self.dex_per_level = family['dex_per_level']
self.hp = self.get_hp()
def __str__(self):
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)
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())
#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)
def get_hp(self):
#this is a bit dumb but it's close enough.
return int((self.level * 20) + self.base_hp)
def get_fp(self):
return int(self.level / self.family['fp_per_level'])
return int(self.level / self.family['fp_per_level'] + self.family['base_fp'])
def add_xp(self, exp_to_add):
self.exp += exp_to_add
......@@ -307,12 +318,7 @@ class Monster:
self.level = i
#print("Start level: {} New Level: {}".format(self.level, i))
else:
pass#print("Just another brick in the wall...")
else:
break
# calc level based on xp
# stop at 50
pass
def get_current_posture(self):
return TemperamentPosture(self.temperament_posture)
......@@ -330,6 +336,12 @@ class Monster:
else:
return "Obedient"
def get_dexterity(self):
return int(round(max(self.base_dex, self.level * self.dex_per_level)))
def get_accuracy(self):
return int(math.floor(3*self.get_dexterity()/4) + 100)
def get_vitality(self):
return int(round(max(self.base_vit, self.level * self.vit_per_level)))
......@@ -343,17 +355,18 @@ class Monster:
return (math.floor(self.get_vitality()/2) + 8 + self.level)
def get_hp_percent(self):
return max(0, int(round((self.hp/self.max_hp)*100)))
print(self.hp)
return max(0, int(round((self.hp/self.get_hp())*100)))
# Calculate the base damage against the provided defense
# attack_type can be 'ranged' or 'melee'
def get_physical_base_damage(self, defense, attack_type, level_difference):
def get_physical_base_damage(self, defense, attack_type, level_difference, enemy_vit):
#print("Defense: {} Type: {} Level diff: {}".format(defense, attack_type, level_difference))
# Calculate the attack/defense ratio
bd = float(self.weapon_base_damage)
if attack_type == 'ranged':
bd += self.ammo_damage
# NOTE: We are not using fStr1 or fStr2 since we are not keeping str / vit as data
if defense == 0:
ratio = 99
else:
......@@ -398,11 +411,14 @@ class Monster:
# Some fuckery since python doesn't let you do a rand between decimals
pDif_rand = float(random.randint(int(pDif_min*100000), int(pDif_max*100000))) / 100000.0
final_damage = bd * (pDif_rand * cRatio)
fstr = ((self.get_strength() - enemy_vit)+4) / 4
print("Str: {} Vit: {} fstr: {}".format(self.get_strength(), enemy_vit, fstr))
bd = bd + fstr
final_damage = (bd * (pDif_rand * cRatio))
return final_damage
def attack(self, monster):
phy_damage = self.get_physical_base_damage(monster.get_base_defense(), 'melee', monster.level - self.level)
phy_damage = self.get_physical_base_damage(monster.get_base_defense(), 'melee', monster.level - self.level, monster.get_vitality())
return (phy_damage, 'hits')
......@@ -477,15 +493,21 @@ class Arena:
secondary.apply_damage(result1[0])
actions.append(AttackAction(primary, secondary, result1[0], result1[1]))
if secondary.hp <= 0:
xp = 200 + (20 * (primary.level - secondary.level))
actions.append(DefeatAction(secondary, primary, 'was defeated', xp))
level_difference = secondary.level - primary.level
if level_difference in exp_table:
xp = exp_table[level_difference]
elif level_difference > 15:
xp = exp_table[15]
else:
xp = 0
actions.append(DefeatAction(primary, secondary, 'was defeated', xp))
return actions
result2 = secondary.attack(primary)
primary.apply_damage(result2[0])
actions.append(AttackAction(secondary, primary, result2[0], result2[1]))
if primary.hp <= 0:
xp = 200 + (20 * (secondary.level - primary.level))
actions.append(DefeatAction(primary, secondary, 'was defeated', xp))
xp = 200 + (20 * (primary.level - secondary.level))
actions.append(DefeatAction(secondary, primary, 'was defeated', xp))
return actions
return actions
......@@ -524,12 +546,13 @@ if __name__ == "__main__":
hunt_response = p.hunt_monster(hunt_zone)
if hunt_response.result == HuntResponse.SUCCESS:
monster2 = hunt_response.monster
monster2.add_xp(16900)
#monster2.add_xp(16900)
phy_damage = monster2.attack(monster)
print("Phys Attack: {}".format(phy_damage))
print("Acc: {}".format(monster.get_accuracy()))
print("Acc: {}".format(monster2.get_accuracy()))
battle_arena = p.start_battle(monster, monster2, "derp")
fighting = True
......