Ejemplo n.º 1
0
 static void Postfix(ref bool __result, RuleAttackRoll __instance)
 {
     if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, settings.allHitsCritical))
     {
         __result = true;
     }
 }
Ejemplo n.º 2
0
            static void Postfix(ref bool __result, RuleSavingThrow __instance)
            {
                if (settings.toggleNoFriendlyFireForAOE)
                {
                    if (__instance.Reason != null)
                    {
                        if (__instance.Reason.Ability != null)
                        {
                            if (__instance.Reason.Caster != null && __instance.Reason.Caster.IsPlayerFaction && __instance.Initiator.IsPlayerFaction && __instance.Reason.Ability.Blueprint != null && ((__instance.Reason.Ability.Blueprint.EffectOnAlly == AbilityEffectOnUnit.Harmful) || (__instance.Reason.Ability.Blueprint.EffectOnEnemy == AbilityEffectOnUnit.Harmful)))
                            {
                                __result = true;
                            }
                        }
                    }
                }
#if false
                if (StringUtils.ToToggleBool(settings.togglePassSavingThrowIndividual))
                {
                    for (int i = 0; i < settings.togglePassSavingThrowIndividualArray.Count(); i++)
                    {
                        if (StringUtils.ToToggleBool(settings.togglePassSavingThrowIndividualArray[i]) && Storage.statsSavesDict[Storage.individualSavesArray[i]] == __instance.StatType)
                        {
                            if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, (UnitSelectType)settings.indexPassSavingThrowIndividuall))
                            {
                                __result = true;
                            }
                        }
                    }
                }
#endif
            }
Ejemplo n.º 3
0
            public static void Prefix(UnitEntityData initiator, BlueprintUnit blueprint, Vector3 position, ref Rounds duration, ref int level, RuleSummonUnit __instance)
            {
                Mod.Debug($"old duration: {duration} level: {level} \n mult: {settings.summonDurationMultiplier1} levelInc: {settings.summonLevelModifier1}\n initiatior: {initiator} tweakTarget: {settings.summonTweakTarget1} shouldTweak: {UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.summonTweakTarget1)}");
                if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.summonTweakTarget1))
                {
                    if (settings.summonDurationMultiplier1 != 1)
                    {
                        duration = new Rounds(Convert.ToInt32(duration.Value * settings.summonDurationMultiplier1));
                    }
                    if (settings.summonLevelModifier1 != 0)
                    {
                        level = Math.Max(0, Math.Min(level + (int)settings.summonLevelModifier1, 20));
                    }
                }
                else if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.summonTweakTarget2))
                {
                    if (settings.summonDurationMultiplier2 != 1)
                    {
                        duration = new Rounds(Convert.ToInt32(duration.Value * settings.summonDurationMultiplier2));
                    }
                    if (settings.summonLevelModifier2 >= 0)
                    {
                        level = Math.Max(0, Math.Min(level + (int)settings.summonLevelModifier1, 20));
                    }
                }
                Mod.Debug($"new duration: {duration} level: {level}");

                if (settings.toggleMakeSummmonsControllable)
                {
                    SummonedByPlayerFaction = initiator.IsPlayerFaction;
                }
                Mod.Debug("Initiator: " + initiator.CharacterName + $"(PlayerFaction : {initiator.IsPlayerFaction})" + "\nBlueprint: " + blueprint.CharacterName + "\nDuration: " + duration.Value);
            }
Ejemplo n.º 4
0
 static bool Prefix(UnitEntityData target)
 {
     if (UnitEntityDataUtils.CheckUnitEntityData(target, settings.noAttacksOfOpportunitySelection))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 5
0
            private static void Postfix(RuleRollDice __instance)
            {
                if (__instance.DiceFormula.Dice != DiceType.D20)
                {
                    return;
                }
                var initiator = __instance.Initiator;
                var result    = __instance.m_Result;

                //modLogger.Log($"initiator: {initiator.CharacterName} isInCombat: {initiator.IsInCombat} alwaysRole20OutOfCombat: {settings.alwaysRoll20OutOfCombat}");
                //Mod.Debug($"initiator: {initiator.CharacterName} Initial D20Roll: " + result);
                if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.alwaysRoll20) ||
                    (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.alwaysRoll20OutOfCombat) &&
                     !initiator.IsInCombat
                    )
                    )
                {
                    result = 20;
                }
                else if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.alwaysRoll1))
                {
                    result = 1;
                }
                else
                {
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.rollWithAdvantage))
                    {
                        result = Math.Max(result, UnityEngine.Random.Range(1, 21));
                    }
                    else if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.rollWithDisadvantage))
                    {
                        result = Math.Min(result, UnityEngine.Random.Range(1, 21));
                    }
                    var min = 1;
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.neverRoll1) && result == 1)
                    {
                        result = UnityEngine.Random.Range(2, 21);
                        min    = 2;
                    }
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.take10always) && result < 10 && !initiator.IsInCombat)
                    {
                        result = 10;
                        min    = 10;
                    }
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.take10minimum) && result < 10 && !initiator.IsInCombat)
                    {
                        result = UnityEngine.Random.Range(10, 21);
                        min    = 10;
                    }
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.neverRoll20) && result == 20)
                    {
                        result = UnityEngine.Random.Range(min, 20);
                    }
                }
                //Mod.Debug("Modified D20Roll: " + result);
                __instance.m_Result = result;
            }
Ejemplo n.º 6
0
 private static bool Prefix(UnitEntityData target)
 {
     if (settings.toggleAttacksofOpportunity && target.IsPlayerFaction)
     {
         return(false);
     }
     if (UnitEntityDataUtils.CheckUnitEntityData(target, settings.noAttacksOfOpportunitySelection))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 7
0
 static void Postfix(RuleInitiativeRoll __instance, ref int __result)
 {
     if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, settings.roll1Initiative))
     {
         __result = 1;
         Logger.ModLoggerDebug("Modified InitiativeRoll: " + __result);
     }
     if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, settings.roll20Initiative))
     {
         __result = 20;
         Logger.ModLoggerDebug("Modified InitiativeRoll: " + __result);
     }
 }
Ejemplo n.º 8
0
 private static void Postfix(RuleInitiativeRoll __instance, ref int __result)
 {
     if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, settings.roll1Initiative))
     {
         __result = 1 + __instance.Modifier;
         Mod.Trace("Modified InitiativeRoll: " + __result);
     }
     else if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, settings.roll20Initiative))
     {
         __result = 20 + __instance.Modifier;
         Mod.Trace("Modified InitiativeRoll: " + __result);
     }
 }
Ejemplo n.º 9
0
            private static void Postfix(ref bool __result, RulePartyStatCheck __instance)
            {
                if (settings.toggleNoFriendlyFireForAOE)
                {
                    if (__instance.Reason != null)
                    {
                        if (__instance.Reason.Ability != null)
                        {
                            if (__instance.Reason.Caster != null && __instance.Reason.Caster.Descriptor.IsPartyOrPet() && __instance.Initiator.Descriptor.IsPartyOrPet() && __instance.Reason.Ability.Blueprint != null && ((__instance.Reason.Ability.Blueprint.EffectOnAlly == AbilityEffectOnUnit.Harmful) || (__instance.Reason.Ability.Blueprint.EffectOnEnemy == AbilityEffectOnUnit.Harmful)))
                            {
                                __result = true;
                            }
                        }
                    }
                }
#if false
                if (StringUtils.ToToggleBool(settings.togglePassSavingThrowIndividual))
                {
                    for (int i = 0; i < settings.togglePassSavingThrowIndividualArray.Count(); i++)
                    {
                        if (StringUtils.ToToggleBool(settings.togglePassSavingThrowIndividualArray[i]) && Storage.statsSavesDict[Storage.individualSavesArray[i]] == __instance.StatType)
                        {
                            if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, (UnitSelectType)settings.indexPassSavingThrowIndividuall))
                            {
                                __result = true;
                            }
                        }
                    }
                }
                if (StringUtils.ToToggleBool(settings.togglePassSkillChecksIndividual))
                {
                    for (int i = 0; i < settings.togglePassSkillChecksIndividualArray.Count(); i++)
                    {
                        if (StringUtils.ToToggleBool(settings.togglePassSkillChecksIndividualArray[i]) && Storage.statsSkillsDict.Union(Storage.statsSocialSkillsDict).ToDictionary(d => d.Key, d => d.Value)[Storage.individualSkillsArray[i]] == __instance.StatType)
                        {
                            if (UnitEntityDataUtils.CheckUnitEntityData(__instance.Initiator, (UnitSelectType)settings.indexPassSkillChecksIndividual))
                            {
                                __result = true;
                            }
                        }
                    }
                }
#endif
            }
Ejemplo n.º 10
0
            static void Postfix(RuleRollDice __instance)
            {
                if (__instance.DiceFormula.Dice != DiceType.D20)
                {
                    return;
                }
                var initiator = __instance.Initiator;
                int result    = __instance.m_Result;

                Logger.ModLoggerDebug("Initial D20Roll: " + result);
                if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.alwaysRoll20))
                {
                    result = 20;
                }
                else if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.alwaysRoll1))
                {
                    result = 1;
                }
                else
                {
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.rollWithAdvantage))
                    {
                        result = Math.Max(result, UnityEngine.Random.Range(1, 21));
                    }
                    else if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.rollWithDisadvantage))
                    {
                        result = Math.Min(result, UnityEngine.Random.Range(1, 21));
                    }
                    int min = 1;
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.neverRoll1) && result == 1)
                    {
                        result = UnityEngine.Random.Range(2, 21);
                        min    = 2;
                    }
                    if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.neverRoll20) && result == 20)
                    {
                        result = UnityEngine.Random.Range(min, 20);
                    }
                }
                Logger.ModLoggerDebug("Modified D20Roll: " + result);
                __instance.m_Result = result;
            }