public void EnergySelected(Spell.Type type)
 {
     if (GameObject.Find(panel.GetComponent <PanelController> ().activePlayer).GetComponent <PlayerScript> ().activePokemon.name == selectedPokemonForEnergy)
     {
         GameObject.Find(panel.GetComponent <PanelController> ().activePlayer).GetComponent <PlayerScript> ().activePokemon.addEnergy(type);
         PanelController.selectingEnergy = false;
         PanelController.askForAttacking = true;
         energyButtonGroup.SetActive(false);
         panel.GetComponent <PanelController> ().changeText();
         panel.SetActive(true);
         Debug.Log("Active pokemon energy");
     }
     else
     {
         for (int i = 0; i < GameObject.Find(panel.GetComponent <PanelController> ().activePlayer).GetComponent <PlayerScript> ().banc.Count; ++i)
         {
             if (selectedPokemonForEnergy == GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().banc[i].name)
             {
                 GameObject.Find(panel.GetComponent <PanelController> ().activePlayer).GetComponent <PlayerScript> ().banc [i].addEnergy(type);
                 PanelController.selectingEnergy = false;
                 PanelController.askForAttacking = true;
                 energyButtonGroup.SetActive(false);
                 panel.GetComponent <PanelController> ().changeText();
                 panel.SetActive(true);
             }
         }
     }
 }
Example #2
0
    public Pokemon(string p_name, int p_lifePoints, Spell.Type p_type, Spell[] m_spells)
    {
        name       = p_name;
        lifePoints = p_lifePoints;
        type       = p_type;
        spells     = m_spells;

        state          = Pokemon.State.Normal;
        energyAssigned = new List <Spell.Type> ();

        imageTarget = GameObject.Find("ImageTarget" + name);
    }
Example #3
0
    public PokemonList()
    {
        list = new Dictionary <string, Pokemon> ();

        Spell.Type[] eNeeded;
        Spell[]      spells;

        eNeeded     = new Spell.Type[1];
        eNeeded [0] = Spell.Type.Plant;
        spells      = new Spell[1];
        Spell secretion = new Spell("Sécrétion", "Lancez une pièce. Si c'est face le Pokémon Actif de votre adversaire est maintenant Paralysé.", eNeeded, 10);

        spells [0] = secretion;
        Pokemon chenipan = new Pokemon("Chenipan", 40, Spell.Type.Plant, spells);

        list.Add("Chenipan", chenipan);


        spells      = new Spell[1];
        eNeeded     = new Spell.Type[2];
        eNeeded [0] = Spell.Type.Water;
        eNeeded [1] = Spell.Type.Water;
        Spell pistoletAO = new Spell("Pistolet à O", "", eNeeded, 30);

        spells [0] = pistoletAO;
        Pokemon ptitard = new Pokemon("Ptitard", 60, Spell.Type.Water, spells);

        list.Add("Ptitard", ptitard);

        spells      = new Spell[1];
        eNeeded     = new Spell.Type[1];
        eNeeded [0] = Spell.Type.Lightning;
        Spell bouleElek = new Spell("Boule Elek", "", eNeeded, 10);

        spells [0] = bouleElek;
        Pokemon voltorbe = new Pokemon("Voltorbe", 60, Spell.Type.Lightning, spells);

        list.Add("Voltorbe", voltorbe);

        spells      = new Spell[1];
        eNeeded     = new Spell.Type[1];
        eNeeded [0] = Spell.Type.Psy;
        Spell regardMenancant = new Spell("Regard Menaçant", "Placez un marqueur de dégats sur l'un des Pokémon de votre adversaire", eNeeded, 10);

        spells [0] = regardMenancant;
        Pokemon fantominus = new Pokemon("Fantominus", 50, Spell.Type.Psy, spells);

        list.Add("Fantominus", fantominus);
    }
Example #4
0
    public void removeEnergy(Spell.Type energy)
    {
        int index = -1;

        for (int i = 0; i < energyAssigned.Count; ++i)
        {
            if (energyAssigned[i] == energy)
            {
                index = i;
            }
        }

        if (index != -1)
        {
            energyAssigned.RemoveAt(index);
        }
    }
Example #5
0
    public void castSpell(Spell.Type type, Vector2Int location, List <Vector2Int> areaOfEffect)
    {
        Spell s = new Spell(type, location, areaOfEffect);

        activeSpells.Add(s);
    }
Example #6
0
 public void addEnergy(Spell.Type energy)
 {
     energyAssigned.Add(energy);
 }
    public void SpellButtonClicked(Spell.Type m_type, int p_damage)
    {
        GameObject spell;

        switch (m_type)
        {
        case Spell.Type.Plant:
            DestroySpellButtons();
            spell = chenipanSpell.transform.Find("WaterShower").gameObject;
            StartCoroutine(Wait(spell));
            GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints -= p_damage;
            if (GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints <= 0)
            {
                PanelController.activePokemonDead = true;
                PanelController.nbPokemonDead++;
                GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.destroyImage();
            }
            spellPanel.SetActive(false);
            PanelController.selectingCapacity = false;
            PanelController.changingTurn      = true;
            panel.GetComponent <PanelController> ().changeText();
            break;

        case Spell.Type.Water:
            DestroySpellButtons();
            spell = ptitardSpell.transform.Find("WaterShower").gameObject;
            StartCoroutine(Wait(spell));
            GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints -= p_damage;
            if (GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints <= 0)
            {
                PanelController.activePokemonDead = true;
                PanelController.nbPokemonDead++;
                GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.destroyImage();
            }
            spellPanel.SetActive(false);
            PanelController.selectingCapacity = false;
            PanelController.changingTurn      = true;
            panel.GetComponent <PanelController> ().changeText();
            break;

        case Spell.Type.Psy:
            DestroySpellButtons();
            spell = fantominusSpell.gameObject;
            StartCoroutine(Wait(spell));
            GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints -= p_damage;
            if (GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints <= 0)
            {
                PanelController.activePokemonDead = true;
                PanelController.nbPokemonDead++;
                GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.destroyImage();
            }
            spellPanel.SetActive(false);
            PanelController.selectingCapacity = false;
            PanelController.changingTurn      = true;
            panel.GetComponent <PanelController> ().changeText();
            break;

        case Spell.Type.Lightning:
            DestroySpellButtons();
            spell = voltorbeSpell.gameObject;
            StartCoroutine(Wait(spell));
            GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints -= p_damage;
            if (GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.lifePoints <= 0)
            {
                PanelController.activePokemonDead = true;
                PanelController.nbPokemonDead++;
                GameObject.Find(panel.GetComponent <PanelController> ().enemyPlayer).GetComponent <PlayerScript> ().activePokemon.destroyImage();
            }
            spellPanel.SetActive(false);
            PanelController.selectingCapacity = false;
            PanelController.changingTurn      = true;
            panel.GetComponent <PanelController> ().changeText();
            break;
        }
    }