public override void Perform(SimDescription sim, OccultBaseClass sourceParam) { OccultFairy occult = sim.OccultManager.GetOccultType(sourceParam.ClassOccultType) as OccultFairy; OccultFairy source = sourceParam as OccultFairy; occult.mBloomingsPerformed = source.mBloomingsPerformed; occult.mGiftsBestowed = source.mGiftsBestowed; occult.mObjectsBoobyTrapped = source.mObjectsBoobyTrapped; occult.mSimsTricked = source.mSimsTricked; }
public static void ShowHumanAndHideTrueForm(OccultFairy ths) { string msg = null; try { SimRoutingComponent simRoutingComponent = ths.mOwningSim.SimRoutingComponent; if (simRoutingComponent != null) { simRoutingComponent.EnableDynamicFootprint(); } ths.mOwningSim.SetHiddenFlags(HiddenFlags.Nothing); msg += "A"; // Custom if (ths.mWings != null) { ths.mWings.Start(); } else { ths.GrantWings(); } msg += "B"; if (ths.mOwningSim.TraitManager.HasElement(TraitNames.FairyQueen)) { ths.AddHoveringFairies(); } msg += "C"; if (ths.mOwningSim.IsActiveSim) { PlumbBob.ShowPlumbBob(); } msg += "D"; if (ths.mVfxTrueFairyForm != null) { ths.mVfxTrueFairyForm.Stop(); } msg += "E"; ths.CleanupFairyTrueFormFx(); } catch (Exception e) { Common.Exception(ths.mOwningSim, null, msg, e); } }
protected static Vector3 GetWingColor(SimDescription sim, out bool success) { success = false; OccultFairy occultType = sim.OccultManager.GetOccultType(OccultTypes.Fairy) as OccultFairy; if (occultType != null) { CASFairyData fairyData = occultType.FairyData; if (fairyData != null) { success = true; return(fairyData.WingColor); } } return(new Vector3()); }
protected void BlendWings(List <SimDescription> parents) { try { int wingRate = GetValue <BlendFairyWingsOption, int>(); if (wingRate > 0) { OccultFairy occultType = Sim.OccultManager.GetOccultType(OccultTypes.Fairy) as OccultFairy; if (occultType != null) { CASFairyData fairyData = occultType.FairyData; if (fairyData != null) { List <Vector3> parentColors = new List <Vector3>(); foreach (SimDescription parent in parents) { bool success; Vector3 color = GetWingColor(parent, out success); if (success) { IncStat("Wing Color: " + color); parentColors.Add(color); } } if (parentColors.Count >= 2) { RandomUtil.RandomizeListOfObjects(parentColors); Vector3 ahsv = CompositorUtil.ColorShifter.ColorToHsv(parentColors[0]); Vector3 bhsv = CompositorUtil.ColorShifter.ColorToHsv(parentColors[1]); IncStat("Wing ChoiceA: " + ahsv); IncStat("Wing ChoiceB: " + bhsv); Vector3 resultHSV = new Vector3(); resultHSV.y = RandomUtil.CoinFlip() ? ahsv.y : bhsv.y; resultHSV.z = RandomUtil.CoinFlip() ? ahsv.z : bhsv.z; float difference = (ahsv.x - bhsv.x) * RandomUtil.GetFloat(wingRate / 100f); if (difference == 0) { difference = RandomUtil.GetFloat(GetValue <BlendFairyWingsMutateOption, int>() / 100f); difference = Math.Max(0, Math.Min(1f, difference)); } AddStat("Wing Difference", difference); float min = ahsv.x; float max = bhsv.x; if (ahsv.x > bhsv.x) { min = bhsv.x; max = ahsv.x; } if (RandomUtil.CoinFlip()) { resultHSV.x = min + difference; } else { resultHSV.x = max - difference; } IncStat("Wing Result: " + resultHSV); fairyData.WingColor = CompositorUtil.ColorShifter.HsvToColor(resultHSV); } } } } } catch (Exception e) { Common.Exception(Sim, e); } }
// From OccultManager protected static bool AddOccultType(OccultManager ths, OccultTypes type, bool addOutfit, bool isReward, bool fromRestore, OccultBaseClass overrideOccultToAdd) { OccultBaseClass newOccult = null; OccultBaseClass oldOccult = ths.VerifyOccultList(type); if (overrideOccultToAdd != null) { newOccult = overrideOccultToAdd; } else { switch (type) { case OccultTypes.Mummy: newOccult = new OccultMummy(); break; case OccultTypes.Frankenstein: newOccult = new OccultFrankenstein(); break; case OccultTypes.Vampire: newOccult = new OccultVampire(); break; case OccultTypes.ImaginaryFriend: OccultImaginaryFriend oldImFr = oldOccult as OccultImaginaryFriend; if (oldImFr == null) { newOccult = new OccultImaginaryFriend(); } else { newOccult = new OccultImaginaryFriend(oldImFr); } break; case OccultTypes.Unicorn: newOccult = new OccultUnicorn(); break; case OccultTypes.Fairy: newOccult = new OccultFairy(); break; case OccultTypes.Witch: newOccult = new OccultWitch(); break; case OccultTypes.Genie: newOccult = new OccultGenie(); break; case OccultTypes.Werewolf: newOccult = new OccultWerewolf(); break; case OccultTypes.PlantSim: newOccult = new OccultPlantSim(); break; case OccultTypes.Mermaid: newOccult = new OccultMermaid(); break; case OccultTypes.TimeTraveler: newOccult = new OccultTimeTraveler(); break; case OccultTypes.Robot: newOccult = new OccultRobot(); break; } } if (newOccult == null) { return false; } OccultTypes originalTypes = ths.mCurrentOccultTypes; Role assignedRole = ths.mOwnerDescription.AssignedRole; float alienDNAPercentage = ths.mOwnerDescription.AlienDNAPercentage; try { ths.mCurrentOccultTypes = OccultTypes.None; ths.mOwnerDescription.AssignedRole = null; ths.mOwnerDescription.mAlienDNAPercentage = 0f; if (!newOccult.CanAdd(ths.mOwnerDescription, fromRestore)) { return false; } } finally { ths.mCurrentOccultTypes = originalTypes; ths.mOwnerDescription.AssignedRole = assignedRole; ths.mOwnerDescription.mAlienDNAPercentage = alienDNAPercentage; } if ((ths.mOwnerDescription.SupernaturalData == null) || ((type == OccultTypes.Fairy) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Fairy)) || ((type == OccultTypes.Robot) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Robot)) || ((type == OccultTypes.PlantSim) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.PlantSim))) { ths.mOwnerDescription.AddSupernaturalData(type); } ths.mIsLifetimeReward = isReward; if (type == OccultTypes.Genie) { // Corrections for improper handling of the special outfits by OccultGenie if (ths.mOwnerDescription.mSpecialOutfitIndices == null) { ths.mOwnerDescription.mSpecialOutfitIndices = new Dictionary<uint, int>(); } addOutfit = false; } if (type == OccultTypes.Unicorn) { OccultUnicornEx.OnAddition(newOccult as OccultUnicorn, ths.mOwnerDescription, addOutfit); } ApplyTrait(ths.mOwnerDescription, type); MidlifeCrisisManager midlifeCrisisManager = ths.mOwnerDescription.MidlifeCrisisManager; try { // Inactive mummies don't agree with mid-life crisis managers ths.mOwnerDescription.MidlifeCrisisManager = null; newOccult.OnAddition(ths.mOwnerDescription, addOutfit, ths.mIsLifetimeReward, fromRestore); } finally { ths.mOwnerDescription.MidlifeCrisisManager = midlifeCrisisManager; } ths.mOccultList.Add(newOccult); ths.mCurrentOccultTypes |= type; EventTracker.SendEvent(new BeAnOccultEvent(EventTypeId.kBeAnOccult, ths.mOwnerDescription.CreatedSim, (uint)type)); if (ths.mOwnerDescription.CreatedSim != null) { if (!Cane.IsAllowedToUseCane(ths.mOwnerDescription.CreatedSim)) { Cane.StopUsingAnyActiveCanes(ths.mOwnerDescription.CreatedSim); } if (!Backpack.IsAllowedToUseBackpack(ths.mOwnerDescription.CreatedSim)) { Backpack.StopUsingAnyActiveBackpacks(ths.mOwnerDescription.CreatedSim); } if (!Jetpack.IsAllowedToUseJetpack(ths.mOwnerDescription.CreatedSim)) { Jetpack.StopUsingAnyActiveJetpacks(ths.mOwnerDescription.CreatedSim); } } (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimDaysPerAgingYearChanged(); ths.ClearOneShot(); ths.UpdateOccultUI(); if (!fromRestore) { EventTracker.SendEvent(EventTypeId.kBecameOccult, ths.mOwnerDescription.CreatedSim); } if (oldOccult != null) { newOccult.MergeOccultData(oldOccult); } if (ths.mOwnerDescription.CreatedSim != null) { Sim.StandingPosture standing = ths.mOwnerDescription.CreatedSim.Standing as Sim.StandingPosture; if (standing != null) { standing.SetDefaultIdleAnim(); } } return true; }
// From OccultManager protected static bool AddOccultType(OccultManager ths, OccultTypes type, bool addOutfit, bool isReward, bool fromRestore, OccultBaseClass overrideOccultToAdd) { OccultBaseClass newOccult = null; OccultBaseClass oldOccult = ths.VerifyOccultList(type); if (overrideOccultToAdd != null) { newOccult = overrideOccultToAdd; } else { switch (type) { case OccultTypes.Mummy: newOccult = new OccultMummy(); break; case OccultTypes.Frankenstein: newOccult = new OccultFrankenstein(); break; case OccultTypes.Vampire: newOccult = new OccultVampire(); break; case OccultTypes.ImaginaryFriend: OccultImaginaryFriend oldImFr = oldOccult as OccultImaginaryFriend; if (oldImFr == null) { newOccult = new OccultImaginaryFriend(); } else { newOccult = new OccultImaginaryFriend(oldImFr); } break; case OccultTypes.Unicorn: newOccult = new OccultUnicorn(); break; case OccultTypes.Fairy: newOccult = new OccultFairy(); break; case OccultTypes.Witch: newOccult = new OccultWitch(); break; case OccultTypes.Genie: newOccult = new OccultGenie(); break; case OccultTypes.Werewolf: newOccult = new OccultWerewolf(); break; case OccultTypes.PlantSim: newOccult = new OccultPlantSim(); break; case OccultTypes.Mermaid: newOccult = new OccultMermaid(); break; case OccultTypes.TimeTraveler: newOccult = new OccultTimeTraveler(); break; case OccultTypes.Robot: newOccult = new OccultRobot(); break; } } if (newOccult == null) { return(false); } OccultTypes originalTypes = ths.mCurrentOccultTypes; Role assignedRole = ths.mOwnerDescription.AssignedRole; float alienDNAPercentage = ths.mOwnerDescription.AlienDNAPercentage; try { ths.mCurrentOccultTypes = OccultTypes.None; ths.mOwnerDescription.AssignedRole = null; ths.mOwnerDescription.mAlienDNAPercentage = 0f; if (!newOccult.CanAdd(ths.mOwnerDescription, fromRestore)) { return(false); } } finally { ths.mCurrentOccultTypes = originalTypes; ths.mOwnerDescription.AssignedRole = assignedRole; ths.mOwnerDescription.mAlienDNAPercentage = alienDNAPercentage; } if ((ths.mOwnerDescription.SupernaturalData == null) || ((type == OccultTypes.Fairy) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Fairy)) || ((type == OccultTypes.Robot) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Robot)) || ((type == OccultTypes.PlantSim) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.PlantSim))) { ths.mOwnerDescription.AddSupernaturalData(type); } ths.mIsLifetimeReward = isReward; if (type == OccultTypes.Genie) { // Corrections for improper handling of the special outfits by OccultGenie if (ths.mOwnerDescription.mSpecialOutfitIndices == null) { ths.mOwnerDescription.mSpecialOutfitIndices = new Dictionary <uint, int>(); } addOutfit = false; } if (type == OccultTypes.Unicorn) { OccultUnicornEx.OnAddition(newOccult as OccultUnicorn, ths.mOwnerDescription, addOutfit); } ApplyTrait(ths.mOwnerDescription, type); MidlifeCrisisManager midlifeCrisisManager = ths.mOwnerDescription.MidlifeCrisisManager; try { // Inactive mummies don't agree with mid-life crisis managers ths.mOwnerDescription.MidlifeCrisisManager = null; newOccult.OnAddition(ths.mOwnerDescription, addOutfit, ths.mIsLifetimeReward, fromRestore); } finally { ths.mOwnerDescription.MidlifeCrisisManager = midlifeCrisisManager; } ths.mOccultList.Add(newOccult); ths.mCurrentOccultTypes |= type; EventTracker.SendEvent(new BeAnOccultEvent(EventTypeId.kBeAnOccult, ths.mOwnerDescription.CreatedSim, (uint)type)); if (ths.mOwnerDescription.CreatedSim != null) { if (!Cane.IsAllowedToUseCane(ths.mOwnerDescription.CreatedSim)) { Cane.StopUsingAnyActiveCanes(ths.mOwnerDescription.CreatedSim); } if (!Backpack.IsAllowedToUseBackpack(ths.mOwnerDescription.CreatedSim)) { Backpack.StopUsingAnyActiveBackpacks(ths.mOwnerDescription.CreatedSim); } if (!Jetpack.IsAllowedToUseJetpack(ths.mOwnerDescription.CreatedSim)) { Jetpack.StopUsingAnyActiveJetpacks(ths.mOwnerDescription.CreatedSim); } } (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimDaysPerAgingYearChanged(); ths.ClearOneShot(); ths.UpdateOccultUI(); if (!fromRestore) { EventTracker.SendEvent(EventTypeId.kBecameOccult, ths.mOwnerDescription.CreatedSim); } if (oldOccult != null) { newOccult.MergeOccultData(oldOccult); } if (ths.mOwnerDescription.CreatedSim != null) { Sim.StandingPosture standing = ths.mOwnerDescription.CreatedSim.Standing as Sim.StandingPosture; if (standing != null) { standing.SetDefaultIdleAnim(); } } return(true); }