protected override bool Push() { if (mFail) { if (AllowGoToJail) { Manager.AddAlarm(new GoToJailScenario(Sim, Bail)); } } return(Situations.PushVisit(this, Sim, Target.LotHome)); }
protected override bool PrivateUpdate(ScenarioFrame frame) { if (Sim.CreatedSim.LotCurrent != Target.CreatedSim.LotCurrent) { if (!Situations.PushVisit(this, Target, Sim.CreatedSim.LotCurrent)) { return(false); } } return(base.PrivateUpdate(frame)); }
protected override bool Push() { if (mLot != null) { Situations.PushVisit(this, Sim, mLot); return(true); } else { return(false); } }
protected override bool Push() { Lot lot = Lots.GetCommunityLot(Sim.CreatedSim, null, true); if (lot == null) { return(false); } Sim.CreatedSim.InteractionQueue.CancelAutonomousInteractions(); return(Situations.PushVisit(this, Sim, lot)); }
protected override bool Push() { SimDescription injured = Target; SimDescription killer = Sim; if (mFail) { killer = null; if (AllowGoToJail) { Manager.AddAlarm(new GoToJailScenario(Sim, Bail)); injured = null; } else { injured = Sim; } } if ((AllowInjury) && (injured != null) && (injured.CreatedSim != null) && (injured.CreatedSim.LotCurrent == mVictim.LotCurrent)) { Handiness skill = injured.SkillManager.GetSkill <Handiness>(SkillNames.Handiness); if ((skill == null) || (RandomUtil.RandomChance01((skill.MaxSkillLevel - skill.SkillLevel) / (float)skill.MaxSkillLevel))) { if ((mVictim is Bathtub) || (mVictim is Shower) || (mVictim is Toilet) || (mVictim is Sink)) { ManagerSim.AddBuff(Manager, injured, BuffNames.Soaked, Origin.FromFailedRepair); Manager.AddAlarm(new GoToHospitalScenario(injured, killer, mVictim, "InjuredDrown", SimDescription.DeathType.Drown)); } else { ManagerSim.AddBuff(Manager, injured, BuffNames.SingedElectricity, Origin.FromFailedRepair); Manager.AddAlarm(new GoToHospitalScenario(injured, killer, mVictim, "InjuredElectrocute", SimDescription.DeathType.Electrocution)); } } } return(Situations.PushVisit(this, Sim, Target.LotHome)); }
protected override bool Push() { if (Sim.ChildOrAbove) { if (Target.ChildOrAbove) { return(Situations.PushMeetUp(this, Sim, Target, ManagerSituation.MeetUpType.Commercial, FirstAction)); } else { return(Situations.PushVisit(this, Sim, Target.LotHome)); } } else if (Target.ChildOrAbove) { return(Situations.PushVisit(this, Target, Sim.LotHome)); } else { return(false); } }
protected override bool Push() { if (House.IsActive) { return(false); } SimDescription head = SimTypes.HeadOfFamily(House); if (head == null) { return(false); } else { Household transfer = Household.Find(GetValue <TransferHouseholdOption, ulong>(House)); if (transfer.LotHome == null) { return(false); } return(Situations.PushVisit(this, head, transfer.LotHome)); } }
protected override bool PrivateUpdate(ScenarioFrame frame) { List <GameObject> burnables = new List <GameObject>(); foreach (Lot lot in ManagerLot.GetOwnedLots(Target)) { foreach (GameObject obj in lot.GetObjects <GameObject>()) { if (obj == null) { continue; } if (obj.GetFireType() == FireType.DoesNotBurn) { continue; } if (string.IsNullOrEmpty(obj.CatalogName)) { continue; } if (obj is Sim) { continue; } if (obj is ICrib) { continue; } if (obj.InUse) { continue; } if (!obj.InWorld) { continue; } if (obj.LotCurrent == null) { continue; } LotLocation loc = LotLocation.Invalid; ulong lotLocation = World.GetLotLocation(obj.PositionOnFloor, ref loc); if (!World.HasSolidFloor(obj.LotCurrent.mLotId, loc)) { continue; } burnables.Add(obj); } } if (burnables.Count == 0) { IncStat("No Burnables"); return(false); } GameObject victim = RandomUtil.GetRandomObjectFromList(burnables); if (!Situations.PushVisit(this, Sim, Target.LotHome)) { IncStat("Push Fail"); return(false); } mFail = IsFail(Sim, Target); if (mFail) { int cost = (int)(victim.Value * 1.5); Money.AdjustFunds(Sim, "Damages", -cost); Money.AdjustFunds(Target, "Insurance", cost); } Manager.AddAlarm(new BurnScenario(Sim, Target, victim, this, mFail)); return(true); }
protected override bool Push() { return(Situations.PushVisit(this, Sim, Target.LotHome)); }
protected override bool Push() { List <OccultTypes> occults = OccultTypeHelper.CreateList(Sim); if (occults.Count == 0) { return(false); } OccultTypes occult = RandomUtil.GetRandomObjectFromList(occults); List <CommercialLotSubType> types = new List <CommercialLotSubType>(); switch (occult) { case OccultTypes.Vampire: types.Add(CommercialLotSubType.kEP3_CocktailLoungeVampire); types.Add(CommercialLotSubType.kGraveyard); types.Add(CommercialLotSubType.kEP7_Mausoleum); break; case OccultTypes.Werewolf: types.Add(CommercialLotSubType.kEP7_WerewolfBar); types.Add(CommercialLotSubType.kBigPark); types.Add(CommercialLotSubType.kSmallPark); break; case OccultTypes.Witch: types.Add(CommercialLotSubType.kEP7_PotionShopConsignmentStore); types.Add(CommercialLotSubType.kEP7_VaultOfAntiquity); break; case OccultTypes.Fairy: types.Add(CommercialLotSubType.kEP7_Arboretum); types.Add(CommercialLotSubType.kBigPark); types.Add(CommercialLotSubType.kSmallPark); break; case OccultTypes.Mummy: types.Add(CommercialLotSubType.kEP1_ChineseGarden); types.Add(CommercialLotSubType.kEP1_LandmarkTomb); types.Add(CommercialLotSubType.kEP1_HiddenTomb); break; case OccultTypes.ImaginaryFriend: types.Add(CommercialLotSubType.kHangout); types.Add(CommercialLotSubType.kBigPark); types.Add(CommercialLotSubType.kSmallPark); break; } if (types.Count == 0) { return(false); } Lot lot = Lots.GetCommunityLot(Sim.CreatedSim, types, false); if (lot == null) { return(false); } return(Situations.PushVisit(this, Sim, lot)); }
protected override bool Push() { return(Situations.PushVisit(this, Target, Lots.GetCommunityLot(Target.CreatedSim, null, false))); }
protected override bool PrivateUpdate(ScenarioFrame frame) { mPushes++; if (Sim.CreatedSim == null) { IncStat("Hibernating"); return false; } else if (Sim.CreatedSim.InteractionQueue == null) { IncStat("No Queue"); return false; } if (mPushes <= 1) { Sim.CreatedSim.InteractionQueue.CancelAllInteractions(); } bool maxSkill = true; List<SkillNames> practiceSkills = new List<SkillNames>(); RidingSkill riding = Sim.SkillManager.GetSkill<RidingSkill>(SkillNames.Riding); if ((riding == null) || (!riding.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Riding); } Racing racing = mHorse.SkillManager.GetSkill<Racing>(SkillNames.Racing); if ((racing == null) || (!racing.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Racing); } Jumping jumping = mHorse.SkillManager.GetSkill<Jumping>(SkillNames.Jumping); if ((jumping == null) || (!jumping.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Jumping); } List<EquestrianCenter> lotCenters = new List<EquestrianCenter>(); List<EquestrianCenter> centers = new List<EquestrianCenter>(); foreach (EquestrianCenter hole in Sims3.Gameplay.Queries.GetObjects<EquestrianCenter>()) { if (Sim.CreatedSim.LotCurrent == hole.LotCurrent) { lotCenters.Add(hole); } centers.Add(hole); } if (lotCenters.Count > 0) { centers = lotCenters; } EquestrianCenter center = null; if (centers.Count > 0) { center = RandomUtil.GetRandomObjectFromList(centers); } else { IncStat("No Centers"); } if (center != null) { CompetitionType type = CompetitionType.Racing; bool canCompete = (maxSkill) || (RandomUtil.CoinFlip()); if (canCompete) { List<CompetitionType> types = new List<CompetitionType>(sTypes); while (types.Count > 0) { type = RandomUtil.GetRandomObjectFromList(types); types.Remove(type); canCompete = false; switch (type) { case CompetitionType.CrossCountry: if (RidingSkill.CanEnterCrossCountryCompetition(Sim)) { canCompete = true; } break; case CompetitionType.Jumping: if (!RidingSkill.CanEnterJumpingCompetition(Sim)) { canCompete = true; } break; case CompetitionType.Racing: if (!RidingSkill.CanEnterRacingCompetition(Sim)) { canCompete = true; } break; } if (canCompete) { break; } } } if (canCompete) { List<CompetitionLevel> levels = new List<CompetitionLevel>(); foreach (CompetitionLevel level in sLevels) { GreyedOutTooltipCallback callback = null; if (EquestrianCenter.EnterEquestrianCompetition.CanEnterCompetition(type, level, Sim.CreatedSim, false, ref callback)) { levels.Add(level); } } if (levels.Count == 0) { IncStat("No Levels"); } else { CompetitionLevel level = RandomUtil.GetRandomObjectFromList(levels); if (Common.kDebugging) { Common.DebugNotify("Compete " + type + " " + level, Sim.CreatedSim); } if (!Situations.PushVisit(this, Sim, center.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<EquestrianCenter>(this, Sim, center, new EnterEquestrianCompetitionEx.Definition(type, level))) { return true; } else { IncStat("Competition Fail"); } } } } if (practiceSkills.Count == 0) { IncStat("No Practice Skills"); return false; } bool practiceJumping = true; if ((riding != null) & (riding.SkillLevel >= RidingSkill.kLevelForTrainForRacing)) { switch (RandomUtil.GetRandomObjectFromList(practiceSkills)) { case SkillNames.Riding: practiceJumping = RandomUtil.CoinFlip(); break; case SkillNames.Racing: practiceJumping = false; break; } } if (!practiceJumping) { List<TrainingPosts> lotPosts = new List<TrainingPosts>(); List<TrainingPosts> posts = new List<TrainingPosts>(); foreach(TrainingPosts post in Sims3.Gameplay.Queries.GetObjects<TrainingPosts>()) { if (Sim.CreatedSim.LotCurrent == post.LotCurrent) { lotPosts.Add(post); } posts.Add(post); } if (lotPosts.Count > 0) { posts = lotPosts; } if (posts.Count > 0) { TrainingPosts choice = RandomUtil.GetRandomObjectFromList(posts); if (!Situations.PushVisit(this, Sim, choice.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<TrainingPosts>(this, Sim, choice, new ManagerSituation.WithCallbackPush(Manager, TrainingPosts.RiderTrainForRacing.Singleton, null, null, new MountScenario(Sim, mPushes)))) { return true; } else { IncStat("Traning Fail"); } } } int ridingSkill = 0; if (riding != null) { ridingSkill = riding.SkillLevel; } List<HorseJump> lotJumps = new List<HorseJump>(); List<HorseJump> jumps = new List<HorseJump>(); foreach (HorseJump jump in Sims3.Gameplay.Queries.GetObjects<HorseJump>()) { if (jump.LotCurrent == null) continue; if (!jump.LotCurrent.IsCommunityLot) { if (!jump.LotCurrent.CanSimTreatAsHome(Sim.CreatedSim)) continue; } if (jump.JumpTuning == null) continue; if (jump.JumpTuning.HighSuccessChances[ridingSkill] < 0.75) continue; if (Sim.CreatedSim.LotCurrent == jump.LotCurrent) { lotJumps.Add(jump); } jumps.Add(jump); } if (lotJumps.Count > 0) { jumps = lotJumps; } if (jumps.Count > 0) { HorseJump choice = RandomUtil.GetRandomObjectFromList(jumps); if (!Situations.PushVisit(this, Sim, choice.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<HorseJump>(this, Sim, choice, new ManagerSituation.WithCallbackPush(Manager, HorseJump.Jump.Singleton, null, null, new MountScenario(Sim, mPushes)))) { return true; } else { IncStat("Jump Fail"); return false; } } else { IncStat("No Jump Choices"); return false; } }
protected override bool Push() { Situations.PushVisit(this, Sim, Lots.GetCommunityLot(Sim.CreatedSim, null, false)); return(true); }
protected override bool PrivateUpdate(ScenarioFrame frame) { base.PrivateUpdate(frame); if (sSkills == null) { sSkills = new Dictionary <Sims3.Gameplay.Skills.SkillNames, InteractionDefinition>(); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Guitar, GuitarPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.BassGuitar, BassGuitarPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Piano, PianoPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Drums, DrumsPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.LaserHarp, LaserHarpPlayForTips.Singleton); } List <Sims3.Gameplay.Skills.SkillNames> choices = new List <Sims3.Gameplay.Skills.SkillNames>(); SimData data = Options.GetSim(Sim); foreach (Sims3.Gameplay.Skills.SkillNames skill in sSkills.Keys) { if (!Skills.AllowSkill(this, Sim, data, skill)) { continue; } choices.Add(skill); } if (choices.Count == 0) { IncStat("No Choices"); return(false); } BandInstrument instrument = null; InteractionDefinition definition = null; RandomUtil.RandomizeListOfObjects(choices); foreach (Sims3.Gameplay.Skills.SkillNames skill in choices) { switch (skill) { case Sims3.Gameplay.Skills.SkillNames.Guitar: instrument = Inventories.InventoryFind <Guitar>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <Guitar> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.BassGuitar: instrument = Inventories.InventoryFind <BassGuitar>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <BassGuitar> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.Piano: instrument = Inventories.InventoryFind <Piano>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <Piano> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.Drums: instrument = Inventories.InventoryFind <Drums>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <Drums> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.LaserHarp: instrument = Inventories.InventoryFind <LaserHarp>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <LaserHarp> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; } if (instrument != null) { definition = sSkills[skill]; break; } } if (instrument == null) { IncStat("No Instrument"); return(false); } Lot lot = Sim.CreatedSim.LotCurrent; if ((Sim.LotHome == lot) || (lot.IsWorldLot) || (lot.IsResidentialLot)) { if (!Situations.PushVisit(this, Sim, Lots.GetCommunityLot(Sim.CreatedSim, null, true))) { IncStat("Push Lot Fail"); return(false); } } return(Situations.PushInteraction(this, Sim, instrument, definition)); }
protected override bool PrivateUpdate(ScenarioFrame frame) { if (!mSuccess.TestBeforehand(Manager, Sim, Target)) { IncStat("Success TestBeforehand Fail"); return(false); } if (!mFailure.TestBeforehand(Manager, Sim, Target)) { IncStat("Failure TestBeforehand Fail"); return(false); } mFail = false; if (!string.IsNullOrEmpty(mSneakinessScoring)) { foreach (SimDescription member in CommonSpace.Helpers.Households.All(Target.Household)) { if (AddScoring("Target Sneak", ScoringLookup.GetScore(mSneakinessScoring, member)) > AddScoring("Sim Sneak", ScoringLookup.GetScore(mSneakinessScoring, Sim))) { mFail = true; break; } } } if (!base.PrivateUpdate(frame)) { return(false); } if (mFail) { if (!Situations.PushVisit(this, Sim, Target.LotHome)) { IncStat("Push Fail"); return(false); } mFailure.Perform(this, frame, "Failure", Sim, Target); return(true); } else { List <Origin> types = new List <Origin>(sTypes); while (types.Count > 0) { Origin type = RandomUtil.GetRandomObjectFromList(types); types.Remove(type); IncStat("Try " + type); GameObject boobyTrap = null; switch (type) { case Origin.FromPrankDoorbellDitch: if (!mAllowDoorPranks) { continue; } if (Situations.PushInteraction(this, Sim, Target.LotHome, Door.PrankDoorbellDitch.Singleton)) { return(true); } break; case Origin.FromPrankFlamingBag: if (!mAllowDoorPranks) { continue; } if (Situations.PushInteraction(this, Sim, Target.LotHome, Door.PrankFlamingBag.Singleton)) { return(true); } break; case Origin.FromPrankThrowingEggs: if (!mAllowDoorPranks) { continue; } if (Situations.PushInteraction(this, Sim, Target.LotHome, Door.PrankThrowingEggs.Singleton)) { return(true); } break; case Origin.FromPrankToilet: Toilet[] toilets = Target.LotHome.GetObjects <Toilet>(); if (toilets.Length > 0) { boobyTrap = RandomUtil.GetRandomObjectFromList(toilets); } break; case Origin.FromPrankSink: Sink[] sinks = Target.LotHome.GetObjects <Sink>(); if (sinks.Length > 0) { boobyTrap = RandomUtil.GetRandomObjectFromList(sinks); } break; case Origin.FromPrankShower: Shower[] showers = Target.LotHome.GetObjects <Shower>(); if (showers.Length > 0) { boobyTrap = RandomUtil.GetRandomObjectFromList(showers); } break; case Origin.FromPrankWhoopeeCushion: ChairDining[] chairs = Target.LotHome.GetObjects <ChairDining>(); if (chairs.Length > 0) { boobyTrap = RandomUtil.GetRandomObjectFromList(chairs); } break; case Origin.FromPrankComputer: Computer[] computers = Target.LotHome.GetObjects <Computer>(); if (computers.Length > 0) { if (Situations.PushInteraction(this, Sim, RandomUtil.GetRandomObjectFromList(computers), Computer.SetBoobyTrap.Singleton)) { mSuccess.Perform(this, frame, "Success", Sim, Target); return(true); } } break; } if (boobyTrap != null) { if (Situations.PushInteraction(this, Sim, boobyTrap, SetBoobyTrap.Singleton)) { mSuccess.Perform(this, frame, "Success", Sim, Target); return(true); } } } IncStat("No Choices"); return(false); } }