Beispiel #1
0
            public static void Postfix(MinionIdentity __instance)
            {
                var dupe = __instance;

                if (HasDupeValue(dupe.gameObject, ImmuneSystemAmount))
                {
                    var immuneSystem = ImmuneSystemAmount.Lookup(dupe.gameObject);
                    var max          = immuneSystem.GetMax();
                    var value        = immuneSystem.value;


                    var amount = ImmuneSystemAmount.Lookup(dupe.gameObject);
                    for (var index = 0; index != amount.deltaAttribute.Modifiers.Count; ++index)
                    {
                        var mod = amount.deltaAttribute.Modifiers[index];
                        if (mod.AttributeId != ImmuneSystemBaseModifier.AttributeId ||
                            mod.Description != ImmuneSystemBaseModifier.Description)
                        {
                            continue;
                        }
                        if (value >= max)
                        {
                            mod.SetValue(0f);
                        }
                        else
                        {
                            if (mod.Value <= 0f)
                            {
                                mod.SetValue(ImmuneSystemDefaultDelta);
                            }
                        }
                    }
                }
            }
            public void CalculateImmuneSystem(MinionIdentity dupe)
            {
                var totalGerms = 0;

                foreach (var germ in germList)
                {
                    if (germ.Id == Db.Get().Diseases.SlimeGerms.Id)
                    {
                        totalGerms += (int)(germ.Amount * 1.0f);
                    }
                    else if (germ.Id == Db.Get().Diseases.PollenGerms.Id)
                    {
                        totalGerms += (int)(germ.Amount * 0.5f);
                    }
                    else
                    {
                        totalGerms += (int)germ.Amount;
                    }
                }

                var amount = ImmuneSystemAmount.Lookup(dupe);

                for (int index = 0; index != amount.deltaAttribute.Modifiers.Count; ++index)
                {
                    AttributeModifier mod = amount.deltaAttribute.Modifiers[index];
                    if (mod.AttributeId == ImmuneSystemGermModifier.AttributeId &&
                        mod.Description == ImmuneSystemGermModifier.Description)
                    {
                        mod.SetValue((float)-(totalGerms / 900D / 500D));
                    }
                }
            }
Beispiel #3
0
            Prefix(Amounts __instance)     //, ref Func<Amount, Func<AmountInstance, string>> ___AddAmountLine)
            {
                ImmuneSystemAmount = __instance.CreateAmount("ImmuneSystem", 0f, 100f,
                                                             false, Units.Flat, 0.04f, true, "STRINGS.DUPLICANTS.STATS", "ui_icon_immunelevel",
                                                             "attribute_immunelevel");
                ImmuneSystemAmount.Disabled    = false;
                ImmuneSystemAmount.showInUI    = true;
                ImmuneSystemAmount.description = "This is the strength of your Duplicants immune system.";
                ImmuneSystemAmount.displayer   = new AsPercentAmountDisplayer(GameUtil.TimeSlice.PerCycle);
                ImmuneSystemAmount.Name        = "Immune System";

                ImmuneSystemAmount.SetDisplayer(new AsPercentAmountDisplayer(GameUtil.TimeSlice.PerCycle));
            }
Beispiel #4
0
            public static void Postfix(MinionConfig __instance, GameObject go)
            {
                AmountInstance immuneSys = ImmuneSystemAmount.Lookup(go);

                immuneSys.value = immuneSys.GetMax();
            }