Esempio n. 1
0
        public void SimulatedBattle(Army a, Army b)
        {
            // //TODO: temporary things:
            // actionsManager.NextAction = new ActionInfo
            // {
            //     UserArmy = a,
            //     EnemyArmy = b,
            //     Type = ActionType.Battle
            // };
            // return;

            Army winner;
            Army loser;

            var s1 = a.Strength + GlobalUtils.Rand(100);
            var s2 = b.Strength + GlobalUtils.Rand(100);
            var s3 = 0;

            var ds = s1 - s2;

            if (ds >= 0)
            {
                winner = a;
                loser  = b;
            }
            else
            {
                winner = b;
                loser  = a;
            }
            s3 = s2 / 15;

            _armiesRepository.KillArmy(loser);

            foreach (var character in winner.Characters)
            {
                character.Energy -= s3;
                if (character.Energy < 0)
                {
                    character.Energy = 0;
                }
            }

            if (loser.IsTracked)
            {
                //TODO: MESSAGE2[LOSER," został rozbity.",33,0,0]
            }
        }
Esempio n. 2
0
 private bool UpdateFoods(Army army)
 {
     if (army.Owner.IsUserControlled)
     {
         var days = army.Food / army.Characters.Count;
         if (days < 5 && days > 0)
         {
             //TODO: MESSAGE[A,"Kończy nam się żywność.",0,0]
         }
         if (army.Food <= 0)
         {
             //TODO: MESSAGE[A,"Oddział rozwiązany",0,0]
             _armiesRepository.KillArmy(army);
             return(false);
         }
     }
     return(true);
 }