public override void Perform(Sim sim, DiseaseVector vector) { if (SimTypes.IsDead(sim.SimDescription)) { return; } if (!mAllowActive) { if (SimTypes.IsSelectable(sim)) { return; } } if (sim.InteractionQueue == null) { return; } SimDescription.DeathType type = mType; if (type == SimDescription.DeathType.None) { List <SimDescription.DeathType> choices = new List <SimDescription.DeathType>(); foreach (SimDescription.DeathType choice in Enum.GetValues(typeof(SimDescription.DeathType))) { if (!OccultTypeHelper.IsInstalled(choice)) { continue; } choices.Add(choice); } if (choices.Count == 0) { return; } type = RandomUtil.GetRandomObjectFromList(choices); } InteractionInstance entry = Urnstone.KillSim.Singleton.CreateInstance(sim, sim, new InteractionPriority(InteractionPriorityLevel.MaxDeath, 0f), false, false); (entry as Urnstone.KillSim).simDeathType = type; sim.InteractionQueue.Add(entry); }
protected override bool Allow(GameHitParameters <GameObject> parameters) { return(OccultTypeHelper.IsInstalled(Type)); }
protected override bool Run(SimDescription me, bool singleSelection) { if (!ApplyAll) { List <SelectionCriteria.Occult.Item> allOptions = new List <SelectionCriteria.Occult.Item>(); foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes))) { if (!OccultTypeHelper.IsInstalled(type)) { continue; } if (type == OccultTypes.None) { continue; } if (type == OccultTypes.Ghost) { if (!IncludeGhostOccult) { continue; } } SelectionCriteria.Occult.Item item = new SelectionCriteria.Occult.Item(type, SimDescription.DeathType.None, 0, "Boolean"); if (item.Test(me, false, me)) { item.IncCount(); } allOptions.Add(item); } if (!IncludeGhostOccult) { foreach (SimDescription.DeathType type in Enum.GetValues(typeof(SimDescription.DeathType))) { if (type == SimDescription.DeathType.None) { continue; } SelectionCriteria.Occult.Item item = new SelectionCriteria.Occult.Item(OccultTypes.None, type, 0, "Boolean"); if (item.Test(me, false, me)) { item.IncCount(); } allOptions.Add(item); } } CommonSelection <SelectionCriteria.Occult.Item> .Results choices = new CommonSelection <SelectionCriteria.Occult.Item>(Name, me.FullName, allOptions).SelectMultiple(); if ((choices == null) || (choices.Count == 0)) { return(false); } mTypes.Clear(); foreach (SelectionCriteria.Occult.Item item in choices) { mTypes.Add(item.Value); } } return(true); }