Example #1
0
 private void doActionAction()
 {
     if (MemUnit != null && (MemUnit.getUnit().getPlayer() == game.turn.currentPlayer))
     {
         UnitAPI currunit = memUnit.getUnit();
         if (SelectedTile.getEnemy() != null)
         {
             if (currunit.canAttack(SelectedTile.getEnemy()))
             {
                 UnitAPI loser = currunit.attack(SelectedTile.getEnemy());
                 MessageBox.Show(loser.getPlayer().name + " loses the battle!");
                 if (loser.lifePoints <= 0)
                 {
                     MessageBox.Show(loser.getPlayer().name + " is dead!");
                 }
             }
             else
             {
                 MessageBox.Show("Attack action not possible");
             }
         }
         else
         {
             if (currunit.canMove(SelectedTile.X, SelectedTile.Y))
             {
                 currunit.move(SelectedTile.X, SelectedTile.Y);
             }
             else
             {
                 MessageBox.Show("Move action not possible");
             }
         }
         //Global Refresh
         memUnit.Refresh();
         updateTiles();
         this.Refresh();
     }
     else
     {
         MessageBox.Show("No unit selected");
     }
     this.isFinished();
 }
Example #2
0
 public bool isOneOfMyUnitsSelected(List <UnitAPI> tileUnits)
 {
     return(tileUnits.Any(t => (hasMemUnit && (t == MemUnit.getUnit()))));
 }