Ejemplo n.º 1
0
    private void Hit(Player.Attack left_act, Player.Attack right_act)
    {
        float left_damage;
        float right_damage;

        // Calculate right player damage
        right_damage = CalculateAttack(right_player, right_act, left_player);

        // Calculate left player damage
        left_damage = CalculateAttack(left_player, left_act, left_player);

        // Apply damage calculations
        left_player.ModHealth(-right_damage);
        right_player.ModHealth(-left_damage);

        // Do particle effects
        if (right_damage > 0)
        {
            if (right_act.IsHigh())
            {
                particler.SpawnEffectOnPlayer(right_damage >= 4 ? "heavy_high_hit" : "light_high_hit", left_player, right_player);
            }
            if (right_act.IsLow())
            {
                particler.SpawnEffectOnPlayer(right_damage >= 4 ? "heavy_low_hit" : "light_low_hit", left_player, right_player);
            }
            if (right_act.IsMid())
            {
                particler.SpawnEffectOnPlayer(right_damage >= 4 ? "heavy_mid_hit" : "light_mid_hit", left_player, right_player);
            }
        }

        if (left_damage > 0)
        {
            if (left_act.IsHigh())
            {
                particler.SpawnEffectOnPlayer(left_damage >= 4 ? "heavy_high_hit" : "light_high_hit", right_player, left_player);
            }
            if (left_act.IsLow())
            {
                particler.SpawnEffectOnPlayer(left_damage >= 4 ? "heavy_low_hit" : "light_low_hit", right_player, left_player);
            }
            if (left_act.IsMid())
            {
                particler.SpawnEffectOnPlayer(left_damage >= 4 ? "heavy_mid_hit" : "light_mid_hit", right_player, left_player);
            }
        }
    }
Ejemplo n.º 2
0
    private void Clash(Player.Attack left_act, Player.Attack right_act)
    {
        if (left_act == Player.Attack.Projectile)
        {
            // Calculate player damage (both known projectiles)
            float right_damage = CalculateBoostedAttack(right_player, right_act);
            float left_damage  = CalculateBoostedAttack(left_player, left_act);

            float tide = right_damage - left_damage;

            // If left overpowers
            if (tide < 0)
            {
                right_player.ModHealth(tide);
            }
            else if (tide > 0)
            {
                left_player.ModHealth(-tide);
            }
        }

        else
        {
            if (left_act.IsHigh() || right_act.IsHigh())
            {
                particler.SpawnEffectOnPlayer("high_clash", left_player, right_player);
            }

            if (left_act.IsLow() || right_act.IsLow())
            {
                particler.SpawnEffectOnPlayer("low_clash", left_player, right_player);
            }

            if (left_act.IsMid() || right_act.IsMid())
            {
                particler.SpawnEffectOnPlayer("mid_clash", left_player, right_player);
            }
        }


        // If not projectiles, players neutralize each other's damage (noop)
    }