Esempio n. 1
0
        public static bool CheckExpress_Prefix(FavorObject favorObj, ref int failReason, ref bool __result)
        {
            if (!enabled)
            {
                return(true);
            }

            if (!Environment.StackTrace.Contains("ExecuteGiveGift"))
            {
                return(true);
            }

            //Dbgl($"Checking confession for {favorObj.ID}");

            if (romanceMeta == null)
            {
                Dbgl("Problem getting romance meta data");
                return(true);
            }

            FavorRelationshipData refData = FavorRelationshipData.GetRefData((int)favorObj.Relationship);

            if (refData.canExpress)
            {
                float num = (refData.expressChance[1] - refData.expressChance[0]) * (float)(favorObj.FavorValue - refData.MinValue) / (float)(refData.MaxValue - refData.MinValue) + refData.expressChance[0];
                num += Module <FeatureModule> .Self.ModifyFloat(FeatureType.ExpressSucceedRatio, new object[] { num });

                float baseChance = num;

                Dbgl($"Vanilla confession chance: {baseChance }");


                num += settings.ConfessPercentChanceIncrease * 0.01f;

                RomanceCounts rc = romanceMeta.romances.Find(r => r.id == favorObj.ID);
                if (rc != null)
                {
                    num += settings.ConfessPercentChanceIncreasePerConfession * 0.01f * rc.confessions;
                }

                Dbgl($"Modified confession chance: {num}");

                if (new System.Random().NextDouble() < num)
                {
                    __result = true;
                    return(false);
                }
            }
            failReason = 6;
            __result   = false;
            return(false);
        }
Esempio n. 2
0
        public static bool CheckPropose_Prefix(FavorObject favorObj, ref int failReason, ref bool __result)
        {
            if (!enabled)
            {
                return(true);
            }

            if (!Environment.StackTrace.Contains("ExecuteGiveGift"))
            {
                return(true);
            }

            //Dbgl($"Checking proposal for {favorObj.ID}");

            if (romanceMeta == null)
            {
                Dbgl("Problem getting romance meta data");
                return(true);
            }

            FavorRelationshipData refData = FavorRelationshipData.GetRefData((int)favorObj.Relationship);

            if (refData.canPropose)
            {
                float num = (refData.proposeChance[1] - refData.proposeChance[0]) * (float)(favorObj.FavorValue - refData.MinValue) / (float)(refData.MaxValue - refData.MinValue) + refData.proposeChance[0];

                Dbgl($"Vanilla confession chance: {num}");

                num += settings.ProposePercentChanceIncrease * 0.01f;

                RomanceCounts rc = romanceMeta.romances.Find(r => r.id == favorObj.ID);
                if (rc != null)
                {
                    num += settings.ProposePercentChanceIncreasePerProposal * 0.01f * rc.proposals;
                }

                Dbgl($"Modified confession chance: {num}");

                if (new System.Random().NextDouble() < num)
                {
                    __result = true;
                    return(false);
                }
            }
            failReason = 12;
            __result   = false;
            return(false);
        }