예제 #1
0
 public static void clickTerrain(Terrain terrain)
 {
     if (creatureClicked is UndeadKnight && terrain is Mountain)
     {
         selectCreature(null);
         return;
     }
     if (isOverriding)
     {
         isOverriding = false;
         overrideFunction(terrain);
         return;
     }
     if (creatureClicked == null)
     {
         if (terrain.creature != null)
         {
             if (terrain.creature.team == TurnController.turn)
             {
                 selectCreature(terrain.creature);
             }
         }
     }
     else
     {
         Trio <int, int, Terrain> t;
         if (terrain.creature == creatureClicked)
         {
             selectCreature(null);
             return;
         }
         if (attackPossibilities.hasCreature(terrain.creature))
         {
             if (terrain.creature.team != creatureClicked.team)
             {
                 creatureClicked.attack(terrain.creature);
                 selectCreature(creatureClicked);
             }
             else
             {
                 selectCreature(terrain.creature);
             }
         }
         else if (possibilities.tryGetTerrain(terrain.x, terrain.y, out t))
         {
             if (terrain.creature == null)
             {
                 if (creatureClicked is HumanKnight && t.first == 1)
                 {
                     t.second++;
                 }
                 creatureClicked.move(terrain.x, terrain.y, t.second);
                 selectCreature(null);
             }
             else if (terrain.creature == creatureClicked)
             {
                 selectCreature(null);
             }
             else if (terrain.creature.team == creatureClicked.team)
             {
                 selectCreature(terrain.creature);
             }
         }
         else if (terrain.creature != null && terrain.creature.team == TurnController.turn)
         {
             selectCreature(terrain.creature);
         }
         else
         {
             selectCreature(null);
         }
     }
 }