Beispiel #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_IsInArmy = reader.ReadBool();
                m_Army     = reader.ReadItem() as ArmyController;
                goto case 0;
            }

            case 0:
            {
                m_IsHired  = reader.ReadBool();
                m_HoldGold = reader.ReadInt();

                m_PayTimer = new PayTimer(this);
                m_PayTimer.Start();
                break;
            }
            }
        }
    /// <summary>
    /// Instantiate army object and send it from origin to target
    /// </summary>
    /// <param name="origin">Vertex A</param>
    /// <param name="target">Vertex B</param>
    /// <param name="amount">Army power to send</param>
    public void SendArmy(int origin, int target, int amount)
    {
        GameObject       vertexA = GameObject.Find($"vertex{origin}");
        VertexController originVertexController = vertexA.GetComponent <VertexController>();

        if (originVertexController.ArmyPower >= amount && amount > 0)
        {
            // Substract army power from the origin
            originVertexController.ArmyPower -= amount;

            // Position for new army object
            Vector3 spawnPosition = vertexA.gameObject.transform.position;
            spawnPosition.y = 0.25f;

            // Instantiate army object
            GameObject     newArmy        = Instantiate(ArmyObjectPrefab, spawnPosition, Quaternion.identity);
            ArmyController armyController = newArmy.GetComponent <ArmyController>();

            // Set army controller data
            armyController.Owner               = originVertexController.Owner;
            armyController.ArmyPower           = amount;
            armyController.OriginVertexIndexId = origin;
            armyController.TargetVertexIndexId = target;
        }
    }
Beispiel #3
0
 public void UnregisterArmy(ArmyController army)
 {
     if (AllArmies.Contains(army))
     {
         AllArmies.Remove(army);
     }
 }
Beispiel #4
0
 public void RegisterArmy(ArmyController army)
 {
     if (!AllArmies.Contains(army))
     {
         AllArmies.Add(army);
     }
 }
