Example #1
0
        public List <Player> MakeQueue(List <Player> party, List <Player> opponnets, AbilityChecker abilityChecker)
        {
            List <Tuple <Player, int> > rolls = MakePlayerRollsTuples(party, opponnets, abilityChecker);

            rolls.Sort((p, q) => q.Item2.CompareTo(p.Item2));
            return(rolls.Select(x => x.Item1).ToList());
        }
Example #2
0
        public override IEnumerable <Item> GetItems()
        {
            var items = Hero.Inventory.Items.Where(x => AbilityChecker.IsItemEnabled(x.GetItemId()));

            if (MenuManager.CustomComboPriorityTempest)
            {
                items = items.OrderBy(x => MenuManager.GetItemOrderTempest(x.GetItemId()));
            }
            return(items);
        }
Example #3
0
 public override async Task UseAbilities(CancellationToken cancellationToken)
 {
     if (TempestDouble.CanBeCasted() && AbilityChecker.IsAbilityEnabled(TempestDouble.Id))
     {
         if (TempestManager.Tempest == null || !TempestManager.Tempest.IsValid || !Core.TempestHero.IsAlive)
         {
             TempestDouble.UseAbility();
             await Task.Delay(TempestDouble.GetAbilityDelay(), cancellationToken);
         }
     }
     await AbilitiesBehaviour.UseAbilities(this);
 }
        public void TestQueueCreator()
        {
            AbilityChecker abilityChecker = new AbilityChecker(new StableDice());

            List <Player> party = new List <Player>
            {
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10)
            };

            List <Player> opponents = new List <Player>
            {
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10),
                CreatePlayer(10)
            };

            List <Player> queue = QueueCreator.MakeQueue(party, opponents, abilityChecker);


            Assert.AreEqual(party.Count + opponents.Count, queue.Count);
            for (int i = 0; i < party.Count; i++)
            {
                Assert.AreEqual(party[i], queue[i]);
            }

            for (int i = 0; i < opponents.Count; i++)
            {
                Assert.AreEqual(opponents[i], queue[i + party.Count]);
            }
        }
Example #5
0
        private List <Tuple <Player, int> > MakePlayerRollsTuples(List <Player> party, List <Player> opponnets, AbilityChecker abilityChecker)
        {
            List <Tuple <Player, int> > rolls = new List <Tuple <Player, int> >();

            if (party != null)
            {
                foreach (Player player in party)
                {
                    rolls.Add(Tuple.Create(player, abilityChecker.MakeAbilityCheck(player.Character, data.Ability.Dexterity)));
                }
            }
            if (opponnets != null)
            {
                foreach (Player player in opponnets)
                {
                    rolls.Add(Tuple.Create(player, abilityChecker.MakeAbilityCheck(player.Character, data.Ability.Dexterity)));
                }
            }

            return(rolls);
        }