예제 #1
0
            public override bool Test(Sim actor, WeatherStone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!mIsJoin)
                {
                    if (!CommonTest(target, actor, mType, ref greyedOutTooltipCallback, isAutonomous))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!target.IsSummoning)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Not Summoning");
                        return(false);
                    }
                    else if (target.mSummonWeatherType != mType)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Not Correct Type");
                        return(false);
                    }
                    else if (target.mSummoningSimDescriptionId == actor.SimDescription.SimDescriptionId)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Is Summoner");
                        return(false);
                    }
                }

                return(true);
            }
예제 #2
0
        public static bool CommonTest(WeatherStone ths, Sim actor, WeatherStone.SummonWeatherType type, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool isAutonomous)
        {
            if (!isAutonomous)
            {
                switch (ths.CurrentWeatherStoneState)
                {
                case WeatherStone.WeatherStoneState.ReadyForSummoning:
                    return(true);

                case WeatherStone.WeatherStoneState.SummoningWeather:
                    if (type == ths.mSummonWeatherType)
                    {
                        return(true);
                    }

                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WeatherStone.LocalizeString(actor.IsFemale, "TryingToSummonTooltip", new object[0]));
                    break;

                case WeatherStone.WeatherStoneState.AfterSuccessfulSummon:
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WeatherStone.LocalizeString(actor.IsFemale, "StoneCurrentSummoningWeatherTooltip", new object[0]));
                    break;

                case WeatherStone.WeatherStoneState.AfterFailureSummon:
                case WeatherStone.WeatherStoneState.Resting:
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WeatherStone.LocalizeString(actor.IsFemale, "StoneRestingTooltip", new object[0]));
                    break;
                }
            }

            return(false);
        }
예제 #3
0
            public override bool Test(Sim actor, WeatherStone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!SummonWeatherEx.CommonTest(target, actor, mType, ref greyedOutTooltipCallback, isAutonomous))
                {
                    return(false);
                }

                return(HasValidCandidates(actor.LotCurrent, actor, mType));
            }
예제 #4
0
 public override string GetInteractionName(Sim actor, WeatherStone target, InteractionObjectPair iop)
 {
     return WeatherStone.LocalizeString(actor.IsFemale, mIsJoin ? "JoinSummonWeatherInteractionName" : "SummonWeatherInteractionName", new object[] { WeatherStone.LocalizeString(actor.IsFemale, mType.ToString(), new object[0]) });
 }
예제 #5
0
 public Definition(WeatherStone.SummonWeatherType type)
 {
     mType = type;
 }
예제 #6
0
        public static bool CommonTest(WeatherStone ths, Sim actor, WeatherStone.SummonWeatherType type, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool isAutonomous)
        {
            if (!isAutonomous)
            {
                switch (ths.CurrentWeatherStoneState)
                {
                    case WeatherStone.WeatherStoneState.ReadyForSummoning:
                        return true;
                    case WeatherStone.WeatherStoneState.SummoningWeather:
                        if (type == ths.mSummonWeatherType) return true;

                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WeatherStone.LocalizeString(actor.IsFemale, "TryingToSummonTooltip", new object[0]));
                        break;

                    case WeatherStone.WeatherStoneState.AfterSuccessfulSummon:
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WeatherStone.LocalizeString(actor.IsFemale, "StoneCurrentSummoningWeatherTooltip", new object[0]));
                        break;

                    case WeatherStone.WeatherStoneState.AfterFailureSummon:
                    case WeatherStone.WeatherStoneState.Resting:
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WeatherStone.LocalizeString(actor.IsFemale, "StoneRestingTooltip", new object[0]));
                        break;
                }
            }

            return false;
        }
예제 #7
0
 public override void AddInteractions(InteractionObjectPair iop, Sim actor, WeatherStone target, List <InteractionObjectPair> results)
 {
     foreach (WeatherStone.SummonWeatherType type in SummonWeatherEx.GetSummonWeatherTypeForSim(actor.SimDescription))
     {
         results.Add(new InteractionObjectPair(new Definition(type), target));
     }
 }
예제 #8
0
            public override string GetInteractionName(Sim actor, WeatherStone target, InteractionObjectPair iop)
            {
                bool isFemale = actor.IsFemale;

                return(WeatherStone.LocalizeString(isFemale, "SummonWeatherWithInteractionName", new object[] { WeatherStone.LocalizeString(isFemale, mType.ToString(), new object[0]) }));
            }
예제 #9
0
 private static bool HasValidCandidates(Lot lot, Sim actor, WeatherStone.SummonWeatherType type)
 {
     return lot.DoesSimExist(delegate(Sim s)
     {
         return (s != actor) && IsValidCandidate(s, actor, type);
     });
 }
예제 #10
0
 public override string GetInteractionName(Sim actor, WeatherStone target, InteractionObjectPair iop)
 {
     return(WeatherStone.LocalizeString(actor.IsFemale, mIsJoin ? "JoinSummonWeatherInteractionName" : "SummonWeatherInteractionName", new object[] { WeatherStone.LocalizeString(actor.IsFemale, mType.ToString(), new object[0]) }));
 }
예제 #11
0
 public override bool Test(Sim actor, WeatherStone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     if (!SummonWeatherEx.CommonTest(target, actor, mType, ref greyedOutTooltipCallback, isAutonomous))
     {
         return false;   
     }
     
     return HasValidCandidates(actor.LotCurrent, actor, mType);
 }
예제 #12
0
 public override string GetInteractionName(Sim actor, WeatherStone target, InteractionObjectPair iop)
 {
     bool isFemale = actor.IsFemale;
     return WeatherStone.LocalizeString(isFemale, "SummonWeatherWithInteractionName", new object[] { WeatherStone.LocalizeString(isFemale, mType.ToString(), new object[0]) });
 }