Beispiel #5
0
    /// <summary>
    /// Triggered on trigger enter with army
    /// </summary>
    /// <param name="secondArmy">Second army object</param>
    void CollideWithArmy(GameObject secondArmy)
    {
        ArmyController secondArmyController = secondArmy.GetComponent <ArmyController>();

        // Check if second army object is not triggering at this moment
        // and if has different owner
        if (secondArmyController.AlreadyTriggering == false && secondArmyController.Owner != Owner)
        {
            // Set flag on the second army to inform that this army object
            // is going to perform battle between them
            secondArmyController.AlreadyTriggering = true;

            if (secondArmyController.ArmyPower < ArmyPower)
            {
                ArmyPower -= secondArmyController.ArmyPower;
                Destroy(secondArmy);
            }
            else if (secondArmyController.ArmyPower > ArmyPower)
            {
                secondArmyController.ArmyPower -= ArmyPower;
                Destroy(gameObject);
            }
            else
            {
                Destroy(gameObject);
                Destroy(secondArmy);
            }
        }
    }
    public IEnumerator Siege(ArmyController army, ProvinceController province)
    {
        army.besieging = true;
        var siegeProgress = 0;
        var day           = TimeController.Instance.Date;

        while (siegeProgress != Constants.ProvinceSiegeDuration)
        {
            if (!army.besieging)
            {
                yield break;
            }

            while (!TimeController.Instance.Date.Equals(day.AddDays(1)))
            {
                yield return(null);
            }

            day = TimeController.Instance.Date;

            if (!army.fighting)
            {
                siegeProgress++;
            }
        }

        province.TransferProvince(army.nationId);

        army.besieging = false;
        yield return(null);
    }
        public ArmyGump(ArmyController controller)
            : base(0, 0)
        {
            m_Controller = controller;
            int war  = (controller.War) ? 1 : 0;
            int free = (controller.Free) ? 0 : 1;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(5, 221, 158, 144, 9200);
            AddAlphaRegion(8, 224, 150, 137);
            AddPage(1);
            Direction d;

            if (controller.CurrentFormation == ArmyFormationEnum.Triangle)
            {
                d = ((Direction)((7 + (8 - (int)(controller.ArmyFormationDirection))) % 8));
            }
            else
            {
                d = ((Direction)(((8 - (int)(controller.ArmyFormationDirection))) % 8));
            }
            AddButton(47, 269, 11400 + ((d != Direction.Up) ? 11 : 0), 11412, (int)Buttons.UP, GumpButtonType.Reply, 0);
            AddButton(48, 338, 11400 + ((d != Direction.Down) ? 11 : 0), 11412, (int)Buttons.DOWN, GumpButtonType.Reply, 0);
            AddButton(15, 303, 11400 + ((d != Direction.Left) ? 11 : 0), 11412, (int)Buttons.LEFT, GumpButtonType.Reply, 0);
            AddButton(79, 303, 11400 + ((d != Direction.Right) ? 11 : 0), 11412, (int)Buttons.RIGHT, GumpButtonType.Reply, 0);
            AddButton(24, 278, 11400 + ((d != Direction.West) ? 11 : 0), 11412, (int)Buttons.WEST, GumpButtonType.Reply, 0);
            AddButton(70, 278, 11400 + ((d != Direction.North) ? 11 : 0), 11412, (int)Buttons.NORTH, GumpButtonType.Reply, 0);
            AddButton(25, 327, 11400 + ((d != Direction.South) ? 11 : 0), 11412, (int)Buttons.SOUTH, GumpButtonType.Reply, 0);
            AddButton(71, 327, 11400 + ((d != Direction.East) ? 11 : 0), 11412, (int)Buttons.EAST, GumpButtonType.Reply, 0);
            AddImageTiledButton(127, 229, 4020, 4014 /*4021,4022*/, (int)Buttons.HELP, GumpButtonType.Reply, 0, 4020, 0, 10, 10, 0 /*3006118*/);
            AddImageTiledButton(97, 229, 4017, 4018, (int)Buttons.ATTACK, GumpButtonType.Reply, 2, 4017, 0, 10, 10, 1011533);
            AddImageTiledButton(67, 230, 4026 + war, 4028, (int)Buttons.WAR_PEACE, GumpButtonType.Reply, 0, 4026 + war, 0, 10, 10, 1077813);
            if (free == 0)
            {
                AddImageTiledButton(37, 230, 4008, 4010, (int)Buttons.FREE_FORMATION, GumpButtonType.Reply, 0, 4008, 0, 10, 10, 1063119);
            }
            else
            {
                AddImageTiledButton(37, 230, 4009, 4010, (int)Buttons.FREE_FORMATION, GumpButtonType.Reply, 0, 4009, 0, 10, 10, 1072367);
            }
            AddImageTiledButton(7, 230, 4014, 4016, (int)Buttons.GOTO, GumpButtonType.Reply, 0, 4014, 0, 10, 10, 3005134);
            AddImageTiledButton(48, 304, 10741, 10742, (int)Buttons.SAY, GumpButtonType.Reply, 10741, 0, 0, 10, 10, 3002076);
            AddImageTiledButton(5, 349, 11400, 11400, (int)Buttons.SLEEP, GumpButtonType.Page, 2, 11400, 0, 10, 10, 0);
            AddLabel(20, 349, 0, @"Wake/Sleep");
            AddButton(102, 259, 11357, 11357, (int)Buttons.CARRE_PLEIN, GumpButtonType.Reply, 0);
            AddButton(128, 259, 11354, 11354, (int)Buttons.CARRE_VIDE, GumpButtonType.Reply, 0);
            AddButton(102, 294, 11352, 11352, (int)Buttons.LIGNE, GumpButtonType.Reply, 0);
            AddButton(128, 294, 11358, 11358, (int)Buttons.TRIANGLE, GumpButtonType.Reply, 0);
            AddButton(102, 329, 11350, 11350, (int)Buttons.OTHER, GumpButtonType.Reply, 0);
            AddButton(128, 329, 11356, 11356, (int)Buttons.BORDEL, GumpButtonType.Reply, 0);
            AddPage(2);
            AddLabel(14, 265, 0, @"Wake(Cancel) Sleep(OK)");
            AddButton(14, 296, 241, 242, (int)Buttons.CANCEL, GumpButtonType.Reply, 0);
            AddButton(81, 296, 247, 248, (int)Buttons.OK, GumpButtonType.Reply, 0);
        }
