示例#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
文件: Kill.cs 项目: yakoder/NRaas
        protected static bool PrivateKill(Sim actor, Sim target, SimDescription.DeathType deathType)
        {
            GreyedOutTooltipCallback greyedOutTooltipCallback = null;

            if (!Assassination.CanBeKilled(target, ref greyedOutTooltipCallback))
            {
                return(false);
            }

            if (deathType == SimDescription.DeathType.None)
            {
                new EraseKillTask(actor, target.SimDescription);
                return(true);
            }
            else
            {
                sStoryProgressionAboutToDie.Invoke <bool>(new object[] { target.SimDescription });

                if (deathType == SimDescription.DeathType.Burn)
                {
                    LotLocation location    = LotLocation.Invalid;
                    ulong       lotLocation = World.GetLotLocation(target.PositionOnFloor, ref location);
                    if (lotLocation != 0)
                    {
                        Fire.CreateFire(lotLocation, location);
                    }
                }
                else if (deathType == SimDescription.DeathType.Meteor)
                {
                    new MeteorControl(actor, target);
                    return(true);
                }
                else if (deathType == SimDescription.DeathType.Thirst)
                {
                    if (actor.SimDescription.IsVampire)
                    {
                        if (actor.TraitManager.HasElement(TraitNames.Vegetarian))
                        {
                            actor.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromCarnivorousBehavior);
                        }
                        else
                        {
                            actor.BuffManager.AddElement(BuffNames.Sated, Origin.FromReceivingVampireNutrients);
                        }

                        actor.Motives.SetMax(CommodityKind.VampireThirst);

                        if (target.SimDescription.IsFairy)
                        {
                            actor.BuffManager.AddElement(BuffNames.DrankFromAFairy, Origin.FromReceivingVampireNutrients);
                        }

                        EventTracker.SendEvent(EventTypeId.kVampireDrankFromSim, actor, target);
                        EventTracker.SendEvent(new VampireLifetimeEvent(EventTypeId.kVampireLifetimeEvent, actor.SimDescription, false, target.SimDescription.SimDescriptionId));
                    }
                }

                return(DelayedKill(actor, target, deathType));
            }
        }
示例#3
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);
            }
        }
示例#4
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);
            }
        }
示例#5
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);
            }
        }
示例#6
0
文件: Kill.cs 项目: pepoluan/NRaas
            /*
             * public override InteractionTestResult Test(ref InteractionInstanceParameters parameters, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
             * {
             *  InteractionTestResult result = base.Test(ref parameters, ref greyedOutTooltipCallback);
             *
             *  Common.Notify(result.ToString());
             *
             *  return result;
             * }
             */
            public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if ((mDirect) || (mMassDeath))
                {
                    if (isAutonomous)
                    {
                        return(false);
                    }
                }

                return(Assassination.Allow(actor, target, mType, isAutonomous, mDirect, mMassDeath, ref greyedOutTooltipCallback));
            }
示例#7
0
 public static bool CallbackTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     try
     {
         return(Assassination.Allow(actor, target, SimDescription.DeathType.Drown, isAutonomous, false, false, ref greyedOutTooltipCallback));
     }
     catch (Exception e)
     {
         Common.Exception(actor, target, e);
         return(false);
     }
 }
