public override string action()
        {
            string error = "";

            loadNecessaryData();
            if (nTanks > nTanksRemain)
            {
                error = "Insufficient tanks : you have " + nTanksRemain + " but you want to deploy " + nTanks;
            }
            else
            {
                error = data.addTanks(land, nTanks);
            }
            if (error.Equals(""))
            {
                string message = manageMessage.messageDeploy(controller.getPlayer(), nTanks, land);
                view.updateLogEvent(manageMessage.readDeploy(message));
                DataSender.SendPosizionamento(message);
                nTanksRemain -= nTanks;
                if (nTanksRemain == 0)
                {
                    error = "FORCE_NEXT_PHASE";
                }
                else
                {
                    view.updateDeploySelected("Select a Land !!!");
                    view.updateTanksRemain(nTanksRemain);
                }
            }
            return(error);
        }
Exemple #2
0
 private void AttackMessage()
 {
     view.updateLogEvent(manageMessage.readInitiateCombat(messageData));
     data.setDefendPhase(manageMessage.getLandEnd());
     view.updatePhase(data.getPlayer(), data.getPhase());
     if (!data.getPlayer().Equals(controller.getPlayer()))//check if the player is NOT the one targeted
     {
         nextPhaseLoad = this;
     }
     else
     {
         view.changeCanvasOption("Defend phase");
         nextPhaseLoad = new StateDefend(controller, data, manageMessage, view);
     }
 }
Exemple #3
0
        public override string action()
        {
            string error = "";

            loadNecessaryData();
            error = data.addTanks(land, nTanks);
            if (error.Equals(""))
            {
                string message = manageMessage.messageDeploy(controller.getPlayer(), nTanks, land);
                view.updateDeploySelected("Select a Land !!!");
                view.updateTanksRemain(data.getPlayerTanksReinforcement(controller.getPlayer()));
                view.updateLogEvent(manageMessage.readDeploy(message));
                DataSender.SendPosizionamento(message);
            }
            return(error);
        }
Exemple #4
0
        public override string needSaving(string land)
        {
            string field = "";

            Debug.Log(controller.getPlayer() + " == " + data.getPlayer());
            if (data.getPlayerByLand(land).Equals(data.getPlayer()))//checking if the player owned that land
            {
                controller.resetMemoryBuffer();
                field = "firstLand";
                view.updateTwoSelected(land, "Select a state !!!");
            }
            else
            {
                if (controller.getFirstLand() != null && data.areNeighbor(controller.getFirstLand(), land))
                { // checking the lands are neghbor
                    field = "secondLand";
                    view.updateTwoSelected(controller.getFirstLand(), land);
                }
            }

            return(field);
        }