Beispiel #8
0
 public BaseGardes(GeoController controller, ArmyController army)
     : base(AIType.AI_Army, FightMode.Closest, 2, 1, 0.5, 2)
 {
     Title             = "Garde";
     m_isGuarding      = false;
     this.m_controller = controller;
     this.m_army       = army;
 }
Beispiel #9
0
 private void InitialiseControllers()
 {
     gameBehaviourCommandController = new GameBehaviourCommandController(playerType);
     resourceController             = new ResourceController(playerType);
     buildPlotController            = new BuildPlotController(playerType);
     armyController    = new ArmyController(playerType);
     gameLogController = new GameLogController(playerType);
 }
Beispiel #10
0
 public void EndTurn()
 {
     ActiveArmy.FinalizeArmy();
     TurnNumber++;
     ActiveArmy = armies[TurnNumber % armies.Length];
     if (ActiveArmy.HasLost)
     {
         return;
     }
     ActiveArmy.StartArmy();
     MessagePopup.Instance.Show(ActiveArmy.tag + " turn");
 }
Beispiel #11
0
 public ConquestInterface(
     ContextController context, InputController input, OutputController output, CountryController country,
     MapController map, DiscoveryController discovery, ArmyController army, ConquestController conquest
     )
 {
     _context   = context;
     _input     = input;
     _out       = output;
     _country   = country;
     _map       = map;
     _discovery = discovery;
     _army      = army;
     _conquest  = conquest;
 }
Beispiel #12
0
    /// <summary>
    /// Creates an array of cloned GameObjects of armies.
    /// </summary>
    /// <param name="count">The number of armies to clone.</param>
    /// <returns>An array of armies with the given count.</returns>
    private ArmyController[] InstantiateNewArmies(uint count)
    {
        List <ArmyController> defaultArmies = new List <ArmyController>();

        for (int i = 0; i < count; ++i)
        {
            GameObject     basicArmyCopy = Instantiate <GameObject>(RiskGameManager.Shared().PrefabBasicArmy);
            ArmyController army          = basicArmyCopy.GetComponent <ArmyController>();
            army.Player = this;
            defaultArmies.Add(army);
        }

        return(defaultArmies.ToArray());
    }
Beispiel #13
0
    void SetArmy(ArmyInfo armyInfo)
    {
        if (armyInfo.pos == Vector3.zero)
        {
            armyInfo.pos = pathfinding.GetCityPos(armyInfo.cityFrom);
        }

        GameObject go = (GameObject)Instantiate(armyPrefab, armyInfo.pos, transform.rotation);

        go.transform.parent = root.transform;
        ArmyController armyCtrl = go.GetComponent <ArmyController>();

        armyCtrl.InitArmyInfo(armyInfo);
    }
Beispiel #14
0
    public override bool Execute()
    {
        Debug.Log("buy unit command executing");
        ArmyController     armyController     = GetArmyController();
        ResourceController resourceController = GetResourceController();

        model = UnitPurchaseModelFactory.Create(unitType);


        // Check if prerequisite building has been built
        bool prerequisiteBuilt = GetBuildPlotController().IsComplete(model.prerequisite);


        if (!prerequisiteBuilt)
        {
            // abort
            Debug.LogError(string.Format("Can't construct {0}, as its prerequisite building {1} hasn't been constructed.", unitType, model.prerequisite));
            GetGameLogController().Log(string.Format("Error: Can't construct {0}, as its prerequisite building {1} hasn't been constructed.", unitType, model.prerequisite));
            return(false);
        }

        // Check supply

        bool supplyAvailable = armyController.CheckSupply(model);

        if (!supplyAvailable)
        {
            // abort
            Debug.LogError("no supply available");
            GetGameLogController().Log("Error: Not enough supply to construct" + unitType);

            return(false);
        }

        // transaction succeeds
        if (resourceController.PayOutTransaction(model.buildCost))
        {
            armyController.AddUnitToBuildQueue(model);
        }
        else // rejected
        {
            GetGameLogController().Log("Error: Not enough resources to construct" + unitType);
            return(false);
        }

        return(true);
    }
    private int CalculateLosses(ArmyController armyController, int diceRoll, int length)
    {
        var baseCasualties = Constants.BaseCasualties + Constants.DiceAmplifier * diceRoll;
        var casualties     = baseCasualties + baseCasualties * (1 + length) / Constants.CasualtiesDivisor;

        armyController.troops -= casualties * Constants.TroopsCasualtiesAmplifier;
        armyController.SetStrength();
        armyController.currentMorale -= CalculateMoraleLosses(armyController, casualties);

        if (armyController.currentMorale <= 0)
        {
            armyController.currentMorale = 0f;
            Debug.Log(armyController.nationId + " lost");
            armyController.Retreat();
        }

        return(casualties);
    }
