public void trySupress(Terrain terrain)
 {
     supressSurroundings.clear();
     if (terrain.creature == null || terrain.creature.team == team)
     {
         GameController.console.Log("invalid target\n");
         return;
     }
     if (!supressSurroundings.hasTerrain(terrain.x, terrain.y))
     {
         GameController.console.Log("out of range\n");
         return;
     }
     if (terrain.creature is HumanHero || terrain.creature is UndeadHero)
     {
         GameController.console.Log("Cannot select hero\n");
         return;
     }
     if (!skills[2].use(terrain.creature))
     {
         return;
     }
     terrain.creature.isUndeadSiegeSupressed = true;
     supressTarget = terrain.creature;
     GameController.console.Log("supressing creature\n");
 }
示例#2
0
    private static void placeTrap(Terrain terrain)
    {
        if (possibilities.hasTerrain(terrain.x, terrain.y))
        {
            if (terrain.creature == null && terrain.trap == null)
            {
                if (!(terrain is Mountain))
                {
                    (creatureClicked as HumanArcher).setTrap(terrain.x, terrain.y);
                }
                else
                {
                    Debug.Log("Cant place trap in mountain");
                }
            }
            else
            {
                Debug.Log("Cant place trap over another creature or trap");
            }
        }
        else
        {
            Debug.Log("position out of range");
        }

        trapPreview = false;
        selectCreature(null);
    }
    public void tryCorner(Terrain terrain)
    {
        cornerSurroundings.clear();
        if (terrain.creature == null || terrain.creature.team == team)
        {
            GameController.console.Log("invalid target\n");
            return;
        }
        if (!cornerSurroundings.hasTerrain(terrain.x, terrain.y))
        {
            GameController.console.Log("out of reach\n");
            return;
        }
        if (!skills[1].use(terrain.creature))
        {
            return;
        }
        int      bestCount       = 0;
        int      secondBestCount = 0;
        Creature best;
        Creature secondBest;

        for (int aux = 0; aux < cornerSurroundings.creatures.Count; aux++)
        {
            Creature creature = cornerSurroundings.creatures[aux].second;
            if (creature == this)
            {
                continue;
            }
            if (creature.team == team)
            {
                if (creature.attackDamage > bestCount)
                {
                    bestCount = creature.attackDamage;
                    best      = creature;
                }
                else if (creature.attackDamage > secondBestCount)
                {
                    secondBest      = creature;
                    secondBestCount = creature.attackDamage;
                }
            }
        }
        int buffer = attackDamage;

        attackDamage = bestCount + secondBestCount;
        terrain.creature.receiveAttack(this);
        attackDamage = buffer;
        GameController.console.Log("used corner\n");
    }
    public void tryPossess(Terrain terrain)
    {
        possessSurroundings.clear();

        if (!possessSurroundings.hasTerrain(terrain.x, terrain.y))
        {
            Debug.Log("out of range");
            return;
        }
        if (terrain.creature == null)
        {
            GameController.console.Log("invalid target\n");
            return;
        }
        if (terrain.creature is UndeadKnight && (terrain.creature as UndeadKnight).isImmaterial)
        {
            GameController.console.Log("Cannot use habilities on immaterial undead knight");
            return;
        }
        GameController.overrideClick(tryPossess2);
        possessSurroundings = terrain.expandByDistance(3);
        possessSurroundings.paint(Color.blue);
    }
 public void trySetTrap(Terrain terrain)
 {
     if (preview.hasTerrain(terrain.x, terrain.y))
     {
         if (terrain.creature == null && terrain.trap == null)
         {
             if (!(terrain is Mountain))
             {
                 this.setTrap(terrain.x, terrain.y);
             }
             else GameController.console.Log("Cant place trap in mountain\n");
         }
         else GameController.console.Log("Cant place trap over another creature or trap\n");
     }
     else GameController.console.Log("position out of range\n");
     preview.clear();
     preview = null;
 }
    public void tryRevive(Terrain terrain)
    {
        reviveSurroundings.clear();
        if (terrain.creature != null || terrain is Mountain)
        {
            GameController.console.Log("invalid target\n");
            return;
        }
        if (!reviveSurroundings.hasTerrain(terrain.x, terrain.y))
        {
            GameController.console.Log("out of range\n");
            return;
        }
        skills[1].use();
        UndeadSoldier soldier = new UndeadSoldier(terrain.x, terrain.y, team);

        soldier.actionPoints = 0;
    }
示例#7
0
 public void tryCursedTouch(Terrain terrain)
 {
     cursedTouchSurroundings.clear();
     if (terrain.creature == null || terrain.creature.team == team)
     {
         GameController.console.Log("invalid target\n");
         return;
     }
     if (!cursedTouchSurroundings.hasTerrain(terrain.x, terrain.y))
     {
         GameController.console.Log("out of range\n");
         return;
     }
     if (!skills[0].use(terrain.creature))
     {
         return;
     }
     terrain.creature.defenseResistance -= 5;
     cursedTouchCreature = terrain.creature;
     GameController.console.Log("cursed touch applied\n");
 }