示例#8
0
        public static bool OnCallbackTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                if (actor.Household == target.Household)
                {
                    return(false);
                }

                if (actor.SkillManager == null)
                {
                    return(false);
                }

                Assassination skill = actor.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);
                if (skill == null)
                {
                    return(false);
                }

                if (skill.GetNetAggression() == 0)
                {
                    return(false);
                }

                Occupation career = target.Occupation;
                if (career == null)
                {
                    return(false);
                }

                if (career is LawEnforcement)
                {
                    return(true);
                }

                if (career is Political)
                {
                    return(true);
                }

                return(false);
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return(false);
            }
        }
        public static void Generate(WeakAura wa)
        {
            // todo: add a check for missing poisons
            var assassination = new Assassination();

            var builder = new SpecBuilder(ClassSpec.Assassination);

            builder.AddOverflow(
                assassination.Blind.DeBuff(),
                assassination.CheapShot.RequiresStealth(),
                assassination.Feint.Buff(),
                assassination.Distract.DeBuff(),
                assassination.Evasion.Buff(),
                assassination.ShroudOfConcealment.Buff().RequiresStealth(),
                // look for buff on friendly target?
                assassination.TricksOfTheTrade.Buff()
                ).AddRightBar(
                assassination.Vendetta.Buff(),
                assassination.MarkedForDeath.DeBuff(),           // T3
                assassination.Exsanguinate,                      // T6
                assassination.HiddenBlades.Passive().BigStacks() // T7
                ).AddCoreRotation(
                assassination.Shiv,
                assassination.SliceAndDice.Buff(),
                assassination.Envenom.DeBuff(),
                assassination.Garrote.DeBuff(),
                assassination.Rupture.DeBuff(),
                assassination.CrimsonTempest.DeBuff() // T7
                ).AddCoreCooldowns(
                ).AddBottomBar(
                assassination.Shadowstep.Buff(),
                assassination.Sprint.Buff(),
                assassination.CloakOfShadows.Buff(),
                assassination.Kick.DeBuff(),
                assassination.CrimsonVial.Buff(),
                assassination.Vanish.Buff()
                ).AddTopBar(
                assassination.ElaboratePlanning.Passive().Buff(),  // T1
                assassination.Blindside.Passive().Buff(),          // T1
                assassination.InternalBleeding.Passive().DeBuff(), // T5
                assassination.IronWire.Passive().DeBuff(),         // T5
                assassination.PreyOnTheWeak.Passive().DeBuff(),    // T5
                assassination.Alacrity.Passive().Buff()            // T6
                ).AddAlerts(
                assassination.Stealth.Passive().Buff(),
                assassination.Subterfuge.Buff(), // T2
                assassination.ShroudOfConcealment.Passive().Buff()
                ).Build(wa);
        }
示例#10
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (a.FamilyFunds < Assassination.Settings.mHiringCost)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Funds Fail");
                    return(false);
                }

                if (!Assassination.Allow(a, target, mType, isAutonomous, true, false, ref greyedOutTooltipCallback))
                {
                    return(false);
                }

                return(base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback));
            }
示例#11
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (Assassination.GetSkillLevel(target) <= 0)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Skill Fail");
                    return(false);
                }

                if (a.FamilyFunds < Assassination.Settings.mHiringCost)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Funds Fail");
                    return(false);
                }

                return(base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback));
            }
示例#12
0
文件: Thirst.cs 项目: yakoder/NRaas
        public static bool CallbackTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                if (!GameUtils.IsInstalled(ProductVersion.EP3))
                {
                    return(false);
                }

                return(Assassination.Allow(actor, target, SimDescription.DeathType.Thirst, isAutonomous, false, false, ref greyedOutTooltipCallback));
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return(false);
            }
        }
示例#13
0
            public override bool Test(Sim actor, Terrain target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (actor.SkillManager == null)
                {
                    return(false);
                }

                Assassination skill = actor.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);

                if (skill == null)
                {
                    return(false);
                }

                if ((actor != null) && (actor.LotCurrent == actor.LotHome) && (Sims3.Gameplay.Queries.CountObjects <ITeleporter>(actor.LotHome) > 0x0))
                {
                    return(false);
                }

                return(skill.IsNinja());
            }
示例#14
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (a.SkillManager == null)
                {
                    return(false);
                }

                Assassination skill = a.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);

                if (skill == null)
                {
                    return(false);
                }

                if (skill.GetNetAggression() == 0)
                {
                    return(false);
                }

                return(true);
            }
示例#15
0
            public override List <Sim> GetYouShouldTargets(Sim thisActor, Sim pushedSocialActor)
            {
                InteractionPriority priority = new InteractionPriority(InteractionPriorityLevel.UserDirected);

                SocialInteractionA.Definition pushedSocialDefinition = new SocialInteractionA.Definition(mPushedSocialActionKey, new string[0x0], null, false);
                pushedSocialDefinition.ChecksToSkip = mChecksToSkip;

                List <Sim> list = new List <Sim>();

                foreach (Sim sim in pushedSocialActor.LotCurrent.GetAllActors())
                {
                    if (sim == thisActor)
                    {
                        continue;
                    }

                    if (sim == pushedSocialActor)
                    {
                        continue;
                    }

                    GreyedOutTooltipCallback tooltipCallback = null;
                    if (!PushedSocialTest(pushedSocialActor, sim, pushedSocialDefinition, priority, tooltipCallback))
                    {
                        continue;
                    }

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

                    list.Add(sim);
                }

                return(list);
            }