Beispiel #16
0
    public void UpdateTraining()
    {
        if (currentTick < requiredTicks)
        {
            currentTick++;
            Debug.Log(string.Format("Training {0}/{1}", currentTick, requiredTicks));
        }
        else
        {
            Unsubscribe();
            Debug.Log("training complete");


            ArmyController armyController = GameObject.Find("GameController").GetComponent <GameController>().GetPlayerModel(playerType).armyController;
            armyController.AddCompleteUnit(model);
            isTraining = false;
            // unit complete -> notify ArmyController to add unit to army
            // fetch next from queue if possible
        }
    }
    public IEnumerator BuildRegiment(ArmyController army, NationController nation)
    {
        var day = TimeController.Instance.Date;

        if (nation.ResourceManagement.Manpower < Constants.RegimentTroops ||
            nation.ResourceManagement.Gold < Constants.RegimentCost)
        {
            yield break;
        }

        nation.ResourceManagement.Manpower -= Constants.RegimentTroops;
        nation.ResourceManagement.Gold     -= Constants.RegimentCost;

        while (!TimeController.Instance.Date.Equals(day.AddDays(Constants.RegimentBuildTime)))
        {
            yield return(null);
        }

        army.Regiments++;
        army.troops += Constants.RegimentTroops;
        army.RestoreStrength();
    }
Beispiel #18
0
    public void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this.gameObject);
        }

        ActiveArmy = armies[TurnNumber % armies.Length];
        ActiveArmy.StartArmy();
        MessagePopup.Instance.Show(ActiveArmy.tag + " turn");

        foreach (var army in armies)
        {
            army.onArmyLost.AddListener(() => {
                MessagePopup.Instance.Show(army.name + " Lost",
                                           new System.Tuple <string, UnityAction>("Play Again", PlayAgain),
                                           new System.Tuple <string, UnityAction>("Quit", QuitGame));
            });
        }
    }
 public void SetArmyInformation(ArmyController armyController)
 {
     army = armyController;
 }
Beispiel #20
0
 public ArmyUpdater(CountryController country, ArmyController army, MoneyController money)
 {
     _country = country;
     _army    = army;
     _money   = money;
 }
