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); }
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)]); }
private int GetModifierValue() { if (Numbers.Value.Contains("R ")) { return(TalesRandom.GenerateRandomNumber(Numbers.RandomStart, Numbers.RandomEnd)); } return(int.Parse(Numbers.Value)); }
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); }
private int GetModifierValue() { return(!string.IsNullOrEmpty(Value) ? int.Parse(Value) : TalesRandom.GenerateRandomNumber(RandomStart, RandomEnd)); }