protected RemountScenario(RemountScenario scenario) : base(scenario) { mHorse = scenario.mHorse; mMountAttempts = scenario.mMountAttempts; }
public static bool Perform(StoryProgressionObject manager, IScoringGenerator stats, SimDescription sim, Sim horse, RemountScenario remount) { if (ManagerSituation.HasInteraction(sim, Sims3.Gameplay.Actors.Sim.Mount.Singleton)) return false; return manager.Situations.PushInteraction<Sim>(stats, sim, horse, new ManagerSituation.WithCallbackPush(manager, Sims3.Gameplay.Actors.Sim.Mount.Singleton, null, null, remount)); }
protected override bool PrivateUpdate(ScenarioFrame frame) { if (Sim.CreatedSim == null) return false; if (Sim.CreatedSim.Posture == null) return false; Sim horseSim = Sim.CreatedSim.Posture.Container as Sim; if ((horseSim == null) || (!horseSim.IsHorse)) { bool horseFound = false; List<SimDescription> lotHorses = new List<SimDescription>(); List<SimDescription> horses = new List<SimDescription>(); foreach (SimDescription sim in HouseholdsEx.Pets(Sim.Household)) { if (!sim.IsHorse) continue; if (sim.SkillManager == null) continue; horseFound = true; if (sim.CreatedSim == null) continue; if (sim.ChildOrBelow) continue; if (sim.IsPregnant) continue; if (ManagerSim.GetLTR(sim, Sim) < 0) continue; if (sim.CreatedSim.LotCurrent == Sim.CreatedSim.LotCurrent) { lotHorses.Add(sim); } horses.Add(sim); } if (horses.Count == 0) { IncStat("No Horse"); if (!horseFound) { bool found = false; foreach (Lot lot in ManagerLot.GetOwnedLots(Sim)) { if (lot.GetObjects<IBoxStall>().Length > 0) { found = true; break; } } if (!found) { IncStat("No Stalls"); return false; } Add(frame, new PetAdoptionScenario(CASAgeGenderFlags.Horse, Sim), ScenarioResult.Start); } return false; } if (lotHorses.Count > 0) { horses = lotHorses; } AddStat("Horses", horses.Count); while (horses.Count > 0) { SimDescription horseChoice = RandomUtil.GetRandomObjectFromList(horses); horses.Remove(horseChoice); float num = horseChoice.HasTrait(TraitNames.UntrainedHorse) ? TraitTuning.UntrainedHorseSaddleLtrThreshold : RidingSkill.kMinLtrForMountAccept; if (ManagerSim.GetLTR(horseChoice, Sim) < num) { Add(frame, new ExistingFriendScenario(horseChoice, Sim, false), ScenarioResult.Start); IncStat("Friend Building"); return false; } horseSim = horseChoice.CreatedSim; if (RemountScenario.Perform(Manager, this, Sim, horseSim, new RemountScenario(Sim, horseSim))) { break; } horseSim = null; } if (horseSim == null) { IncStat("Mount Fail"); return false; } Skills.AddListener(new HorseMountedScenario(Sim, horseSim, mPushes)); IncStat("AddListener"); } else { Add(frame, new HorseMountedScenario(Sim, horseSim, mPushes), ScenarioResult.Start); } return true; }