if (unit_stats["health_current"] < 1): action_helper.dead_action_receipt(battle_id, team, unit, unit_stats["title"], turn) elif (unit_stats["energy_current"] < cost): action_helper.exhausted_action_receipt(battle_id, team, unit, unit_stats["title"], turn) else: action_helper.spend_energy(battle_id, team, unit, cost) sql = "SELECT * FROM battle_unit_stats WHERE health_current > 0 AND battle_id = %s AND team = %s AND slot = %s" params = (battle_id, target_team, action_target_unit) cursor.execute(sql, params) target_stats = cursor.fetchone() heal = (10 + unit_stats["power_current"]) * scale * target_stats[ "health_default"] * action_helper.key_bonus_ally( action_helper.key_difference(target_stats["song_key"], unit_stats["song_key"])) heal_string = heal_string + str(heal) + " " newhealth = target_stats["health_current"] + heal if (newhealth > target_stats["health_default"]): newhealth = target_stats["health_default"] sql = "UPDATE battle_unit_stats SET health_current = %s WHERE battle_id = %s AND team = %s AND slot = %s" params = (newhealth, battle_id, target_team, action_target_unit) cursor.execute(sql, params) ''' This is the part where it updates some stuff in the receipt ''' if (heal > target_stats["health_default"] * 0.2): effective_text = "It was extremely strong!" target_animation = "healing_action_effect_strong"
params = (battle_id, team, unit) cursor.execute(sql, params) unit_stats = cursor.fetchone() if (unit_stats["energy_current"] < cost): action_helper.exhausted_action_receipt(battle_id, team, unit, unit_stats["title"], turn) else: action_helper.spend_energy(battle_id, team, unit, cost) sql = "SELECT * FROM battle_unit_stats WHERE battle_id = %s AND team = %s AND slot = %s" params = (battle_id, target_team, action_target_unit) cursor.execute(sql, params) target_stats = cursor.fetchone() power_multiplied = action_helper.key_bonus_enemy( action_helper.key_difference( target_stats["song_key"], unit_stats["song_key"])) * unit_stats["power_current"] * scale damage_percent = (power_multiplied * 0.01 + 0.05) print(damage_percent) damage = damage_percent * target_stats["health_current"] if (target_stats["defense_current"] > damage): damage = 1 else: damage = damage - target_stats["defense_current"] if (action_helper.is_immune(target_stats["immune"], battle_id, turn, target_stats["team"], target_stats["slot"]) != 0): damage = 0 newhealth = target_stats["health_current"] - damage ''' This is the part where it updates some stuff in the receipt