Beispiel #1
0
    private int DoBestia(Fighter attacker, Fighter target, Bestia bestia)
    {
        int damage = bestia.damage;

        target.health -= bestia.damage;
        return(damage);
    }
Beispiel #2
0
    private Bestia CargarPokemonSalvaje()
    {
        Bestia devolver = null;

        try
        {
            string[] leer   = File.ReadAllLines("data/pokemons/lista_pokemon.txt");
            int      indice = r.Next(0, leer.Length);
            SdlHardware.Pause(100);
            devolver = new Bestia(leer[indice].Split(';')[0],
                                  leer[indice].Split(';')[1]);
            devolver.CargarAtaques();
        }
        catch (Exception e)
        {
            Menu.Error();
        }
        return(devolver);
    }
Beispiel #3
0
    private Bestia ObtenerPokemonDisponible()
    {
        bool   puedeCambiar = false;
        Bestia cambiar      = null;

        foreach (Bestia b in prota.GetEquipo())
        {
            if (b.GetVida() > 0 && !puedeCambiar)
            {
                cambiar = b;
                cambiar.MoveTo(100, 350);
                puedeCambiar = true;
            }
        }

        if (!puedeCambiar)
        {
            PerderCombate();
        }
        return(cambiar);
    }
Beispiel #4
0
 public Combate(ref Jugador prota, Bestia salvaje, Juego juego)
 {
     r              = new Random();
     bg             = new Image("data/fondo_combate.png");
     font24         = new Font("data/Joystix.ttf", 25);
     font35         = new Font("data/Joystix.ttf", 35);
     continuar      = true;
     capturando     = false;
     turno          = true;
     posicionFlecha = 560;
     seleccion      = 0;
     this.prota     = prota;
     seleccionado   = ObtenerPokemonDisponible();
     this.salvaje   = salvaje;
     this.juego     = juego;
     salvaje.MoveTo(600, 70);
     fondo_opciones = new Image("data/dialogo_combate.png");
     bgSound        = new Sound("data/sonidos/combate.mp3");
     cantidadMinima = 500;
     cantidadMaxima = 700;
 }
Beispiel #5
0
    IEnumerator BestiaCoroutine(Fighter attacker, Transform attackerTransform, Fighter target, Bestia bestia)
    {
        target = ValidateCurrentTarget(target);

        if (target != null && !_isBattleFinished)
        {
            _isAnimationOnGoing = true;

            Transform targetTransform = battleParties.fighterTransformDict[target];

            Vector3    originalPosition = attackerTransform.position;
            Quaternion originalRotation = attackerTransform.rotation;

            Sequence attackSequence = DOTween.Sequence();
            attackSequence.Append(attackerTransform.DOLookAt(targetTransform.position, 0.1f));
            attackSequence.Append(attackerTransform.DOShakePosition(2));
            yield return(attackSequence.WaitForElapsedLoops(1));

            /// just a note for myself ^^
            /// TO DO
            /// loop through all hit times
            /// When: after "real" animations got implemented

            Vector3    spawnPosition = targetTransform.position - Vector3.up * targetTransform.localScale.y * 0.5f;
            GameObject bestiaCallGO  = GameObject.Instantiate(bestia.bestiaCall, spawnPosition, Quaternion.identity);

            yield return(new WaitForSeconds(bestia.duration));

            FinishAction(attacker, attackerTransform, originalPosition, originalRotation);
            DealDamage(target, _battleRuleBook.DoSubMenuAction(attacker, target, bestia));
            TargetDying(target);

            _isAnimationOnGoing = false;
        }

        CheckBattleState();
    }
Beispiel #6
0
 public void AddBestia(Fighter attacker, Fighter target, Bestia bestia)
 {
     _battleActions.Enqueue(BestiaCoroutine(attacker, battleParties.fighterTransformDict[attacker], target, bestia));
 }