public Event(int id, Peril peril, Region region, int eventLoss) { Id = id; Peril = peril; Region = region; EventLoss = eventLoss; }
public void RaisePeril(PerilData.PerilType type) { List <string> list = new List <string>(); foreach (KeyValuePair <string, PerilData> kv in game.cd.perils) { if (kv.Value.pType == type) { Peril p = new Peril(kv.Key); if (!p.Disabled()) { list.Add(kv.Key); } } } QueueEvent(list[Random.Range(0, list.Count)]); }
// Queue a peril event of a type public void RaisePeril(PerilData.PerilType type) { List <string> list = new List <string>(); // Find all matching perils foreach (KeyValuePair <string, PerilData> kv in game.cd.perils) { if (kv.Value.pType == type) { Peril p = new Peril(kv.Key); // If peril is valid add to list if (!p.Disabled()) { list.Add(kv.Key); } } } // Queue a random valid peril QueueEvent(list[Random.Range(0, list.Count)]); }
public string ToLongString() { return($"Event {Id}: {Peril.ToString()} in {Location.ToString()} with Total Loss={TotalLoss}."); }
private List <int> GetCorrespondingDealsForAPeril(Peril peril) { return(Deals.Where(d => d.Perils.Contains(peril)).Select(deal => deal.DealId).ToList()); }