Exemplo n.º 1
0
    params = (battle_id, team, unit)
    cursor.execute(sql, params)
    unit_stats = cursor.fetchone()

    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"
        params = (battle_id, target_team)
        cursor.execute(sql, params)
        target_stats_all = cursor.fetchall()
        for target_stats in target_stats_all:
            heal = 10 + unit_stats["power_current"] * scale * 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

            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, target_stats["slot"])
            summary_code += "t{}u{} +{} ".format(target_team, target_stats["slot"], heal)
            cursor.execute(sql, params)

        source_animation = "defensive_action_cast"
        target_animation = "defensive_action_effect"
        background_animation = "defensive_action_background"
        summary_text = "{} casts All Start on all allies, giving {} extra heath".format(
            unit_stats["title"], heal_string)

        sql = "UPDATE battle_action_queue SET source_animation=%s, target_animation=%s, background_animation=%s, summary_code=%s, summary_text=%s, processed=1 WHERE battle_id=%s AND unit=%s AND team=%s AND turn =%s"
Exemplo n.º 2
0
    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!"
Exemplo n.º 3
0
        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["health_default"] -
                 unit_stats["health_current"])) * 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!"
Exemplo n.º 4
0
    params = (battle_id, team, unit)
    cursor.execute(sql, params)
    unit_stats = cursor.fetchone()

    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"
        params = (battle_id, target_team)
        cursor.execute(sql, params)
        target_stats_all = cursor.fetchall()
        for target_stats in target_stats_all:
            heal = (20 + unit_stats["power_current"] * scale) * 0.01 * 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, target_stats["slot"])
            summary_code += "t{}u{} h +{}".format(target_team, target_stats["slot"], heal)
            cursor.execute(sql, params)

        source_animation = "healing_action_cast"
        background_animation = "healing_action_background"
        target_animation = "healing_action_effect"
        
Exemplo n.º 5
0
    cursor.execute(sql, params)
    unit_stats = cursor.fetchone()

    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 battle_id = %s AND team = %s"
        params = (battle_id, target_team)
        cursor.execute(sql, params)
        target_stats_all = cursor.fetchall()
        for target_stats in target_stats_all:
            defense_boost = unit_stats["power_current"] * action_helper.key_bonus_ally(
                action_helper.key_difference(target_stats["song_key"], unit_stats["song_key"]))
            newhealth = target_stats["defense_current"] + (defense_boost / 3)
            if(target_stats["health_current"] > 0):
                sql = "UPDATE battle_unit_stats SET defense_current = %s WHERE battle_id = %s AND team = %s AND slot = %s"
                params = (newhealth, battle_id, target_team, target_stats["slot"])
                cursor.execute(sql, params)

        source_animation = "defense_attack_cast"
        background_animation = "defense_attack_bg_animation"
        target_animation = "defense_attack_effect"
        summary_code = "format this later"
        summary_text = "{} has increased defense of every alive ally unit".format(
            unit_stats["title"])

        sql = "UPDATE battle_action_queue SET source_animation=%s, target_animation=%s, background_animation=%s, summary_code=%s, summary_text=%s, processed=1 WHERE battle_id=%s AND unit=%s AND team=%s AND turn =%s"
        params = (source_animation, target_animation, background_animation,
Exemplo n.º 6
0
    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()

        power_boost = (20 + unit_stats["power_current"]
                       ) * scale * action_helper.key_bonus_ally(
                           action_helper.key_difference(
                               target_stats["song_key"],
                               unit_stats["song_key"]))
        power_boost_string = power_boost_string + str(power_boost) + " "
        newpower = target_stats["power_current"] + power_boost

        sql = "UPDATE battle_unit_stats SET power_current = %s WHERE battle_id = %s AND team = %s AND slot = %s"
        params = (newpower, battle_id, target_team, action_target_unit)
        cursor.execute(sql, params)
        '''
        This is the part where it updates some stuff in the receipt
        '''
        if (power_boost > target_stats["power_default"] * 0.2):
            effective_text = "It was extremely strong!"
            target_animation = "power_boosting_action_effect_strong"
        elif (power_boost > target_stats["power_default"] * 0.1):
            effective_text = "It was strong!"
Exemplo n.º 7
0
    params = (battle_id, team, unit)
    cursor.execute(sql, params)
    unit_stats = cursor.fetchone()

    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"
        params = (battle_id, target_team)
        cursor.execute(sql, params)
        target_stats_all = cursor.fetchall()
        for target_stats in target_stats_all:
            multiplier = 0.01 * (40 + unit_stats["power_current"] * action_helper.key_bonus_ally(
                action_helper.key_difference(target_stats["song_key"], unit_stats["song_key"])))
            if(target_stats["health_current"] < (target_stats["health_default"] * multiplier)):
                summary_code += "t{}u{} d +{} ".format(target_team, target_stats["slot"], defense_current)
                sql = "UPDATE battle_unit_stats SET defense_current = defense_current*2  WHERE battle_id = %s AND team = %s AND slot = %s"
                params = (battle_id, target_team, target_stats["slot"])
                cursor.execute(sql, params)

        source_animation = "defensive_action_cast"
        target_animation = "defensive_action_effect"
        background_animation = "defensive_action_background"
        summary_text = "{} casts Under Pressure on all allies, giving all weaken units double defense".format(
            unit_stats["title"])

        sql = "UPDATE battle_action_queue SET source_animation=%s, target_animation=%s, background_animation=%s, summary_code=%s, summary_text=%s, processed=1 WHERE battle_id=%s AND unit=%s AND team=%s AND turn =%s"
        params = (source_animation, target_animation, background_animation,
                  summary_code, summary_text, battle_id, unit, team, turn)