当前位置: 首页>>代码示例>>C#>>正文


C# Sim.HasTrait方法代码示例

本文整理汇总了C#中Sim.HasTrait方法的典型用法代码示例。如果您正苦于以下问题:C# Sim.HasTrait方法的具体用法?C# Sim.HasTrait怎么用?C# Sim.HasTrait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sim的用法示例。


在下文中一共展示了Sim.HasTrait方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReactToSkinnyDippers

        public static void ReactToSkinnyDippers(Sim sim, GameObject objectSkinnyDippedIn, InteractionDefinition skinnyDipInteraction, List<ulong> skinnyDipperList)
        {
            if (!sim.SimDescription.TeenOrBelow && ((skinnyDipperList != null) && (skinnyDipperList.Count != 0x0)))
            {
                List<ulong> skinnyDippers = new List<ulong>(skinnyDipperList);
                skinnyDippers.Remove(sim.SimDescription.SimDescriptionId);
                if (skinnyDippers.Count != 0x0)
                {
                    bool flag = Pool.ShouldReactPositiveToSkinnyDipper(sim, skinnyDippers);
                    bool flag2 = false;
                    if (flag && !sim.HasTrait(TraitNames.Hydrophobic))
                    {
                        flag2 = RandomUtil.RandomChance(Pool.kChancePositiveReactionSimsJoin);
                    }

                    SimDescription simDesc = SimDescription.Find(RandomUtil.GetRandomObjectFromList(skinnyDippers));
                    if (simDesc != null)
                    {
                        Sim createdSim = simDesc.CreatedSim;

                        Pool.ReactToSkinnyDipper instance = Pool.ReactToSkinnyDipper.Singleton.CreateInstance(createdSim, sim, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as Pool.ReactToSkinnyDipper;
                        instance.IsPositive = flag;
                        instance.ShouldJoin = flag2;
                        instance.DippingObject = objectSkinnyDippedIn;
                        instance.SkinnyDipInteraction = skinnyDipInteraction;
                        sim.InteractionQueue.AddNextIfPossible(instance);
                    }
                }
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:30,代码来源:PoolEx.cs

示例2: WillSimComeToParty

        private static bool WillSimComeToParty(SimDescription guest, Sim host, float fMaxLTR, bool bHostIsLegendary)
        {
            if (bHostIsLegendary || host.HasTrait(TraitNames.PartyAnimal))
            {
                return true;
            }

            Relationship relationshipToParty = null;

            try
            {
                relationshipToParty = HostedSituation.GetRelationshipToHostedSituation(host.SimDescription, guest);
            }
            catch
            { }

            if (relationshipToParty == null)
            {
                return false;
            }
            if (relationshipToParty.AreFriends() || relationshipToParty.AreRomantic())
            {
                return true;
            }
            float num = MathUtils.Clamp(relationshipToParty.LTR.Liking, HouseParty.kLTRMinToInvite, fMaxLTR);
            return RandomUtil.InterpolatedChance(HouseParty.kLTRMinToInvite, fMaxLTR, (float)HouseParty.kChanceToComeAtMinLTR, (float)HouseParty.kChanceToComeAtMaxLTR, num);
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:27,代码来源:ThrowHome.cs

示例3: ApplyPostShowerEffects

        public static void ApplyPostShowerEffects(Sim actor, IShowerable shower)
        {
            BuffManager buffManager = actor.BuffManager;
            buffManager.RemoveElement(BuffNames.Singed);
            buffManager.RemoveElement(BuffNames.SingedElectricity);
            buffManager.RemoveElement(BuffNames.GarlicBreath);
            SimDescription simDescription = actor.SimDescription;
            simDescription.RemoveFacePaint();
            if (simDescription.IsMummy)
            {
                buffManager.AddElement(BuffNames.Soaked, Origin.FromShower);
            }

            if (RandomUtil.RandomChance((float)shower.TuningShower.ChanceOfExhileratingShowerBuff))
            {
                buffManager.AddElement(BuffNames.ExhilaratingShower, Origin.FromNiceShower);
            }

            if (actor.HasTrait(TraitNames.Hydrophobic))
            {
                actor.PlayReaction(ReactionTypes.Cry, shower as GameObject, ReactionSpeed.AfterInteraction);
            }
            else if (shower.ShouldGetColdShower)
            {
                actor.BuffManager.AddElement(BuffNames.ColdShower, Origin.FromCheapShower);
                EventTracker.SendEvent(EventTypeId.kGotColdShowerBuff, actor, shower);
            }
            // Custom
            else if ((shower.Cleanable != null) && (shower.Cleanable.NeedsToBeCleaned))
            {
                actor.PlayReaction(ReactionTypes.Retch, shower as GameObject, ReactionSpeed.AfterInteraction);
            }
            actor.Motives.SetMax(CommodityKind.Hygiene);
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:34,代码来源:ShowerEx.cs

示例4: CalculateShowPriceEx

        protected static int CalculateShowPriceEx(Sim a, ShowVenue target)
        {
            int showPrice = target.ShowPrice;
            if (a.HasTrait(TraitNames.ComplimentaryEntertainment))
            {
                showPrice = 0x0;
            }

            Music music = OmniCareer.Career<Music>(a.Occupation);

            if ((music != null) && (music.CurLevelBranchName == "Symphonic") && (music.CareerLevel >= Music.FreeTheatreShowLevel))
            {
                showPrice = 0x0;
            }

            foreach (Sim sim in a.Household.Sims)
            {
                if ((target.ActorsUsingMe.Contains(sim) && (sim.CurrentInteraction != null)) && (sim.CurrentInteraction.InteractionDefinition == ShowVenue.PerformConcert.Singleton))
                {
                    return 0x0;
                }
            }
            return showPrice;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:24,代码来源:AttendShowEx.cs

示例5: Test

            public override bool Test(Sim a, HotTubBase target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if ((target.Repairable != null) && (target.Repairable.Broken))
                    {
                        return false;
                    }

                    HotTubPosture posture = a.Posture as HotTubPosture;
                    if ((posture != null) && (posture.Container == target))
                    {
                        return false;
                    }

                    if (target.mSimsAreWooHooing)
                    {
                        return false;
                    }

                    if (isAutonomous && a.HasTrait(TraitNames.Hydrophobic))
                    {
                        return false;
                    }

                    if (target.SeatingGroup.Count == target.UseCount)
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(HotTubBase.LocalizeString(a.IsFemale, "AllSeatsTaken", new object[0x0]));
                        return false;
                    }

                    if (a.CurrentOutfitCategory == OutfitCategories.SkinnyDippingTowel)
                    {
                        greyedOutTooltipCallback = new GrayedOutTooltipHelper(a.IsFemale, "ClothesStolenTooltip", null).GetTooltip;
                        return false;
                    }

                    if (HotTubBase.StressExitFromHeat(a, ref greyedOutTooltipCallback))
                    {
                        return false;
                    }

                    if (IsSkinnyDipping)
                    {
                        // Custom
                        return CommonSkinnyDip.CanSkinnyDipAtLocation(a, target.Position, ref greyedOutTooltipCallback, false, true);
                    }

                    return true;
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return false;
                }
            }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:56,代码来源:HotTubGetIn.cs

示例6: GetOwnedAndUsableVehicle

        public static Vehicle GetOwnedAndUsableVehicle(Sim ths, Lot lot, bool bAddPending, bool bAllowBikes, bool bIgnoreCanDrive, bool allowUFO)
        {
            if (ths.IsPet)
            {
                return null;
            }

            Vehicle vehicleForCurrentInteraction = ths.GetVehicleForCurrentInteraction();
            if (vehicleForCurrentInteraction != null)
            {
                return vehicleForCurrentInteraction;
            }

            /*
            if (GameUtils.IsInstalled(ProductVersion.EP2))
            {
                ActiveFireFighter occupation = ths.Occupation as ActiveFireFighter;
                if (occupation != null)
                {
                    Car vehicle = occupation.GetVehicle(bAddPending);
                    if (vehicle != null)
                    {
                        return vehicle;
                    }
                }
            }
            */

            Vehicle reservedVehicle = ths.GetReservedVehicle();
            if ((reservedVehicle != null) && (bAllowBikes || (!(reservedVehicle is Bicycle) && !(reservedVehicle is MagicBroom))))
            {
                IOwnableVehicle vehicle3 = reservedVehicle as IOwnableVehicle;
                if (vehicle3 == null)
                {
                    return reservedVehicle;
                }

                if (ths.CanUseVehicleRightNow(vehicle3, true, true))
                {
                    if (bAddPending)
                    {
                        vehicle3.PendingUse = true;
                    }
                    return reservedVehicle;
                }
            }

            /*
            if (ths.OccupationAsPerformanceCareer != null)
            {
                Car car2 = ths.OccupationAsPerformanceCareer.GetCareerCar();
                if (car2 != null)
                {
                    return car2;
                }
            }
            else if (ths.CareerManager.OccupationAsCareer != null)
            {
                FortuneTellerCareer career = ths.CareerManager.Occupation as FortuneTellerCareer;
                if (((career != null) && (career.CurLevelBranchName == "ScamArtist")) && (career.Level >= FortuneTellerCareer.kLevelNeededForLimoRide))
                {
                    Car car3 = GlobalFunctions.CreateObjectOutOfWorld("CarLimo") as Car;
                    car3.DestroyOnRelease = true;
                    return car3;
                }
            }
            */

            IOwnableVehicle preferredVehicle = ths.GetPreferredVehicle();
            if (ths.CanUseVehicleRightNow(preferredVehicle, true, bIgnoreCanDrive) && (bAllowBikes || (!(reservedVehicle is Bicycle) && !(reservedVehicle is MagicBroom))))
            {
                if (bAddPending)
                {
                    preferredVehicle.PendingUse = true;
                }
                return (preferredVehicle as Vehicle);
            }

            if (bAllowBikes && ths.HasTrait(TraitNames.Rebellious))
            {
                IOwnableVehicle motorcycleIfAvailable = ths.GetMotorcycleIfAvailable(bAddPending, bIgnoreCanDrive);
                if (motorcycleIfAvailable != null)
                {
                    return (motorcycleIfAvailable as Vehicle);
                }
            }

            if (bAllowBikes && ths.HasTrait(TraitNames.EnvironmentallyConscious))
            {
                IOwnableVehicle bikeIfAvailable = ths.GetBikeIfAvailable(bAddPending, bIgnoreCanDrive);
                if (bikeIfAvailable != null)
                {
                    return (bikeIfAvailable as Vehicle);
                }
            }

            // Custom
            List<IOwnableVehicle> vehicles = Inventories.QuickDuoFind<IOwnableVehicle, Vehicle>(ths.Inventory);
            IOwnableVehicle vehicle = ths.GetBroomOrMostExpensiveUsableVehicle(vehicles, bAllowBikes, bAddPending, bIgnoreCanDrive, allowUFO, false);
            if (vehicle != null)
//.........这里部分代码省略.........
开发者ID:Robobeurre,项目名称:NRaas,代码行数:101,代码来源:SimEx.cs

示例7: CanSkinnyDipAtLocation

        public static bool CanSkinnyDipAtLocation(Sim a, Vector3 position, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool okIfNoExistingSkinnyDippers, bool okIfAloneAndRomantic)
        {
            if (!GameUtils.IsInstalled(ProductVersion.EP3))
            {
                return false;
            }

            if (a.Posture is CarryingChildPosture)
            {
                return false;
            }
            if (a.HasTrait(TraitNames.NeverNude) || a.HasTrait(TraitNames.Shy))
            {
                return false;
            }

            if (Woohooer.Settings.mAllowTeenSkinnyDip)
            {
                if (a.SimDescription.ChildOrBelow)
                {
                    return false;
                }
            }
            else
            {
                if (a.SimDescription.TeenOrBelow)
                {
                    return false;
                }
            }
            /*
            if (a.SimDescription.IsVisuallyPregnant)
            {
                greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Common.LocalizeEAString(a.IsFemale, "Gameplay/Actors/Sim:PregnantFailure", new object[0x0]));
              
                return false;
            }
            */
            if (!Pool.SimOutfitSupportsSkinnyDipping(a, ref greyedOutTooltipCallback))
            {
                return false;
            }

            bool flag = okIfNoExistingSkinnyDippers;
            bool notRomantic = false;
            bool result = false;
            bool kidsAround = false;
            LotLocation location = new LotLocation();
            ulong lotLocation = World.GetLotLocation(position, ref location);
            bool outside = World.IsPositionOutside(position);
            short mRoom = location.mRoom;

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

            if (Woohooer.Settings.mEnforceSkinnyDipPrivacy)
            {
                Lot lot = LotManager.GetLot(lotLocation);
                if ((lot != null) && (!lot.IsWorldLot))
                {
                    lotSims = new List<Sim>(lot.GetSims());
                    if (outside)
                    {
                        List<Sim> list2 = new List<Sim>(Sims3.Gameplay.Queries.GetObjects<Sim>(position, Pool.kRadiusToCheckForKids));
                        foreach (Sim sim in list2)
                        {
                            if (sim.LotCurrent == null) continue;

                            if (sim.LotCurrent.LotId != lotLocation)
                            {
                                lotSims.Add(sim);
                            }
                        }
                    }
                }
            }

            foreach (Sim sim2 in lotSims)
            {
                if (sim2 == a) continue;
                
                if (sim2.SimDescription.ToddlerOrBelow) continue;

                bool checkAge = false;
                if (Woohooer.Settings.mAllowTeenSkinnyDip)
                {
                    if (sim2.SimDescription.ChildOrBelow)
                    {
                        checkAge = true;
                    }
                }
                else
                {
                    if (sim2.SimDescription.TeenOrBelow)
                    {
                        checkAge = true;
                    }
                }

                if (checkAge)
                {
//.........这里部分代码省略.........
开发者ID:Robobeurre,项目名称:NRaas,代码行数:101,代码来源:CommonSkinnyDip.cs

示例8: TestFight

        public static bool TestFight(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                if (!CommonTest(actor, target)) return false;

                if (TestBarBrawl(actor, target, topic, isAutonomous, ref greyedOutTooltipCallback))
                {
                    return false;
                }
                else if ((actor.SimDescription.ChildOrBelow) || (target.SimDescription.ChildOrBelow))
                {
                    if ((actor.SimDescription.YoungAdultOrAbove) || (target.SimDescription.YoungAdultOrAbove))
                    {
                        return false;
                    }
                }

                if (target.Service is Burglar)
                {
                    BurglarSituation situation = ServiceSituation.FindServiceSituationInvolving(target) as BurglarSituation;
                    if (((situation != null) && (situation.HasBeenApprehended || situation.HasBeenDefeated)) || (target.LotCurrent != Household.ActiveHousehold.LotHome))
                    {
                        return false;
                    }
                    else if ((!actor.IsBrave && !actor.BuffManager.HasElement(BuffNames.OddlyPowerful)) && !actor.TraitManager.HasElement(TraitNames.CanApprehendBurglar))
                    {
                        return false;
                    }
                    return true;
                }

                if ((actor.Genealogy == null) || (target.Genealogy == null))
                {
                    return false;
                }

                Relationship relationship = Relationship.Get(actor, target, false);
                if ((actor.HasTrait(TraitNames.MeanSpirited) && (relationship != null)) && ((relationship.AreFriendsOrRomantic() || (actor.Household.Contains(target.SimDescription) && (relationship.LTR.Liking >= 0f))) || target.Genealogy.IsParentOrStepParent(actor.Genealogy)))
                {
                    return false;
                }

                return (((relationship == null) || (relationship.LTR.Liking < SocialComponent.kFightLikingValue)) && !target.Genealogy.IsParentOrStepParent(actor.Genealogy));
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return false;
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:51,代码来源:FixTestBarBrawl.cs

示例9: TestLetsStartGroup

        public static bool TestLetsStartGroup(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool isDate)
        {
            try
            {
                OccultImaginaryFriend friend;
                Service service = target.Service;
                if (((target.Service is GrimReaper) || (service is Butler)) || (target.IsNPC && target.SimDescription.IsGhost))
                {
                    return false;
                }
                else if (OccultImaginaryFriend.TryGetOccultFromSim(target, out friend) && !friend.IsReal)
                {
                    return false;
                }
                else if (Punishment.IsSimGrounded(actor) || Punishment.IsSimGrounded(target))
                {
                    return false;
                }

                GroupingSituation situationOfType = actor.GetSituationOfType<GroupingSituation>();
                if (situationOfType != null)
                {
                    if (situationOfType.IsSimInGroup(target))
                    {
                        return false;
                    }
                    else if (actor.HasTrait(TraitNames.Loner) && (situationOfType.Count >= GroupingSituation.kNumSimBeforeLonerQuits))
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(GroupingSituation.LocalizeString("FormDisabledForLoner", new object[0x0]));
                        return false;
                    }
                    else if (situationOfType.RomanticGrouping)
                    {
                        return false;
                    }
                    else if (isDate)
                    {
                        return false;
                    }
                    // Custom IsValidDateOrGroup
                    else if (!IsValidDateOrGroup(actor, target, isDate))
                    {
                        return false;
                    }

                    return !situationOfType.MaxGroupSizedReached();
                }

                if (actor.Household == target.Household)
                {
                    situationOfType = target.GetSituationOfType<GroupingSituation>();
                    if (situationOfType != null)
                    {
                        // Custom IsValidDateOrGroup
                        return (((!situationOfType.RomanticGrouping && !isDate) && IsValidDateOrGroup(actor, target, isDate)) && !situationOfType.MaxGroupSizedReached());
                    }
                }

                Sim sim = null;
                foreach (Sim sim2 in actor.Household.Sims)
                {
                    if (sim2 != actor)
                    {
                        situationOfType = sim2.GetSituationOfType<GroupingSituation>();
                        if ((situationOfType != null) && (situationOfType.Leader == sim2))
                        {
                            sim = sim2;
                            break;
                        }
                    }
                }

                // Custom IsValidDateOrGroup
                if (!IsValidDateOrGroup(actor, target, isDate))
                {
                    return false;
                }
                else if (sim != null)
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(actor.IsFemale, "Gameplay/Excel/Notifications/Notifications:GroupingAlreadyStarted", new object[] { sim }));
                    return false;
                }

                TraitManager traitManager = actor.TraitManager;
                if ((isDate && (traitManager != null)) && !traitManager.HasElement(TraitNames.HopelessRomantic))
                {
                    Relationship relationship = Relationship.Get(actor, target, false);
                    if ((relationship != null) && (SimClock.ElapsedTime(TimeUnit.Hours, relationship.WhenLastHadBadDate) < GroupingSituation.kBadDateCooldownTime))
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(GroupingSituation.LocalizeString("BadDateCooldownTooltip", new object[0x0]));
                        return false;
                    }
                }
                return true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
//.........这里部分代码省略.........
开发者ID:Robobeurre,项目名称:NRaas,代码行数:101,代码来源:CommonSocials.cs

示例10: CommonSpellTests

        public static bool CommonSpellTests(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {            
            if (!a.HasTrait(TraitNames.WitchHiddenTrait))
            {
                return false;
            }
            if (target.SimDescription.IsEP11Bot)
            {
                greyedOutTooltipCallback = Common.DebugTooltip("Plumbot Fail");
                return false;
            }
            if (!a.Posture.AllowsNormalSocials())
            {
                greyedOutTooltipCallback = Common.DebugTooltip("NormalSocials Fail");
                return false;
            }
            if (!target.Posture.AllowsNormalSocials())
            {
                greyedOutTooltipCallback = Common.DebugTooltip("NormalSocials Fail");
                return false;
            }
            if (!a.SimDescription.ShowSocialsOnSim)
            {
                greyedOutTooltipCallback = Common.DebugTooltip("ShowSocialsOnSim Fail");
                return false;
            }
            if (!target.SimDescription.IsZombie)
            {
                if (!target.SimDescription.ShowSocialsOnSim)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("ShowSocialsOnSim Fail");
                    return false;
                }
                if (!target.CanBeSocializedWith || !a.CanBeSocializedWith)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("CanBeSocializedWith Fail");
                    return false;
                }
            }
            if (SocialComponent.IsInServicePreventingSocialization(target))
            {
                greyedOutTooltipCallback = Common.DebugTooltip("IsInServicePreventingSocialization Fail");
                return false;
            }
            if ((target.SimDescription.AssignedRole != null) && (((target.SimDescription.AssignedRole.Type == Role.RoleType.LocationMerchant) || (target.SimDescription.AssignedRole.Type == Role.RoleType.GenericMerchant)) || (((target.SimDescription.AssignedRole.Type == Role.RoleType.PetStoreMerchant) || (target.SimDescription.AssignedRole.Type == Role.RoleType.HobbyShopMerchant)) || (target.SimDescription.AssignedRole.Type == Role.RoleType.PotionShopMerchant))))
            {
                greyedOutTooltipCallback = Common.DebugTooltip("Merchant Fail");
                return false;
            }
            if ((target.Service != null) && (target.Service is GrimReaper))
            {
                greyedOutTooltipCallback = Common.DebugTooltip("Reaper Fail");
                return false;
            }
            
            IPreventSocialization currentInteraction = target.CurrentInteraction as IPreventSocialization;
            if ((currentInteraction != null) && !currentInteraction.SocializationAllowed(a, target))
            {
                greyedOutTooltipCallback = Common.DebugTooltip("SocializationAllowed Fail");
                return false;
            }

            if (target.SimDescription.ChildOrBelow || target.SimDescription.IsPet)
            {
                greyedOutTooltipCallback = Common.DebugTooltip("Child/Pet Fail");
                return false;
            }
            return true;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:69,代码来源:CastSpellEx.cs

示例11: CreateInventionAndAddToInventory

        private static void CreateInventionAndAddToInventory(InventionData data, Sim Actor, bool isCheapToy, out GameObject invention)
        {
            Simulator.ObjectInitParameters initData = null;
            InventingSkill skill = Actor.SkillManager.GetSkill<InventingSkill>(SkillNames.Inventing);
            bool isImprovedWidget = false;
            if (data.InventType == InventionType.Widget)
            {
                Widget.Awesomeness standard = Widget.Awesomeness.Standard;
                if (skill.OppMasterInventorCompleted)
                {
                    standard = Widget.Awesomeness.Masterful;
                }
                else if (skill.OppWidgetWonderCompleted)
                {
                    standard = Widget.Awesomeness.Improved;
                }
                else
                {
                    float chance = 0f;
                    if (skill.SkillLevel >= InventionWorkbench.kLevelCanMakeImprovedWidget)
                    {
                        chance += InventionWorkbench.kChanceOfImprovedWidget;
                        if (Actor.HasTrait(TraitNames.Eccentric))
                        {
                            chance += InventionWorkbench.kChanceOfImprovedWidgetEccentric;
                        }
                        if (RandomUtil.RandomChance01(chance))
                        {
                            standard = Widget.Awesomeness.Improved;
                        }
                    }
                }
                isImprovedWidget = standard == Widget.Awesomeness.Improved;
                initData = new WidgetInitParameters(standard, Actor.SimDescription, data.InventType, data.MedatorName);
            }

            if ((data.InventType == InventionType.Invention) || (data.InventType == InventionType.Toy))
            {
                initData = new CraftedToyInitParameters(skill.OppMasterInventorCompleted, Actor.SimDescription, data.InventType, isCheapToy);
            }

            invention = GlobalFunctions.CreateObject(data.MedatorName, data.ProdVersion, Vector3.OutOfWorld, 0x0, Vector3.UnitZ, null, initData) as GameObject;
            if (invention != null)
            {
                skill.RegisterInventionMade(data);
                if (data.PutInFamilyInventory)
                {
                    if (!Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(invention))
                    {
                        invention.Destroy();
                        invention = null;
                    }
                }
                else if (!Inventories.TryToMove(invention, Actor))
                {
                    invention.Destroy();
                    invention = null;
                }
                if (invention != null)
                {
                    EventTracker.SendEvent(new CreatedInventionEvent(EventTypeId.kCreatedInvention, Actor, invention, data.InventType, isImprovedWidget));
                    if (data.InventType == InventionType.Widget)
                    {
                        EventTracker.SendEvent(EventTypeId.kInventorMadeWidget, Actor);
                    }
                    if (invention is TimeMachine)
                    {
                        EventTracker.SendEvent(EventTypeId.kInventorMadeTimeMachine, Actor);
                    }
                }
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:72,代码来源:MakeInventionEx.cs

示例12: CheckCheating

        public static bool CheckCheating(Sim observer, Sim actor, Sim target, JealousyLevel jealousyLevel)
        {
            if (CommonSocials.IsPolyamorous(actor.SimDescription, target.SimDescription, observer.SimDescription)) return false;

            if (target.HasTrait(TraitNames.NoJealousy)) return false;

            if (!actor.HasTrait(TraitNames.NoJealousy) && (jealousyLevel != JealousyLevel.None))
            {
                foreach (Situation situation in actor.Autonomy.SituationComponent.Situations)
                {
                    if (situation.DoesSituationRuleOutJealousy(observer, actor, target, jealousyLevel))
                    {
                        return false;
                    }
                }

                Relationship relationship = Relationship.Get(observer, actor, false);
                if (relationship != null)
                {
                    if (!LTRData.Get(relationship.LTR.CurrentLTR).IsRomantic)
                    {
                        if ((actor.Partner != null) && (actor.Partner != target.SimDescription))
                        {
                            bool flag = observer.Genealogy.IsBloodRelated(actor.Partner.Genealogy);
                            Relationship relationship2 = Relationship.Get(observer.SimDescription, actor.Partner, false);
                            if (relationship2 != null)
                            {
                                LTRData data2 = LTRData.Get(relationship2.LTR.CurrentLTR);
                                flag |= data2.IsFriendly;
                            }

                            if (flag)
                            {
                                SocialComponent.OnSomeoneICareAboutWasCheatedOn(observer, actor.Partner, actor.SimDescription, target.SimDescription, jealousyLevel);
                                return true;
                            }
                        }
                    }
                    else
                    {
                        // Custom
                        switch (jealousyLevel)
                        {
                            case JealousyLevel.Medium:
                            case JealousyLevel.High:
                                GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                                if (CommonSocials.TestAllowBreakup(actor, true, ref greyedOutTooltipCallback))
                                {
                                    RomanceVisibilityState.PushAccuseSimOfBetrayal(observer, actor);
                                }
                                return true;
                        }

                        LongTermRelationshipTypes longTermRelationship = Relationship.GetLongTermRelationship(observer, actor);
                        SocialComponent.PlayReactionAndUpdateRelationshipOnJealousy(observer, actor.SimDescription, target.SimDescription, jealousyLevel);
                        LongTermRelationshipTypes currentLTR = Relationship.GetLongTermRelationship(observer, actor);
                        SocialComponent.SetSocialFeedback(CommodityTypes.Insulting, observer, false, 0x0, longTermRelationship, currentLTR);
                        return true;
                    }
                }
            }
            return false;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:63,代码来源:SocialComponentEx.cs

示例13: CaresAboutJealousy

        public static bool CaresAboutJealousy(Sim actor, Sim target, Sim witness, JealousyLevel level, bool woohoo)
        {
            if (actor.HasTrait(TraitNames.NoJealousy)) return false;

            if (target.HasTrait(TraitNames.NoJealousy)) return false;

            if (CommonSocials.IsPolyamorous(actor.SimDescription, target.SimDescription, witness.SimDescription)) return false;

            foreach (Situation situation in actor.Autonomy.SituationComponent.Situations)
            {
                if (situation.DoesSituationRuleOutJealousy(witness, actor, target, level))
                {
                    return false;
                }
            }

            if (witness.RoomId == actor.RoomId)
            {
                return true;
            }
            else if (woohoo)
            {
                if (witness.IsOutside != actor.IsOutside)
                {
                    return false;
                }
                else
                {
                    int diff = witness.Level - actor.Level;
                    if (diff < 0)
                    {
                        diff = -diff;
                    }

                    if ((actor.Level < 0) && (diff > 0))
                    {
                        return false;
                    }
                    else if ((actor.Level >= 0) && (diff > 1))
                    {
                        return false;
                    }
                    else if (witness.CurrentInteraction is ISleeping)
                    {
                        return witness.TraitManager.HasElement(TraitNames.LightSleeper);
                    }
                    else
                    {
                        return true;
                    }
                }
            }
            else
            {
                return false;
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:57,代码来源:CommonSocials.cs

示例14: CommonCheatingTest

        private static bool CommonCheatingTest(Sim betrayer, Sim victim)
        {
            BuffBetrayed.BuffInstanceBetrayed betrayed;
            Relationship relationship = Relationship.Get(betrayer, victim, false);
            if (relationship == null) return false;

            if (!relationship.AreRomantic()) return false;

            if (BuffBetrayed.DoesSimFeelBetrayed(victim, betrayer.SimDescription, out betrayed)) return false;

            if (!WoohooScoring.ReactsToJealousy(victim)) return false;

            if (betrayer.HasTrait(TraitNames.NoJealousy)) return false;

            if (betrayer.HasTrait(TraitNames.AboveReproach)) return false;

            if (RomanceVisibilityState.GetActiveRomanceCount(betrayer.SimDescription) <= 1) return false;

            return true;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:20,代码来源:CommonSocials.cs

示例15: ReactsToJealousy

        public static bool ReactsToJealousy(Sim actor)
        {
            if (actor.SimDescription.ToddlerOrBelow) return false;

            if (KamaSimtra.IsWhoring(actor)) return false;

            if (actor.HasTrait(TraitNames.InappropriateButInAGoodWay)) return false;

            if (!Woohooer.Settings.UsingTraitScoring) return true;

            if (Woohooer.Settings.mReactToJealousyBaseChanceScoring <= 0) return false;

            return TestScoringAbsolute(actor, null, "ReactsToJealousy", false);
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:14,代码来源:WoohooScoring.cs


注:本文中的Sim.HasTrait方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。