Exemplo n.º 1
0
 public BattleArmy(BattleArmy otherArmy)
 {
     otherArmy.unitsStackList.ForEach((currentStack) => {
         var newStack        = new BattleUnitsStack(currentStack);
         newStack.parentArmy = this;
         _unitsStackList.Add(newStack);
     });
 }
Exemplo n.º 2
0
        public Battle(Player _firstPlayer, Player _secondPlayer)
        {
            firstPlayer  = _firstPlayer;
            secondPlayer = _secondPlayer;

            firstPlayerArmy  = new BattleArmy(firstPlayer.army);
            secondPlayerArmy = new BattleArmy(secondPlayer.army);
            intitativeScale  = new Initiative(firstPlayerArmy, secondPlayerArmy);
        }
Exemplo n.º 3
0
        public Initiative(BattleArmy _firstArmy, BattleArmy _secondArmy)
        {
            firstArmy  = _firstArmy;
            secondArmy = _secondArmy;

            currentMainScale     = new SimplePriorityQueue <BattleUnitsStack, double>();
            currentAwaitingScale = new SimplePriorityQueue <BattleUnitsStack, double>();
            nextMainScale        = new SimplePriorityQueue <BattleUnitsStack, double>();
            Random rnd = new Random();

            foreach (var stack in firstArmy.unitsStackList.Concat(secondArmy.unitsStackList))
            {
                if (stack.unitsCount == 0)
                {
                    continue;
                }
                currentMainScale.Enqueue(stack, -(stack.metaUnit.initiative + rnd.NextDouble() / 100));
                nextMainScale.Enqueue(stack, -(stack.metaUnit.initiative + rnd.NextDouble() / 100));
            }
        }
Exemplo n.º 4
0
 // В призываемых юнитах будет свойство уничтожения после конца битвы, поэтому ничего не переполнится
 public Army(BattleArmy otherArmy)
 {
     otherArmy.unitsStackList.ForEach((currentStack) => _unitsStackList.Add(new UnitsStack(currentStack)));
 }
Exemplo n.º 5
0
 public void UpdateArmy(BattleArmy battleArmy)
 {
     army = new Army(battleArmy);
 }