ee933491 by Barry

Added pankration changes for base damage calculation

1 parent 81ddab81
No preview for this file type
......@@ -156,7 +156,9 @@ class Pankration:
pass
def start_battle(self, monster1, monster2, battle_type):
pass
battle = Battle(monster1, monster2, battle_type)
battle.start()
return battle
def list_zones(self):
zone_list = []
......@@ -202,6 +204,7 @@ class Pankration:
def get_action():
return ""
class Monster:
def __init__(self, family, level, main_job, support_job, innate_feral_skills,
equipped_feral_skills, dicipline_level):
......@@ -216,6 +219,9 @@ class Monster:
self.temperament_attitude = family['temperament_attitude']['initial_value']
self.pre_fight_command = {"temperament_posture": None, "temperament_attitude": None}
self.exp = exp_to_level[level] + 1
# TODO: Setup something more interesting for each monster.
self.weapon_base_damage = 100
self.ammo_damage = 0
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)
......@@ -254,6 +260,58 @@ class Monster:
else:
return "Obedient"
# 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):
# 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:
ratio = bd / float(defense)
if attack_type == 'ranged':
cap = 3.0
else:
cap = 2.25
if ratio > cap:
ratio = cap
# Get the level correction ratio
if attack_type == 'ranged':
cRatio = ratio - 0.025 * level_difference
else:
cRatio = ratio - 0.050 * level_difference
if cRatio < 0:
cRatio = 0
if cRatio > 3.0:
cRatio = 3.0
# Calculate the pDif max as the max of our RNG
if cRatio <= 0.5:
pDif_max = 1+(10/9)*(cRatio-0.5)
elif 0.5 <= cRatio <= float(3/4):
pDif_max = 1
elif float(3/4) <= cRatio <= cap:
pDif_max = 1+(10/9)*(cRatio-float(3/4))
# Calculate the pDif max as the max of our RNG
if cRatio <= 0.5:
pDif_min = 1/6
elif 0.5 <= cRatio <= 1.25:
pDif_min = 1+(10/9)*(cRatio-1.25)
elif 1.25 <= cRatio <= 1.5:
pDif_min = 1
elif 1.5 <= cRatio <= cap:
pDif_min = 1+(10/9)*(cRatio-1.5)
print(pDif_min)
# 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)
return final_damage
# This should ONLY be executed at the start of battle.
def set_strategy(self, temperament_posture, temperament_attitude):
distance_from_nature = abs(self.temperament_posture - temperament_posture)
......@@ -275,8 +333,16 @@ class Monster:
#if severe request then reduce dicipline_level
pass
class Battle:
pass
def __init__(self, monster1, monster2, battle_type):
self.monster1 = monster1
self.monster2 = monster2
self.battle_type = battle_type
def perform_attack():
base_damage = get_physical_base_damage(monster2.defense, 'melee', 0)
class Arena:
pass
......@@ -299,6 +365,8 @@ if hunt_response.result == HuntResponse.SUCCESS:
print(monster.set_strategy(1, 1))
print(monster.set_strategy(1, 2))
monster.add_xp(2900)
phy_damage = monster.get_physical_base_damage(100, 'melee', -15)
print("Phys Attack: {}".format(phy_damage))
else:
print(hunt_response.message)
......