private void UpgradeUnits(string title, int level)
    {
        AnimaText animaText = new AnimaText();

        for (int i = 0; i < Bench.SIZE; i++)
        {
            if (Bench.occupied[i])
            {
                if (Bench.units[i].title == title && Bench.units[i].level < level)
                {
                    Bench bench = new Bench();
                    bench.Destroy(i);
                    animaText.ShowText(Bench.benches[i], "Upgraded", Color.green);
                }
            }
        }
        for (int i = 0; i < Formation.SIZE; i++)
        {
            if (Formation.occupied[i])
            {
                if (Formation.units[i].title == title && Formation.units[i].level < level)
                {
                    Formation formation = new Formation();
                    formation.Destroy(i);
                    animaText.ShowText(Formation.formations[i], "Upgraded", Color.green);
                }
            }
        }
    }
Пример #2
0
 public void Destroy(int tile)
 {
     if (enemies[tile].keyKeeper)
     {
         PlayerStat.keyObtained = true;
         AnimaText text = new AnimaText();
         text.ShowText(tile, "Gate Key obtained", Color.cyan);
     }
     if (enemies[tile].artifactKeeper)
     {
         artifactKeepers--;
         if (artifactKeepers == 0)
         {
             Artifact artifact = new Artifact();
             artifact.DropRandomArtifact(tile);
             AnimaText text = new AnimaText();
             text.ShowText(tile, "Artifact Dropped", Color.cyan);
         }
     }
     if (enemies[tile].boss)
     {
         PlayerStat.bossKilled = true;
         AnimaText text = new AnimaText();
         text.ShowText(tile, "Staircase opened", Color.cyan);
     }
     GameObject.Destroy(GameObject.Find("Enemy" + tile.ToString()));
     enemies[tile]       = null;
     occupied[tile]      = false;
     Tile.passable[tile] = true;
 }
    public void Use(Unit unit)
    {
        AnimaText animaText = new AnimaText();

        animaText.ShowText(Bf.bfs[unit.tile], "Ability Used", Color.cyan);
        Attack attack = new Attack();

        switch (unit.title)
        {
        case "Crossbowman":
            for (int i = unit.tile % 3; i < 30; i += 3)
            {
                if (Bf.occupied[i])
                {
                    if (Bf.units[i].ally != unit.ally)
                    {
                        attack.DealDamage(unit.tile, i, unit.attack, "Magical");
                    }
                }
            }
            break;

        case "Dire Wolf":
            unit.rage += 3;
            break;

        case "Sentinel":
            int target = attack.DamageRandomInRange(unit, unit.attack * 3, "Magical");
            Bf.units[target].armor -= unit.attack * 3;
            break;
        }

        unit.mana = 0;
        unit.UpdateDescription(Bf.bfs[unit.tile], unit);
    }
Пример #4
0
    public void TakeDamage(int damage)
    {
        health -= damage;
        if (health > healthMax)
        {
            health = healthMax;
        }

        AnimaText animaText = new AnimaText();

        if (damage > 0)
        {
            animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.red);
        }
        else if (damage < 0)
        {
            animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.green);
        }
        else
        {
            animaText.ShowText(PlayerMovement.tilePos, damage.ToString(), Color.gray);
        }

        UnitStat unitStat = new UnitStat();

        unitStat.DisplayStats(PlayerMovement.tilePos);
    }
Пример #5
0
 public void DealDamage(int from, int to, int damage, string type)
 {
     if (Bf.occupied[from] && Bf.occupied[to])
     {
         AnimaText animaText = new AnimaText();
         animaText.TakeDamage(from, to, damage, type);
     }
 }
Пример #6
0
    public void DealDamage(bool player, double _amount)
    {
        AnimaText  animaText = new AnimaText();
        GameObject target    = Hero.Heroes[0];

        if (!player)
        {
            target = Hero.Heroes[1];
        }
        int amount = (int)_amount;

        animaText.DisplayText(target, "-" + amount.ToString(), Color.red, 1.5f);
    }
Пример #7
0
    public void GainArmor(bool player, double _amount)
    {
        AnimaText  animaText = new AnimaText();
        GameObject target    = Hero.Heroes[0];

        if (!player)
        {
            target = Hero.Heroes[1];
        }
        int amount = (int)_amount;

        animaText.DisplayText(target, "Armor +" + amount.ToString(), Color.gray, 1.5f);
    }
Пример #8
0
    public void DamageEnemy(int damage, int tile)
    {
        Enemy.enemies[tile].health -= damage;
        UnitStat unitStat = new UnitStat();

        unitStat.DisplayStats(tile);
        AnimaText animaText = new AnimaText();

        animaText.ShowText(tile, damage.ToString(), Color.red);

        if (Enemy.enemies[tile].health <= 0)
        {
            Enemy enemy = new Enemy();
            enemy.Destroy(tile);
        }
    }
Пример #9
0
 public void PlayerClicked()
 {
     if (Tile.type[PlayerMovement.tilePos] == Tile.Type.End)
     {
         if (PlayerStat.bossKilled)
         {
             Level level = new Level();
             level.WinLevel();
         }
         else
         {
             AnimaText text = new AnimaText();
             text.ShowText(PlayerMovement.tilePos, "Boss still alive", Color.red);
         }
     }
 }
Пример #10
0
    private void OpenGate(int i)
    {
        if (Tile.type[i] == Tile.Type.TreasureGateClosed)
        {
            gateOpened = true;

            Tile tile = new Tile();
            tile.AddGateOpen(i);

            AnimaText text = new AnimaText();
            text.ShowText(i, "Gate Opened", Color.cyan);

            UI ui = new UI();
            ui.EndTurn();
        }
    }
Пример #11
0
    public void UpgradeCards(bool player, double _amount)
    {
        AnimaText animaText = new AnimaText();
        int       iStart    = 0;

        if (!player)
        {
            iStart += 10;
        }
        int amount = (int)_amount;

        for (int i = iStart; i < iStart + Card.SIZE / 2; i++)
        {
            if (Card.occupied[i])
            {
                Card.cards[i].value += amount;
                Card.Cards[i].GetComponentInChildren <Text>().text = "     " + Card.cards[i].element.Substring(0, 1) + "\n<size=34>" + Card.cards[i].value + "</size>\n" + Card.cards[i].element.Substring(0, 1) + "     ";
                animaText.DisplayText(Card.Cards[i], "+" + amount.ToString(), Color.green, 1.5f);
            }
        }
    }