示例#16
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (isAutonomous)
                {
                    return(false);
                }

                if (a != target)
                {
                    return(false);
                }

                if (!target.SimDescription.IsPlayableGhost)
                {
                    return(false);
                }

                Assassination skill = a.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);

                if (skill == null)
                {
                    return(false);
                }

                if (!skill.IsGhost())
                {
                    return(false);
                }

                if (Urnstone.FindGhostsGrave(a) == null)
                {
                    return(false);
                }

                return(true);
            }
示例#17
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (isAutonomous)
                {
                    return(false);
                }

                if (a != target)
                {
                    return(false);
                }

                try
                {
                    if (a.CurrentOutfitCategory == Sims3.SimIFace.CAS.OutfitCategories.Career)
                    {
                        return(false);
                    }
                }
                catch
                {
                    return(false);
                }

                OmniCareer career = a.Occupation as OmniCareer;

                Assassination skill = a.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);

                if (mType == ServiceType.GrimReaper)
                {
                    if (skill != null)
                    {
                        if (skill.IsReaper())
                        {
                            return(true);
                        }
                    }

                    if (career != null)
                    {
                        if (career.CanUseReaper())
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    if (skill != null)
                    {
                        if (skill.IsHitman())
                        {
                            return(true);
                        }
                    }

                    if (career != null)
                    {
                        if (career.CanUseDisguise())
                        {
                            return(true);
                        }
                    }
                }

                return(false);
            }
示例#18
0
        public override bool InRabbitHole()
        {
            try
            {
                Assassination skill = Actor.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);
                if (skill == null)
                {
                    return(false);
                }

                if (skill.GetNetAggression() == 0)
                {
                    return(false);
                }

                StartStages();
                BeginCommodityUpdates();
                bool succeeded = false;

                try
                {
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                }

                if (!succeeded)
                {
                    return(succeeded);
                }

                int owed = (int)(skill.GetNetAggression() * (1 + Assassination.Settings.mRabbitHoleCorruption));

                int funds = Actor.FamilyFunds;
                if (funds > owed)
                {
                    funds = owed;
                }

                string text = StringInputDialog.Show(Common.Localize("Bribe:MenuName", Actor.IsFemale), Common.Localize("Bribe:Prompt", Actor.IsFemale, new object[] { Actor, Assassination.Settings.mRabbitHoleCorruption * 100, owed }), funds.ToString());
                if ((text == null) || (text == ""))
                {
                    return(false);
                }

                if (!int.TryParse(text, out funds))
                {
                    return(false);
                }

                if (funds < 0)
                {
                    return(false);
                }

                if (funds > owed)
                {
                    funds = owed;
                }

                Actor.ModifyFunds(-funds);

                skill.Bribe((int)(funds * (1f - Assassination.Settings.mRabbitHoleCorruption)));
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
示例#19
0
        public static void OnAccepted(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                Assassination skill = actor.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);
                if (skill == null)
                {
                    return;
                }

                if (skill.GetNetAggression() == 0)
                {
                    return;
                }

                int owed = skill.GetNetAggression();

                int funds = actor.FamilyFunds;
                if (funds > owed)
                {
                    funds = owed;
                }

                if (i.Autonomous)
                {
                    funds = RandomUtil.GetInt(owed);
                }
                else
                {
                    string text = StringInputDialog.Show(Common.Localize("Bribe:MenuName", actor.IsFemale), Common.Localize("Bribe:SocialPrompt", actor.IsFemale, new object[] { actor, owed }), funds.ToString());
                    if ((text == null) || (text == ""))
                    {
                        return;
                    }

                    if (!int.TryParse(text, out funds))
                    {
                        return;
                    }
                }

                if (funds < 0)
                {
                    return;
                }

                if (funds > owed)
                {
                    funds = owed;
                }

                actor.ModifyFunds(-funds);

                target.ModifyFunds(funds);

                skill.Bribe(funds);
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
示例#20
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
                { }
            }
示例#21
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);
            }
        }