示例#1
0
        protected bool TargetDead(SimDescription sim)
        {
            if (sim == null)
            {
                return(false);
            }

            if ((sim != mSuspendedSim) &&
                ((TargetObject == null) || ((TargetObject as Sim).SimDescription != sim)))
            {
                return(false);
            }

            mKilled = true;

            Assassination skill = Assassination.EnsureSkill(Actor);

            if (skill != null)
            {
                skill.AddActualKill(sim, skill.IsPotential(sim), false);
            }

            mbTargetDeleted = true;
            return(true);
        }
示例#2
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);
            }
        }
示例#3
0
文件: Kill.cs 项目: pepoluan/NRaas
        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);
            }
        }
示例#4
0
        public override bool Run()
        {
            try
            {
                Sim selectedObject = GetSelectedObject() as Sim;
                if (selectedObject != null)
                {
                    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);
                        }
                        InteractionInstance instance = definition2.CreateInstance(selectedObject, Target, priority, false, true);
                        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);
            }
        }
示例#5
0
文件: Kill.cs 项目: pepoluan/NRaas
            protected override void OnPerform()
            {
                int roomId = 0;
                Lot lot    = null;

                if (mTarget.CreatedSim != null)
                {
                    Vector3 location = mTarget.CreatedSim.PositionOnFloor;

                    lot    = mTarget.CreatedSim.LotCurrent;
                    roomId = mTarget.CreatedSim.RoomId;

                    List <GnomeData> gnomes = new List <GnomeData>();

                    if (mTarget.TraitManager.HasElement(TraitNames.CultureChina))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1));
                    }
                    else if ((mTarget.TraitManager.HasElement(TraitNames.CultureEgypt)) || (mTarget.IsMummy))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1));
                    }
                    else if (mTarget.TraitManager.HasElement(TraitNames.CultureFrance))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1));
                    }
                    else if (mTarget.IsVampire)
                    {
                        gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3));
                    }
                    else if (mTarget.IsFrankenstein)
                    {
                        gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2));
                    }
                    else if ((mTarget.IsCelebrity) || (mTarget.AssignedRole is RolePaparazzi))
                    {
                        gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3));
                    }
                    else if (mTarget.Occupation is MagicianCareer)
                    {
                        gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician
                    }
                    else if (mTarget.Occupation is SingerCareer)
                    {
                        gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer
                    }
                    else if (mTarget.IsCat)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat
                    }
                    else if (mTarget.IsADogSpecies)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog
                    }
                    else if (mTarget.IsHorse)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse
                    }
                    else
                    {
                        gnomes.Add(new GnomeData(0x000000000000058B, ProductVersion.BaseGame)); // Normal

                        if (GameUtils.IsInstalled(ProductVersion.EP1))
                        {
                            gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1)); // China
                            gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1)); // Egypt
                            gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1)); // France
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP2))
                        {
                            gnomes.Add(new GnomeData(0x0000000000989EEC, ProductVersion.EP2)); // Caveman
                            gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2)); // Inventor
                            gnomes.Add(new GnomeData(0x0000000000989EDF, ProductVersion.EP2)); // Laundry
                            gnomes.Add(new GnomeData(0x0000000000989CF2, ProductVersion.EP2)); // Sculptor
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP3))
                        {
                            gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3)); // Celebrity
                            gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3)); // Vampire
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP5))
                        {
                            gnomes.Add(new GnomeData(0x000000000098AEB1, ProductVersion.EP5)); // Freezer Bunny
                            gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat
                            gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog
                            gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP6))
                        {
                            gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician
                            gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer
                        }
                    }

                    if (gnomes.Count > 0)
                    {
                        GnomeData preferred = RandomUtil.GetRandomObjectFromList(gnomes);

                        MagicGnomeBase gnome = ObjectCreation.CreateObject(preferred.mInstance, preferred.mVersion, null) as MagicGnomeBase;
                        if (gnome != null)
                        {
                            NameComponent name = gnome.GetComponent <NameComponent>();
                            if (name != null)
                            {
                                name.mName = mTarget.FullName;
                            }

                            gnome.SetPosition(location);
                            gnome.AddToWorld();
                        }
                    }
                }

                Genealogy genealogy = mTarget.CASGenealogy as Genealogy;

                if (genealogy != null)
                {
                    genealogy.ClearAllGenealogyInformation();
                }

                foreach (SimDescription other in SimDescription.GetSimDescriptionsInWorld())
                {
                    MiniSimDescription miniOther = MiniSimDescription.Find(other.SimDescriptionId);
                    if (miniOther == null)
                    {
                        continue;
                    }

                    miniOther.RemoveMiniRelatioship(mTarget.SimDescriptionId);
                }

                Annihilation.RemoveMSD(mTarget.SimDescriptionId);

                Relationship.RemoveSimDescriptionRelationships(mTarget);

                Urnstone urnstone = Urnstone.FindGhostsGrave(mTarget);

                if (urnstone != null)
                {
                    if ((urnstone.InInventory) && (urnstone.Parent != null) && (urnstone.Parent.Inventory != null))
                    {
                        urnstone.Parent.Inventory.RemoveByForce(urnstone);
                    }

                    urnstone.DestroyGrave();

                    try
                    {
                        urnstone.Dispose();
                    }
                    catch
                    { }
                }

                try
                {
                    mTarget.Dispose();

                    Assassination skill = Assassination.EnsureSkill(mActor);
                    if (skill != null)
                    {
                        skill.AddPotentialKill(mTarget, true);

                        bool witnessed = false;

                        if (lot != null)
                        {
                            witnessed = Assassination.WasWitnessed(lot, roomId, mActor.SimDescription, mTarget, new List <Sim>());
                        }

                        skill.AddActualKill(mTarget, false, witnessed);
                    }
                }
                catch
                { }
            }
示例#6
0
文件: Kill.cs 项目: yakoder/NRaas
        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);
            }
        }