예제 #13
0
            private static bool IsValidCandidate(Sim sim, Sim actor, WeatherStone.SummonWeatherType type)
            {
                if (sim.SimDescription.ChildOrBelow)
                {
                    return false;
                }
                else if (sim == actor)
                {
                    return false;
                }

                return SummonWeatherEx.GetSummonWeatherTypeForSim(sim.SimDescription).Contains(type);
            }
예제 #14
0
 public override void AddInteractions(InteractionObjectPair iop, Sim actor, WeatherStone target, List<InteractionObjectPair> results)
 {
     foreach (WeatherStone.SummonWeatherType type in GetSummonWeatherTypeForSim(actor.SimDescription))
     {
         results.Add(new InteractionObjectPair(new Definition(type), target));
     }
 }
예제 #15
0
        public override bool Run()
        {
            try
            {
                Definition interactionDefinition = InteractionDefinition as Definition;

                mIsJoin = interactionDefinition.IsJoin;
                if (!Actor.RoutingComponent.RouteToObjectRadialRange(Target, WeatherStone.kSummonWeatherRouteDistance[0], WeatherStone.kSummonWeatherRouteDistance[1], AlwaysRoute ? new Route.RouteOption[] { Route.RouteOption.DoNotEmitDegenerateRoutesForRadialRangeGoals } : null))
                {
                    return(false);
                }

                if ((interactionDefinition.mType == WeatherStone.SummonWeatherType.HuntersStorm) && !Actor.BuffManager.HasElement(BuffNames.Werewolf))
                {
                    InteractionInstance instance = OccultWerewolf.TransformationToWerewolf.Singleton.CreateInstance(Actor, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                    if (instance != null)
                    {
                        if (instance.RunInteraction())
                        {
                            Actor.ClearExitReasons();
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }

                if (!Target.TryStartSummoningWeather(Actor, interactionDefinition.mType, mIsJoin))
                {
                    if (mIsJoin || !Target.TryStartSummoningWeather(Actor, interactionDefinition.mType, true))
                    {
                        Sim createdSim = null;
                        if (Target.mSummoningSimDescriptionId != 0L)
                        {
                            createdSim = SimDescription.GetCreatedSim(Target.mSummoningSimDescriptionId);
                        }
                        Actor.PlayRouteFailure(createdSim);
                        return(false);
                    }
                    mIsJoin = true;
                }

                StandardEntry();
                EnterStateMachine("SummonWeather", "Enter", "x");
                if (Target.mSummonWeatherType == WeatherStone.SummonWeatherType.BewitchingRain)
                {
                    StartLightningEffects();
                }

                AnimateSim(interactionDefinition.mType.ToString());
                BeginCommodityUpdates();
                if (mIsJoin)
                {
                    mSummonWeatherTimeRemaining = WeatherStone.kSummonWeatherDetermineOutcomeTime[1] + 10f;
                }
                else
                {
                    mSummonWeatherTimeRemaining = RandomUtil.GetFloat(WeatherStone.kSummonWeatherDetermineOutcomeTime[0], WeatherStone.kSummonWeatherDetermineOutcomeTime[1]);
                }

                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), SummonLoop, mCurrentStateMachine);
                EndCommodityUpdates(succeeded);
                StandardExit();
                switch (Target.CurrentWeatherStoneState)
                {
                case WeatherStone.WeatherStoneState.AfterSuccessfulSummon:
                    AnimateSim("Success");
                    BuffNames buffNameFromSummonWeatherType = WeatherStone.GetBuffNameFromSummonWeatherType(Target.mSummonWeatherType);
                    if (buffNameFromSummonWeatherType != BuffNames.Undefined)
                    {
                        Actor.BuffManager.AddElement(buffNameFromSummonWeatherType, Origin.FromWeatherStone);
                    }
                    if (!mIsJoin)
                    {
                        Target.StopElectrifiedEffect();
                    }
                    break;

                case WeatherStone.WeatherStoneState.AfterFailureSummon:
                    if (!Target.mUseExtremeFailure)
                    {
                        AnimateSim("FailureNormal");
                    }
                    else
                    {
                        BuffSinged.SingeViaInteraction(this, Origin.FromLightning);
                        AnimateSim("FailureExtreme");
                    }

                    if (!HasOtherSimsSummoning(Actor))
                    {
                        Target.AnimateChangeWeatherStoneState(false, WeatherStone.WeatherStoneState.Resting);
                    }
                    break;

                default:
                    if (!mIsJoin)
                    {
                        Target.OnSummoningStoppedEarly();
                    }
                    AnimateSim("FailureNormal");
                    break;
                }

                AnimateSim("Exit");
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
예제 #16
0
            public override bool Test(Sim actor, WeatherStone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!mIsJoin)
                {
                    if (!CommonTest(target, actor, mType, ref greyedOutTooltipCallback, isAutonomous))
                    {
                        return false;
                    }
                }
                else
                {
                    if (!target.IsSummoning)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Not Summoning");
                        return false;
                    }
                    else if (target.mSummonWeatherType != mType)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Not Correct Type");
                        return false;
                    }
                    else if (target.mSummoningSimDescriptionId == actor.SimDescription.SimDescriptionId)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Is Summoner");
                        return false;
                    }
                }

                return true;
            }
예제 #17
0
 private static List<Sim> GetValidCandidates(Lot lot, Sim actor, WeatherStone.SummonWeatherType type)
 {
     return lot.GetSims(delegate(Sim s)
     {
         return IsValidCandidate(s, actor, type);
     });
 }