Beispiel #21
0
        public ArmyGump(ArmyController controller)
            : base(0, 0)
        {
            m_Controller = controller;

            int war  = (controller.War) ? 1 : 0;
            int free = (controller.Free) ? 0 : 1;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);
            if (controller.Owner.AccessLevel >= AccessLevel.Batisseur)
            {
                AddBackground(5, 221, 214, 154, 9200);
                AddAlphaRegion(8, 224, 207, 147);
            }
            else
            {
                AddBackground(5, 221, 184, 154, 9200);
                AddAlphaRegion(8, 224, 177, 147);
            }
            AddPage(1);

            Direction d;

            if (controller.CurrentFormation == ArmyFormationEnum.Triangle)
            {
                d = ((Direction)((7 + (8 - (int)(controller.ArmyFormationDirection))) % 8));
            }
            else
            {
                d = ((Direction)(((8 - (int)(controller.ArmyFormationDirection))) % 8));
            }

            AddButton(47, 259, 4500, 4500, (int)Buttons.UP, GumpButtonType.Reply, 0);
            AddButton(48, 328, 4504, 4504, (int)Buttons.DOWN, GumpButtonType.Reply, 0);
            AddButton(15, 293, 4506, 4506, (int)Buttons.LEFT, GumpButtonType.Reply, 0);
            AddButton(79, 293, 4502, 4502, (int)Buttons.RIGHT, GumpButtonType.Reply, 0);
            AddButton(14, 268, 4507, 4507, (int)Buttons.WEST, GumpButtonType.Reply, 0);
            AddButton(70, 268, 4501, 4501, (int)Buttons.NORTH, GumpButtonType.Reply, 0);
            AddButton(25, 317, 4505, 4505, (int)Buttons.SOUTH, GumpButtonType.Reply, 0);
            AddButton(71, 317, 4503, 4503, (int)Buttons.EAST, GumpButtonType.Reply, 0);

            //AddButton(71, 327, 11400 + ((d != Direction.East) ? 11 : 0), 11412, (int)Buttons.EAST, GumpButtonType.Reply, 0);

            AddImageTiledButton(127, 229, 4020, 4022, (int)Buttons.RELEASE, GumpButtonType.Page, 2, 4020, 0, 10, 10, 3006118);
            AddImageTiledButton(97, 229, 4017, 4018, (int)Buttons.ATTACK, GumpButtonType.Reply, 2, 4017, 0, 10, 10, 1011533);
            AddImageTiledButton(67, 230, 4026 + war, 4028, (int)Buttons.WAR_PEACE, GumpButtonType.Reply, 0, 4026 + war, 0, 10, 10, 1077813);

            if (free == 0)
            {
                AddImageTiledButton(37, 230, 4008, 4010, (int)Buttons.FREE_FORMATION, GumpButtonType.Reply, 0, 4008, 0, 10, 10, 1063119);
            }
            else
            {
                AddImageTiledButton(37, 230, 4009, 4010, (int)Buttons.FREE_FORMATION, GumpButtonType.Reply, 0, 4009, 0, 10, 10, 1072367);
            }

            AddImageTiledButton(7, 230, 4014, 4016, (int)Buttons.GOTO, GumpButtonType.Reply, 0, 4014, 0, 10, 10, 3005134);
            AddImageTiledButton(157, 229, 4029, 4031, (int)Buttons.SAY, GumpButtonType.Reply, 10741, 0, 0, 10, 10, 3002076);

            if (controller.Owner.AccessLevel >= AccessLevel.Batisseur)
            {
                AddImageTiledButton(187, 229, 4011, 4013, (int)Buttons.RECRUIT, GumpButtonType.Reply, 0, 11400, 0, 10, 10, 3006116);
            }

            AddButton(132, 249, 2336, 2336, (int)Buttons.CARRE_PLEIN, GumpButtonType.Reply, 0);
            AddButton(158, 249, 2333, 2333, (int)Buttons.CARRE_VIDE, GumpButtonType.Reply, 0);
            AddButton(132, 284, 2334, 2334, (int)Buttons.LIGNE, GumpButtonType.Reply, 0);
            AddButton(158, 284, 2332, 2332, (int)Buttons.TRIANGLE, GumpButtonType.Reply, 0);
            AddButton(132, 329, 2337, 2337, (int)Buttons.OTHER, GumpButtonType.Reply, 0);
            AddButton(158, 329, 2335, 2335, (int)Buttons.BORDEL, GumpButtonType.Reply, 0);

            AddPage(2);

            AddLabel(14, 265, 0, @"CONFIRM DISBAND ?");
            AddButton(14, 296, 241, 242, (int)Buttons.CANCEL, GumpButtonType.Page, 1);
            AddButton(81, 296, 247, 248, (int)Buttons.OK, GumpButtonType.Reply, 0);
        }
