Beispiel #1
0
        static void Postfix(PLShieldGenerator __instance, ref string __result)
        {
            int subtypeformodded = __instance.SubType - ShieldModManager.Instance.VanillaShieldMaxType;

            if (subtypeformodded > -1 && subtypeformodded < ShieldModManager.Instance.ShieldTypes.Count && __instance.ShipStats != null)
            {
                __result = ShieldModManager.Instance.ShieldTypes[subtypeformodded].GetStatLineRight(__instance);
            }
        }
Beispiel #2
0
        static void Postfix(PLShieldGenerator __instance)
        {
            int subtypeformodded = __instance.SubType - ShieldModManager.Instance.VanillaShieldMaxType;

            if (subtypeformodded > -1 && subtypeformodded < ShieldModManager.Instance.ShieldTypes.Count && __instance.ShipStats != null)
            {
                ShieldModManager.Instance.ShieldTypes[subtypeformodded].Tick(__instance);
            }
        }
Beispiel #3
0
        public static PLShieldGenerator CreateShield(int Subtype, int level)
        {
            PLShieldGenerator InShield;

            if (Subtype >= Instance.VanillaShieldMaxType)
            {
                InShield = new PLShieldGenerator(EShieldGeneratorType.E_SG_ID_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaShieldMaxType;
                if (Global.DebugLogging)
                {
                    Logger.Info($"Subtype for modded is {subtypeformodded}");
                }
                if (subtypeformodded <= Instance.ShieldTypes.Count && subtypeformodded > -1)
                {
                    if (Global.DebugLogging)
                    {
                        Logger.Info("Creating Shield from list info");
                    }
                    ShieldPlugin ShieldType = Instance.ShieldTypes[Subtype - Instance.VanillaShieldMaxType];
                    InShield.SubType = Subtype;
                    InShield.Name    = ShieldType.Name;
                    InShield.Desc    = ShieldType.Description;
                    InShield.GetType().GetField("m_IconTexture", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InShield, ShieldType.IconTexture);
                    InShield.Max           = ShieldType.ShieldMax;
                    InShield.ChargeRateMax = ShieldType.ChargeRateMax;
                    InShield.RecoveryRate  = ShieldType.RecoveryRate;
                    InShield.Deflection    = ShieldType.Deflection;
                    InShield.MinIntegrityPercentForQuantumShield = ShieldType.MinIntegrityPercentForQuantumShield;
                    InShield.MinIntegrityAfterDamage             = ShieldType.MinIntegrityAfterDamage;
                    InShield.GetType().GetField("m_MaxPowerUsage_Watts", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InShield, (ShieldType.MaxPowerUsage_Watts * 1.4f));
                    InShield.GetType().GetField("m_MarketPrice", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InShield, (ObscuredInt)ShieldType.MarketPrice);
                    InShield.CargoVisualPrefabID     = ShieldType.CargoVisualID;
                    InShield.CanBeDroppedOnShipDeath = ShieldType.CanBeDroppedOnShipDeath;
                    InShield.Experimental            = ShieldType.Experimental;
                    InShield.Unstable   = ShieldType.Unstable;
                    InShield.Contraband = ShieldType.Contraband;
                    InShield.GetType().GetField("Price_LevelMultiplierExponent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InShield, (ObscuredFloat)ShieldType.Price_LevelMultiplierExponent);
                    if (InShield.MinIntegrityAfterDamage == -1)
                    {
                        InShield.MinIntegrityAfterDamage = Mathf.RoundToInt(InShield.Max * 0.15f);
                    }
                    InShield.MinIntegrityAfterDamage = Mathf.RoundToInt(InShield.MinIntegrityAfterDamage * (1f - Mathf.Clamp(0.05f * InShield.Level, 0f, 0.8f)));
                    InShield.CurrentMax = InShield.Max;
                    InShield.Current    = InShield.Max;
                }
            }
            else
            {
                InShield = new PLShieldGenerator((EShieldGeneratorType)Subtype, level);
            }
            return(InShield);
        }
        public override string GetStatLineRight(PLShipComponent InComp)
        {
            PLShieldGenerator me = InComp as PLShieldGenerator;

            return(string.Concat(new string[]
            {
                (me.Max * me.LevelMultiplier(0.25f, 1f)).ToString("0"),
                "\n",
                (me.ChargeRateMax * me.LevelMultiplier(0.5f, 1f)).ToString("0"),
                "\n",
                (me.MinIntegrityPercentForQuantumShield * 100f).ToString("0"),
                "%"
            }));
        }
Beispiel #5
0
        public static PLShieldGenerator CreateShield(int Subtype, int level)
        {
            PLShieldGenerator InShield;

            if (Subtype >= Instance.VanillaShieldMaxType)
            {
                InShield = new PLShieldGenerator(EShieldGeneratorType.E_SG_ID_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaShieldMaxType;
                if (subtypeformodded <= Instance.ShieldTypes.Count && subtypeformodded > -1)
                {
                    ShieldMod ShieldType = Instance.ShieldTypes[Subtype - Instance.VanillaShieldMaxType];
                    InShield.SubType       = Subtype;
                    InShield.Name          = ShieldType.Name;
                    InShield.Desc          = ShieldType.Description;
                    InShield.m_IconTexture = ShieldType.IconTexture;
                    InShield.Max           = ShieldType.ShieldMax;
                    InShield.ChargeRateMax = ShieldType.ChargeRateMax;
                    InShield.RecoveryRate  = ShieldType.RecoveryRate;
                    InShield.Deflection    = ShieldType.Deflection;
                    InShield.MinIntegrityPercentForQuantumShield = ShieldType.MinIntegrityPercentForQuantumShield;
                    InShield.MinIntegrityAfterDamage             = ShieldType.MinIntegrityAfterDamage;
                    InShield.m_MaxPowerUsage_Watts   = (ShieldType.MaxPowerUsage_Watts * 1.4f);
                    InShield.m_MarketPrice           = ShieldType.MarketPrice;
                    InShield.CargoVisualPrefabID     = ShieldType.CargoVisualID;
                    InShield.CanBeDroppedOnShipDeath = ShieldType.CanBeDroppedOnShipDeath;
                    InShield.Experimental            = ShieldType.Experimental;
                    InShield.Unstable   = ShieldType.Unstable;
                    InShield.Contraband = ShieldType.Contraband;
                    InShield.Price_LevelMultiplierExponent = ShieldType.Price_LevelMultiplierExponent;
                    if (InShield.MinIntegrityAfterDamage == -1)
                    {
                        InShield.MinIntegrityAfterDamage = Mathf.RoundToInt(InShield.Max * 0.15f);
                    }
                    InShield.MinIntegrityAfterDamage = Mathf.RoundToInt(InShield.MinIntegrityAfterDamage * (1f - Mathf.Clamp(0.05f * InShield.Level, 0f, 0.8f)));
                    InShield.CurrentMax = InShield.Max;
                    InShield.Current    = InShield.Max;
                }
            }
            else
            {
                InShield = new PLShieldGenerator((EShieldGeneratorType)Subtype, level);
            }
            return(InShield);
        }