示例#1
0
        private IAct PickEventFromStories()
        {
            var stories = RetrieveWaitingStories();

            if (stories.Count == 0)
            {
                return(null);
            }

            var acts = new StoryBroker().RetrieveNonPlayedActsFrom(stories);

            if (acts.Count == 0)
            {
                acts = GameData.Instance.StoryContext.PlayedActs.ToAct();
            }

            if (acts.Count == 0)
            {
                return(null);
            }

            var selectedAct = new Act(acts[TalesRandom.GenerateRandomNumber(acts.Count)]);

            return(selectedAct.IsQualifiedRightNow()
                ? selectedAct
                : null);
        }
示例#2
0
        public Act ChooseQualifiedActFrom(List <Story> stories)
        {
            var acts = new List <Act>();

            foreach (var s in stories)
            {
                if (!s.IsQualifiedRightNow())
                {
                    continue;
                }

                foreach (var a in s.Acts)
                {
                    var act = new Act(a);

                    if (!act.IsQualifiedRightNow())
                    {
                        continue;
                    }

                    acts.Add(act);
                }
            }

            return(acts[TalesRandom.GenerateRandomNumber(acts.Count)]);
        }
示例#3
0
        private int GetModifierValue()
        {
            if (Numbers.Value.Contains("R "))
            {
                return(TalesRandom.GenerateRandomNumber(Numbers.RandomStart, Numbers.RandomEnd));
            }

            return(int.Parse(Numbers.Value));
        }
示例#4
0
        public bool ReadyToShowNewEvent()
        {
            var f = EventChanceBonus + new TimeContext().HourOfDay;

            TalesRandom.InitRandomNumber(Guid.NewGuid().GetHashCode());

            var diceRoll = TalesRandom.GenerateRandomNumber(100 + f);
            var result   = diceRoll > 100;

            if (result)
            {
                ResetEventChanceBonus();
            }
            GameData.Instance.GameContext.Events.EventChanceBonus++;

            return(result);
        }
示例#5
0
 private int GetModifierValue()
 {
     return(!string.IsNullOrEmpty(Value)
         ? int.Parse(Value)
         : TalesRandom.GenerateRandomNumber(RandomStart, RandomEnd));
 }