Beispiel #22
0
    void SetEscapeFromCity(int cIdx)
    {
        CityInfo cInfo = Informations.Instance.GetCityInfo(cIdx);

        do
        {
            GameObject     go = (GameObject)Instantiate(armyPrefab, pathfinding.GetCityPos(cIdx), transform.rotation);
            ArmyController ac = go.GetComponent <ArmyController>();
            ArmyInfo       ai = new ArmyInfo();
            ai.king     = cInfo.king;
            ai.money    = 0;
            ai.armyCtrl = ac;

            ac.armyInfo = ai;
            ac.SetArmyKingFlag();

            Informations.Instance.armys.Add(ai);
            ai.armyCtrl.SetArmyKingFlag();

            go.transform.parent = GameObject.Find("ArmiesRoot").transform;

            int count = cInfo.generals.Count;
            int min   = count - 5;
            min = Mathf.Clamp(min, 0, count);
            for (int i = count - 1; i >= min; i--)
            {
                int g = cInfo.generals[i];
                ai.generals.Add(g);
                cInfo.generals.RemoveAt(i);

                Informations.Instance.GetGeneralInfo(g).city = -1;
            }

            ai.commander = -1;
            ai.armyCtrl.FindArmyCommander();

            int        cityEscTo = -1;
            List <int> clist     = MyPathfinding.GetCityNearbyIdx(cIdx);
            List <int> canGoList = new List <int>();

            if (clist.Count == 1)
            {
                cityEscTo = clist[0];
            }
            else
            {
                for (int i = 0; i < clist.Count; i++)
                {
                    if (Informations.Instance.GetCityInfo(clist[i]).king == ai.king)
                    {
                        canGoList.Add(clist[i]);
                    }
                }

                if (canGoList.Count > 0)
                {
                    cityEscTo = canGoList[Random.Range(0, canGoList.Count)];
                }

                if (cityEscTo == -1)
                {
                    for (int i = 0; i < clist.Count; i++)
                    {
                        if (Informations.Instance.GetCityInfo(clist[i]).king == -1)
                        {
                            canGoList.Add(clist[i]);
                        }
                    }

                    if (canGoList.Count > 0)
                    {
                        cityEscTo = canGoList[Random.Range(0, canGoList.Count)];
                    }
                }

                if (cityEscTo == -1)
                {
                    cityEscTo = clist[Random.Range(0, clist.Count)];
                }
            }

            ai.cityFrom = cIdx;
            ai.cityTo   = cityEscTo;

            if (pathfinding == null)
            {
                pathfinding = GameObject.FindWithTag("Pathfinding").GetComponent <MyPathfinding>();
            }

            ai.armyCtrl.SetRoute(pathfinding.GetRoute(ai.armyCtrl.transform.position, ai.cityTo));
            ai.armyCtrl.SetArmyEscape();
        } while (cInfo.generals.Count > 0);
    }
Beispiel #23
0
    void SetArmy()
    {
        Vector3 pos = path.GetCityPos(cityIdx);

        GameObject go = (GameObject)Instantiate(armyPrefab, pos, transform.rotation);

        armyCtrl = go.GetComponent <ArmyController>();

        ArmyInfo armyInfo = new ArmyInfo();

        armyInfo.king     = cInfo.king;
        armyInfo.cityFrom = cityIdx;
        armyInfo.cityTo   = -1;
        armyInfo.money    = moneyTook;
        armyInfo.armyCtrl = armyCtrl;

        armyCtrl.armyInfo = armyInfo;
        Informations.Instance.armys.Add(armyInfo);

        GameObject root = GameObject.Find("ArmiesRoot");

        go.transform.parent = root.transform;

        armyCtrl.SetArmyKingFlag();
        armyCtrl.Pause();

        for (int i = cInfo.generals.Count - 1; i >= 0; i--)
        {
            if (generalsList[i].GetButtonState() == PushedButton.ButtonState.Pressed)
            {
                int gIdx = (int)generalsList[i].GetButtonData();

                armyInfo.generals.Add(gIdx);
                cInfo.generals.Remove(gIdx);

                Informations.Instance.GetGeneralInfo(gIdx).city = -1;

                if (selectedCount == 1)
                {
                    armyInfo.commander = gIdx;
                }
            }
        }

        if (cInfo.generals.Count == 1)
        {
            cInfo.prefect = cInfo.generals[0];
        }
        else if (cInfo.generals.Count == 0)
        {
            Informations.Instance.GetKingInfo(cInfo.king).cities.Remove(cityIdx);
            cInfo.king = -1;
            flagsCtrl.SetFlag(cityIdx);
        }

        if (isSelectedPrefect)
        {
            armyInfo.commander = prefectBK;
        }
        else
        {
            if (state == 4)
            {
                armyInfo.commander = selectCommander.GetCommander();
            }
        }

        if (takePrisonFlag)
        {
            takePrisonFlag = false;

            armyInfo.prisons.AddRange(cInfo.prisons);
            cInfo.prisons.Clear();

            for (int i = 0; i < armyInfo.prisons.Count; i++)
            {
                Informations.Instance.GetGeneralInfo(armyInfo.prisons[i]).city = -1;
            }
        }

        selectTargetCity.SetArmy(armyInfo);
    }
