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");
 }
Exemple #2
0
 private static void clearAll()
 {
     if (possibilities != null)
     {
         possibilities.clear();
     }
     if (attackPossibilities != null)
     {
         attackPossibilities.clear();
     }
 }
    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;
    }
Exemple #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");
 }
Exemple #8
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha0))
        {
            if (creatureClicked != null)
            {
                creatureClicked.defend();
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (creatureClicked is HumanKnight)
            {
                (creatureClicked as HumanKnight).assault();
            }
            else if (creatureClicked is HumanSiege)
            {
                (creatureClicked as HumanSiege).toggleMount();
                selectCreature(creatureClicked);
            }
            else if (creatureClicked is HumanArcher)
            {
                possibilities.clear();
                possibilities = (creatureClicked as HumanArcher).previewTrap();
                if (possibilities == null)
                {
                    selectCreature(null);
                }
                else
                {
                    possibilities.paint(new Color(255, 255, 0));
                    trapPreview = true;
                }
            }
            else if (creatureClicked is HumanSoldier)
            {
                (creatureClicked as HumanSoldier).raiseShields();
                selectCreature(creatureClicked);
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (creatureClicked is HumanSiege)
            {
                (creatureClicked as HumanSiege).habilityPush();
                selectCreature(creatureClicked);
            }
        }

        /*-------GUI Scripting----------*/
        if (creatureClicked != null)
        {
            //Assigning Selected creature's value to diplay on GUI
            text_name.text = "Name: " + creatureClicked.name;
            text_team.text = "Team: " + creatureClicked.teamName;
            text_HP.text   = "HP: " + creatureClicked.health.ToString();
            text_AP.text   = "AP: " + creatureClicked.actionPoints.ToString();
            text_DE.text   = "DE: " + creatureClicked.defenseResistance.ToString();
            text_AT.text   = "AT: " + creatureClicked.attackDamage.ToString();
            //text_EV.text = "EV: " + creatureClicked.evasion.ToString();

            //Assigning Selected creature's image file to display on GUI
            if (creatureClicked is HumanArcher)
            {
                unitImgObject.GetComponent <Image>().sprite = Harcher;
            }
            else if (creatureClicked is HumanHero)
            {
                unitImgObject.GetComponent <Image>().sprite = HHero;
            }
            else if (creatureClicked is HumanKnight)
            {
                unitImgObject.GetComponent <Image>().sprite = HKnight;
            }
            else if (creatureClicked is HumanSiege)
            {
                unitImgObject.GetComponent <Image>().sprite = HSiege;
            }
            else if (creatureClicked is HumanSoldier)
            {
                unitImgObject.GetComponent <Image>().sprite = HSoldier;
            }
        }
        else
        {
            text_name.text = "Name: ";
            text_team.text = "Team: ";
            text_HP.text   = "HP: ";
            text_AP.text   = "AP: ";
            text_DE.text   = "DE: ";
            text_AT.text   = "AT: ";
            text_EV.text   = "EV: ";
            unitImgObject.GetComponent <Image>().sprite = blankImg;
        }
        /*-----------------------------*/
    }
 public virtual void mouseUp(Surroundings surroundings)
 {
     surroundings.clear();
 }