Esempio n. 1
0
        public override bool Run()
        {
            try
            {
                Sim selectedObject = GetSelectedObject() as Sim;
                if (selectedObject != null)
                {
                    base.Run();
                    if (mResultCode != SocialInteraction.SocialResultCode.Succeeded)
                    {
                        return(false);
                    }

                    SocialRule targetEffect = mTargetEffect;
                    if (targetEffect != null)
                    {
                        if (targetEffect.RHS.STEffectCommodity != CommodityTypes.Friendly)
                        {
                            return(false);
                        }

                        Definition            interactionDefinition = InteractionDefinition as Definition;
                        InteractionPriority   priority    = GetPriority();
                        InteractionDefinition definition2 = interactionDefinition.GetPushDefintion(Target, selectedObject, priority);
                        if (definition2 == null)
                        {
                            return(false);
                        }

                        // Never could figure out why adding routing pushes here just does nothing...

                        Kill            instance = Kill.Singleton.CreateInstance(selectedObject, Target, priority, false, true) as Kill;
                        Kill.Definition def      = instance.InteractionDefinition as Kill.Definition;
                        def.mType   = interactionDefinition.mType;
                        def.mDirect = false;
                        if (!Target.InteractionQueue.PushAsContinuation(instance, true))
                        {
                            return(false);
                        }

                        Assassination skill = Assassination.EnsureSkill(Target);

                        skill.AddJob(Actor, selectedObject);

                        return(true);
                    }
                }
                return(false);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Esempio n. 2
0
 public static void OnAccepted(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
 {
     try
     {
         Kill.OnAccepted(actor, target, SimDescription.DeathType.Thirst);
     }
     catch (Exception e)
     {
         Common.Exception(actor, target, e);
     }
 }
Esempio n. 3
0
        public override bool Run()
        {
            try
            {
                Definition definition = InteractionDefinition as Definition;
                if (definition.IsMassDeath)
                {
                    List <Sim> sims = new List <Sim>(Target.LotCurrent.GetObjects <Sim>());

                    foreach (Sim sim in sims)
                    {
                        if (sim == Actor)
                        {
                            continue;
                        }

                        GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                        if (!Assassination.CanBeKilled(sim, ref greyedOutTooltipCallback))
                        {
                            continue;
                        }

                        Kill instance = (new Definition(false, false, definition.DeathType)).CreateInstance(sim, Actor, new InteractionPriority(InteractionPriorityLevel.MaxDeath), false, false) as Kill;

                        Actor.InteractionQueue.Add(instance);
                    }
                }
                else
                {
                    SimDescription target = Target.SimDescription;

                    if (PrivateKill(Actor, Target, definition.DeathType))
                    {
                        Assassination skill = Assassination.EnsureSkill(Actor);
                        if (skill != null)
                        {
                            skill.AddPotentialKill(target, false);
                        }

                        if ((Autonomous) && (Assassination.Settings.mShowAutonomousNotice))
                        {
                            Common.Notify(Actor, Common.Localize("AssassinationKill:Notice", Actor.IsFemale, Target.IsFemale, new object[] { Actor, Target }));
                        }
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Esempio n. 4
0
        public override bool Run()
        {
            try
            {
                Definition definition = InteractionDefinition as Definition;
                if (definition.IsMassDeath)
                {
                    List <Sim> sims = new List <Sim>(Target.LotCurrent.GetObjects <Sim>());

                    foreach (Sim sim in sims)
                    {
                        if (sim == Actor)
                        {
                            continue;
                        }

                        GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                        if (!Assassination.CanBeKilled(sim, ref greyedOutTooltipCallback))
                        {
                            continue;
                        }

                        Kill instance = (new Definition(false, false, definition.DeathType)).CreateInstance(sim, Actor, new InteractionPriority(InteractionPriorityLevel.MaxDeath), false, false) as Kill;

                        Actor.InteractionQueue.Add(instance);
                    }
                }
                else
                {
                    SimDescription target = Target.SimDescription;

                    if (Actor.GetDistanceToObject(Target) > 1f)
                    {
                        Actor.RequestWalkStyle(Sim.WalkStyle.Walk);
                        Actor.PlayReaction(ReactionTypes.EvilLaugh, ReactionSpeed.Immediate);

                        Route r = Actor.CreateRoute();
                        r.SetOption(Route.RouteOption.MakeDynamicObjectAdjustments, true);
                        r.PlanToPointRadialRange(Target, Target.Position, 3.5f, 5f, RouteDistancePreference.PreferFurthestFromRouteDestination, RouteOrientationPreference.TowardsObject, Target.LotCurrent.LotId, new int[] { Target.RoomId });
                        if (!r.PlanResult.Succeeded() || !Actor.DoRoute(r))
                        {
                            Actor.PlayRouteFailure();
                            return(false);
                        }
                    }

                    if (PrivateKill(Actor, Target, definition.DeathType))
                    {
                        Assassination skill = Assassination.EnsureSkill(Actor);
                        if (skill != null)
                        {
                            skill.AddPotentialKill(target, false);
                        }

                        if ((Autonomous) && (Assassination.Settings.mShowAutonomousNotice))
                        {
                            Common.Notify(Actor, Common.Localize("AssassinationKill:Notice", Actor.IsFemale, Target.IsFemale, new object[] { Actor, Target }));
                        }
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }