Beispiel #1
0
        public static int CalledShotModifier(this AbstractActor actor)
        {
            int mod = 0;

            // Calculate the pilot mod, if any
            if (actor.GetPilot() != null)
            {
                Pilot  pilot    = actor.GetPilot();
                string pilotKey = pilot.CacheKey();
                bool   hasPilot = ModState.PilotCalledShotModifiers.TryGetValue(pilot.CacheKey(), out mod);
                if (!hasPilot)
                {
                    // Calculate the modifiers for the pilot
                    Mod.Log.Info?.Write($" Calculating calledShotModifier for actor: {actor.DistinctId()}");
                    int baseMod    = Mod.Config.Combat.CalledShot.BaseModifier;
                    int tacticsMod = Mod.Config.Combat.CalledShot.EnableTacticsModifier ?
                                     (-1 * SkillUtils.GetTacticsModifier(pilot)) : 0;
                    int tagsCSMod = SkillUtils.GetTagsModifier(pilot, Mod.Config.Combat.CalledShot.PilotTags);

                    // Calculate the actor mod, if any
                    int actorMod = actor.StatCollection.GetValue <int>(ModStats.CalledShot_AttackMod);

                    int calledShotMod = baseMod + tacticsMod + tagsCSMod + actorMod;
                    Mod.Log.Info?.Write($" -- calledShotMod: {calledShotMod} = defaultMod: {baseMod} + tacticsMod: {tacticsMod} + tagsCSMod: {tagsCSMod} + actorMod: {actorMod}");

                    ModState.PilotCalledShotModifiers[pilotKey] = calledShotMod;
                }
                else
                {
                    Mod.Log.Debug?.Write($"CalledShotModifier: {mod} for actor: {actor.DistinctId()}");
                }
            }

            return(mod);
        }
Beispiel #2
0
        public static int GetCalledShotModifier(Pilot pilot)
        {
            int mod = 0;

            string pilotKey = GetPilotKey(pilot);

            if (!ModState.PilotCalledShotModifiers.ContainsKey(pilotKey))
            {
                Mod.Log.Debug($" Calculating calledShotModifier for pilot:{pilotKey}");
                int defaultMod    = Mod.Config.Combat.CalledShot.Modifier;
                int tacticsMod    = SkillUtils.GetTacticsModifier(pilot);
                int tagsCSMod     = SkillUtils.GetTagsModifier(pilot, Mod.Config.Combat.CalledShot.PilotTags);
                int calledShotMod = defaultMod + (-1 * (tacticsMod + tagsCSMod));
                Mod.Log.Debug($" Pilot:{pilotKey} has calledShotMod:{calledShotMod} = defaultMod:{defaultMod} + (-1 * (tacticsMod:{tacticsMod} + tagsCSMod:{tagsCSMod}))");
                ModState.PilotCalledShotModifiers[pilotKey] = calledShotMod;
            }
            else
            {
                mod = ModState.PilotCalledShotModifiers[pilotKey];
            }

            return(mod);
        }