Beispiel #24
0
 // Use this for initialization
 void Start()
 {
     pathfinding = GameObject.FindWithTag("Pathfinding").GetComponent <MyPathfinding>();
     armyMoving  = GetComponent <ArmyController>();
 }
 private float CalculateMoraleLosses(ArmyController armyController, float casualties)
 {
     return(casualties / Constants.MoraleLossDivisor
            * (armyController.maximumMorale / Constants.MaxMoraleLossDivisor)
            + Constants.DailyMoraleLoss);
 }
Beispiel #26
0
        public PaysanNomadeGarde(GeoController geo, ArmyController army) : base(geo, army)
        {
            IsGuarding = false;

            SpeechHue = Utility.RandomDyedHue();
            Hue       = Utility.RandomSkinHue();

            if (this.Female = Utility.RandomBool())
            {
                Body = 0x191;
                Name = NameList.RandomName("female");
            }
            else
            {
                Body = 0x190;
                Name = NameList.RandomName("male");
                AddItem(new ShortPants(Utility.RandomNeutralHue()));
            }

            Title = "Soldat";
            Item hair = new Item(Utility.RandomList(0x203B, 0x2049, 0x2048, 0x204A));

            hair.Hue     = Utility.RandomNeutralHue();
            hair.Layer   = Layer.Hair;
            hair.Movable = false;
            AddItem(hair);

            if (Utility.RandomBool() && !this.Female)
            {
                Item beard = new Item(Utility.RandomList(0x203E, 0x203F, 0x2040, 0x2041, 0x204B, 0x204C, 0x204D));

                beard.Hue     = hair.Hue;
                beard.Layer   = Layer.FacialHair;
                beard.Movable = false;

                AddItem(beard);
            }

            SetStr(91, 91);
            SetDex(91, 91);
            SetInt(50, 50);

            SetDamage(7, 14);

            SetSkill(SkillName.Tactiques, 36, 67);
            SetSkill(SkillName.ArtMagique, 22, 22);
            SetSkill(SkillName.Epee, 64, 100);
            SetSkill(SkillName.Parer, 60, 82);
            SetSkill(SkillName.ArmeContondante, 36, 67);
            //SetSkill(SkillName.Focus, 36, 67);
            SetSkill(SkillName.Anatomie, 25, 47);

            AddItem(new Shoes(Utility.RandomNeutralHue()));
            AddItem(new Shirt());

            // Pick a random sword
            switch (Utility.Random(3))
            {
            //case 0: AddItem(new Longsword()); break;
            case 2: AddItem(new VikingSword()); break;

            case 1: AddItem(new TwoHandedAxe()); break;
            }

            // Pick a random shield
            switch (Utility.Random(8))
            {
            case 0: AddItem(new BronzeShield()); break;

            case 1: AddItem(new HeaterShield()); break;

            case 2: AddItem(new MetalKiteShield()); break;

            case 3: AddItem(new MetalShield()); break;

            case 4: AddItem(new WoodenKiteShield()); break;

            case 5: AddItem(new WoodenShield()); break;

            case 6: AddItem(new OrderShield()); break;

            case 7: AddItem(new ChaosShield()); break;
            }

            switch (Utility.Random(6))
            {
            case 0: break;

            case 1: AddItem(new Bascinet()); break;

            case 2: AddItem(new CloseHelm()); break;

            case 3: AddItem(new NorseHelm()); break;

            case 4: AddItem(new Helmet()); break;

            case 5: AddItem(new CasqueSudiste()); break;
            }
            // Pick some armour
            switch (Utility.Random(4))
            {
            case 0:     // Leather
                AddItem(new LeatherChest());
                AddItem(new LeatherArms());
                AddItem(new LeatherGloves());
                AddItem(new LeatherGorget());
                AddItem(new LeatherLegs());
                break;

            case 1:     // Studded Leather
                AddItem(new StuddedChest());
                AddItem(new StuddedArms());
                AddItem(new StuddedGloves());
                AddItem(new StuddedGorget());
                AddItem(new StuddedLegs());
                break;

            case 2:     // Ringmail
                AddItem(new RingmailChest());
                AddItem(new RingmailArms());
                AddItem(new RingmailGloves());
                AddItem(new RingmailLegs());
                break;

            case 3:     // Chain
                AddItem(new ChainChest());
                AddItem(new ChainCoif());
                AddItem(new ChainLegs());
                break;
            }

            PackGold(25, 100);
        }