Exemple #1
0
        protected T GetRandom <T>(Dictionary <string, Func <string, T> > factory)
        {
            var index       = RandHelper.GetRandomInt(factory.Count);
            var lootCreator = factory.ElementAt(index);

            return(lootCreator.Value(lootCreator.Key));
        }
Exemple #2
0
 public ProjectileFightItem AddFightItem(FightItemKind kind)
 {
     fightItems[kind] = new ProjectileFightItem(kind, this)
     {
         Count = RandHelper.GetRandomInt(2) + 1
     };
     return(fightItems[kind] as ProjectileFightItem);
 }
Exemple #3
0
        protected Equipment GetRandomFromAll()
        {
            var index       = RandHelper.GetRandomInt(factory.Count);
            var lootCreator = factory.ElementAt(index);
            var loot        = lootCreator.Value(lootCreator.Key);

            return(loot);
        }
Exemple #4
0
        public override Loot GetRandom(int level)
        {
            var subFac = factories.Where(i => i != BooksFactory).ToList();

            var index       = RandHelper.GetRandomInt(subFac.Count);
            var lootCreator = subFac[index];

            return(lootCreator.GetRandom(level));
        }
Exemple #5
0
        internal override bool CanMakeRandomMove()
        {
            if (PreventMove)
            {
                return(false);
            }
            if (RandMoveCoolDown > 0)
            {
                RandMoveCoolDown--;
            }
            var res = RandMoveCoolDown == 0;

            if (res)
            {
                RandMoveCoolDown = RandHelper.GetRandomInt(4);
            }
            return(res);
        }
Exemple #6
0
        private static ProjectileFightItem CreateFightItem(FightItemKind fik)
        {
            int max = 3;
            int add = 3;
            var fi  = new ProjectileFightItem(fik, null)
            {
            };

            if (fik == FightItemKind.PlainArrow || fik == FightItemKind.PlainBolt)
            {
                max = 6;
            }
            if (fik == FightItemKind.HunterTrap)
            {
                max = 1;
                add = 2;
            }

            fi.Count = RandHelper.GetRandomInt(max) + add;
            return(fi);
        }