Exemplo n.º 1
0
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        Prioritizable.AddRef(go);
        go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.CreatureFeeder, false);
        Storage storage = go.AddOrGet <Storage>();

        storage.capacityKg       = 200f;
        storage.showInUI         = true;
        storage.showDescriptor   = true;
        storage.allowItemRemoval = false;
        storage.allowSettingOnlyFetchMarkedItems = false;
        Storage storage2 = go.AddComponent <Storage>();

        storage2.capacityKg       = 200f;
        storage2.showInUI         = true;
        storage2.showDescriptor   = true;
        storage2.allowItemRemoval = false;
        go.AddOrGet <StorageLocker>();
        Effect effect = new Effect("AteFromFeeder", STRINGS.CREATURES.MODIFIERS.ATE_FROM_FEEDER.NAME, STRINGS.CREATURES.MODIFIERS.ATE_FROM_FEEDER.TOOLTIP, 600f, true, false, false, null, 0f, null);

        effect.Add(new AttributeModifier(Db.Get().Amounts.Wildness.deltaAttribute.Id, -0.0333333351f, STRINGS.CREATURES.MODIFIERS.ATE_FROM_FEEDER.NAME, false, false, true));
        effect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, 2f, STRINGS.CREATURES.MODIFIERS.ATE_FROM_FEEDER.NAME, false, false, true));
        Db.Get().effects.Add(effect);
        go.AddOrGet <TreeFilterable>();
        go.AddOrGet <CreatureFeeder>().effectId = effect.Id;
    }
Exemplo n.º 2
0
            private static void Postfix(ModifierSet __instance)
            {
                // плохой сон - свет
                Effect effectBadSleep = __instance.effects.Get("BadSleep");

                effectBadSleep.Add(new AttributeModifier(HeartAttackMonitor.ATTRIBUTE_ID, +0.05f, effectBadSleep.Name));

                // плохой сон - храп
                Effect effectTerribleSleep = __instance.effects.Get("TerribleSleep");

                effectTerribleSleep.Add(new AttributeModifier(HeartAttackMonitor.ATTRIBUTE_ID, +0.1f, effectTerribleSleep.Name));

                // лечение на койке
                Effect effectMedicalCot = __instance.effects.Get("MedicalCot");

                effectMedicalCot.Add(new AttributeModifier(HeartAttackMonitor.ATTRIBUTE_ID, -0.1f, effectMedicalCot.Name));

                // лечение на койке с доктором
                Effect effectMedicalCotDoctored = __instance.effects.Get("MedicalCotDoctored");

                effectMedicalCotDoctored.Add(new AttributeModifier(HeartAttackMonitor.ATTRIBUTE_ID, -0.2f, effectMedicalCotDoctored.Name));
                effectMedicalCotDoctored.Add(new AttributeModifier(HeartAttackSickness.ID + "CureSpeed", 0.25f, effectMedicalCotDoctored.Name));

                // красная тревога
                Effect effectRedAlert = __instance.effects.Get("RedAlert");

                effectRedAlert.Add(new AttributeModifier(HeartAttackMonitor.ATTRIBUTE_ID, +0.25f, effectRedAlert.Name));
            }
Exemplo n.º 3
0
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = findfood;
     Target(eater);
     bingeEatingEffect = new Effect("Binge_Eating", DUPLICANTS.MODIFIERS.BINGE_EATING.NAME, DUPLICANTS.MODIFIERS.BINGE_EATING.TOOLTIP, 0f, true, false, true, null, 0f, null);
     bingeEatingEffect.Add(new AttributeModifier(Db.Get().Attributes.Decor.Id, -30f, DUPLICANTS.MODIFIERS.BINGE_EATING.NAME, false, false, true));
     bingeEatingEffect.Add(new AttributeModifier("CaloriesDelta", -6666.6665f, DUPLICANTS.MODIFIERS.BINGE_EATING.NAME, false, false, true));
     Db.Get().effects.Add(bingeEatingEffect);
     root.ToggleEffect((StatesInstance smi) => bingeEatingEffect);
     noTarget.GoTo(finish);
     eat_pst.ToggleAnims("anim_eat_overeat_kanim", 0f).PlayAnim("working_pst").OnAnimQueueComplete(finish);
     finish.Enter(delegate(StatesInstance smi)
     {
         smi.StopSM("complete/no more food");
     });
     findfood.Enter("FindFood", delegate(StatesInstance smi)
     {
         smi.FindFood();
     });
     fetch.InitializeStates(eater, ediblesource, ediblechunk, requestedfoodunits, actualfoodunits, eat, cantFindFood);
     eat.ToggleAnims("anim_eat_overeat_kanim", 0f).QueueAnim("working_loop", true, null).Enter(delegate(StatesInstance smi)
     {
         isBingeEating.Set(true, smi);
     })
     .DoEat(ediblechunk, actualfoodunits, findfood, findfood)
     .Exit("ClearIsBingeEating", delegate(StatesInstance smi)
     {
         isBingeEating.Set(false, smi);
     });
     cantFindFood.ToggleAnims("anim_interrupt_binge_eat_kanim", 0f).PlayAnim("interrupt_binge_eat").OnAnimQueueComplete(noTarget);
 }
        public override void InitializeStates(out BaseState default_state)
        {
            default_state = satisfiedState;

            Effect aquariumEffect = new Effect("InAquarium", PHO_STRINGS.INAQUARIUM.NAME, "This creature is in an aquarium.", 0f, true, true, false);

            aquariumEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, 10f, STRINGS.CREATURES.MODIFIERS.HAPPY.NAME));
            aquariumEffect.Add(new AttributeModifier(Db.Get().Amounts.Wildness.deltaAttribute.Id, -0.02f, PHO_STRINGS.INAQUARIUM.NAME));
            Effect notInAquariumEffect = new Effect("NotInAquarium", PHO_STRINGS.NOTINAQUARIUM.NAME, "This creature must be in an aquarium to be tame.\nAn aquarium is a closed room with any water.", 0f, true, true, true);


            satisfiedState.Transition(notSatisfiedState, (Instance smi) => smi.IsInAquarium(), UpdateRate.SIM_1000ms);
            notSatisfiedState.Transition(satisfiedState, (Instance smi) => !smi.IsInAquarium(), UpdateRate.SIM_1000ms);

            satisfiedState.Enter(delegate(Instance smi)
            {
            });

            notSatisfiedState.Enter(delegate(Instance smi)
            {
            });

            notSatisfiedState.ToggleEffect((Instance smi) => aquariumEffect);
            satisfiedState.ToggleEffect((Instance smi) => notInAquariumEffect);
        }
Exemplo n.º 5
0
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = baby;
     root.Enter(AddBabyEffect);
     baby.Transition(spawnadult, IsReadyToSpawnAdult, UpdateRate.SIM_4000ms);
     spawnadult.ToggleBehaviour(GameTags.Creatures.Behaviours.GrowUpBehaviour, (Instance smi) => true, null);
     babyEffect = new Effect("IsABaby", CREATURES.MODIFIERS.BABY.NAME, CREATURES.MODIFIERS.BABY.TOOLTIP, 0f, true, false, false, null, 0f, null);
     babyEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Metabolism.Id, -0.9f, CREATURES.MODIFIERS.BABY.NAME, true, false, true));
     babyEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, 5f, CREATURES.MODIFIERS.BABY.NAME, false, false, true));
 }
Exemplo n.º 6
0
            internal static void Postfix(Db __instance)
            {
                /// ____________________________ New effects used throughout the mod ________________________

                PUtil.LogDebug("DB initialise postfix");
                Effect crippledEffect = new Effect("DangerousWorldCrippled", (String)DangerousWorldStrings.CRIPPLED_EFFECT_TITLE, (string)DangerousWorldStrings.CRIPPLED_EFFECT_DESC, (float)(DangerousWorldOptions.Instance.fallOptions.crippledDuration * 600), true, true, true);

                crippledEffect.Add(new AttributeModifier("Athletics", DangerousWorldOptions.Instance.fallOptions.crippledModifier, (string)DangerousWorldStrings.CRIPPLED_EFFECT_TITLE, false));
                __instance.effects.Add(crippledEffect);

#if DEBUG
/*                Effect test;
 *              AttributeModifier attributeModifier;
 *
 *              for (int idx = 0; idx < __instance.effects.Count; ++idx)
 *              {
 *                  test = (Effect)__instance.effects.GetResource(idx);
 *                  PUtil.LogDebug(("Effect {0}: id: {1}, name: {2}").F(idx, __instance.effects.GetResource(idx).Id, __instance.effects.GetResource(idx).Id));
 *                  for (int idx1 = 0; idx1 < test.SelfModifiers.Count; ++idx1)
 *                  {
 *                      attributeModifier = test.SelfModifiers[idx1];
 *                      PUtil.LogDebug(("Effect attribute modifier: {0}, attribute: {1}, value: {2}").F(attributeModifier.Description, attributeModifier.AttributeId, attributeModifier.Value));
 *                  }
 *              }*/
#endif
            }
        public Instance(IStateMachineTarget master, Def def)
            : base(master, def)
        {
            incubation = Db.Get().Amounts.Incubation.Lookup(base.gameObject);
            Action <object> handler = OnStore;

            master.Subscribe(856640610, handler);
            master.Subscribe(1309017699, handler);
            Action <object> handler2 = OnOperationalChanged;

            master.Subscribe(1628751838, handler2);
            master.Subscribe(960378201, handler2);
            wildness        = Db.Get().Amounts.Wildness.Lookup(base.gameObject);
            wildness.value  = wildness.GetMax();
            viability       = Db.Get().Amounts.Viability.Lookup(base.gameObject);
            viability.value = viability.GetMax();
            float value = def.baseIncubationRate;

            if (GenericGameSettings.instance.acceleratedLifecycle)
            {
                value = 33.3333321f;
            }
            AttributeModifier modifier = new AttributeModifier(Db.Get().Amounts.Incubation.deltaAttribute.Id, value, CREATURES.MODIFIERS.BASE_INCUBATION_RATE.NAME, false, false, true);

            incubatingEffect = new Effect("Incubating", CREATURES.MODIFIERS.INCUBATING.NAME, CREATURES.MODIFIERS.INCUBATING.TOOLTIP, 0f, true, false, false, null, 0f, null);
            incubatingEffect.Add(modifier);
        }
Exemplo n.º 8
0
            /// <summary>
            /// Applied after InitializeStates runs.
            /// </summary>
            internal static void Postfix(HappinessMonitor __instance)
            {
                var newEffect = new Effect("Happy", STRINGS.CREATURES.MODIFIERS.HAPPY.
                                           NAME, STRINGS.CREATURES.MODIFIERS.HAPPY.TOOLTIP, 0f, true, false, false);

                newEffect.Add(new AttributeModifier(Db.Get().Amounts.Fertility.
                                                    deltaAttribute.Id, 4f, STRINGS.CREATURES.MODIFIERS.HAPPY.NAME, true));
                if (__instance != null)
                {
                    var happyState      = HAPPY_TAME_STATE.Get(__instance);
                    var happyTameEffect = HAPPY_TAME_EFFECT.Get(__instance);
                    if (happyState?.tame != null && happyTameEffect != null)
                    {
                        // Remove default effect, and toggle a specific effect
                        var tame = happyState.tame;
                        tame.ClearEnterActions();
                        tame.ClearExitActions();
                        tame.ToggleEffect((smi) => {
                            var obj = smi.master.gameObject;
                            return((obj != null && obj.PrefabID() == MOO_TAG) ? newEffect :
                                   happyTameEffect);
                        });
                    }
                }
            }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state     = normal;
     base.serializable = true;
     root.EventHandler(GameHashes.CaloriesConsumed, delegate(Instance smi, object data)
     {
         smi.OnCaloriesConsumed(data);
     }).ToggleBehaviour(GameTags.Creatures.Poop, ReadyToPoop, delegate(Instance smi)
     {
         smi.Poop();
     }).Update(UpdateMetabolismCalorieModifier, UpdateRate.SIM_200ms, false);
     normal.Transition(hungry, (Instance smi) => smi.IsHungry(), UpdateRate.SIM_1000ms);
     hungry.DefaultState(hungry.hungry).ToggleTag(GameTags.Creatures.Hungry).EventTransition(GameHashes.CaloriesConsumed, normal, (Instance smi) => !smi.IsHungry());
     hungry.hungry.Transition(normal, (Instance smi) => !smi.IsHungry(), UpdateRate.SIM_1000ms).Transition(hungry.outofcalories, (Instance smi) => smi.IsOutOfCalories(), UpdateRate.SIM_1000ms).ToggleStatusItem(Db.Get().CreatureStatusItems.Hungry, (object)null);
     hungry.outofcalories.DefaultState(hungry.outofcalories.wild).Transition(hungry.hungry, (Instance smi) => !smi.IsOutOfCalories(), UpdateRate.SIM_1000ms);
     hungry.outofcalories.wild.TagTransition(GameTags.Creatures.Wild, hungry.outofcalories.tame, true).ToggleStatusItem(Db.Get().CreatureStatusItems.Hungry, (object)null);
     hungry.outofcalories.tame.Enter("StarvationStartTime", StarvationStartTime).Exit("ClearStarvationTime", delegate(Instance smi)
     {
         starvationStartTime.Set(0f, smi);
     }).Transition(hungry.outofcalories.starvedtodeath, (Instance smi) => smi.GetDeathTimeRemaining() <= 0f, UpdateRate.SIM_1000ms)
     .TagTransition(GameTags.Creatures.Wild, hungry.outofcalories.wild, false)
     .ToggleStatusItem(STRINGS.CREATURES.STATUSITEMS.STARVING.NAME, STRINGS.CREATURES.STATUSITEMS.STARVING.TOOLTIP, string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, default(HashedString), 0, (string str, Instance smi) => str.Replace("{TimeUntilDeath}", GameUtil.GetFormattedCycles(smi.GetDeathTimeRemaining(), "F1")), null, null)
     .ToggleNotification((Instance smi) => new Notification(STRINGS.CREATURES.STATUSITEMS.STARVING.NOTIFICATION_NAME, NotificationType.BadMinor, HashedString.Invalid, (List <Notification> notifications, object data) => STRINGS.CREATURES.STATUSITEMS.STARVING.NOTIFICATION_TOOLTIP + notifications.ReduceMessages(false), null, true, 0f, null, null, null))
     .ToggleEffect((Instance smi) => outOfCaloriesTame);
     hungry.outofcalories.starvedtodeath.Enter(delegate(Instance smi)
     {
         smi.GetSMI <DeathMonitor.Instance>().Kill(Db.Get().Deaths.Starvation);
     });
     outOfCaloriesTame = new Effect("OutOfCaloriesTame", STRINGS.CREATURES.MODIFIERS.OUT_OF_CALORIES.NAME, STRINGS.CREATURES.MODIFIERS.OUT_OF_CALORIES.TOOLTIP, 0f, false, false, false, null, 0f, null);
     outOfCaloriesTame.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -10f, STRINGS.CREATURES.MODIFIERS.OUT_OF_CALORIES.NAME, false, false, true));
 }
Exemplo n.º 10
0
        private static void InitDb()
        {
            var db = Db.Get();

            // тюнингуем и актифируем комнату
            // подхватывать максимальный размер комнаты из тюнинга
            int maxRoomSize = TuningData <RoomProber.Tuning> .Get().maxRoomSize;

            RoomConstraints.Constraint MAXIMUM_SIZE_MAX = new RoomConstraints.Constraint(
                building_criteria: null,
                room_criteria: (Room room) => room.cavity.numCells <= maxRoomSize,
                times_required: 1,
                name: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.NAME, maxRoomSize),
                description: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.DESCRIPTION, maxRoomSize),
                stomp_in_conflict: null);

            var additional_constraints = db.RoomTypes.MachineShop.additional_constraints;

            for (int i = 0; i < additional_constraints.Length; i++)
            {
                if (additional_constraints[i] == RoomConstraints.MAXIMUM_SIZE_96)
                {
                    additional_constraints[i] = MAXIMUM_SIZE_MAX;
                    break;
                }
            }

            db.RoomTypes.Add(db.RoomTypes.MachineShop);

            // добавляем перк для работы на станции
            CanMachineTinker = db.SkillPerks.Add(new SimpleSkillPerk(REQUIRED_ROLE_PERK, STRINGS.PERK_CAN_MACHINE_TINKER.DESCRIPTION));
            db.Skills.Technicals1.perks.Add(CanMachineTinker);

            // добавляем модификаторы и эффекты
            string text        = DUPLICANTS.MODIFIERS.MACHINETINKER.NAME;
            string description = STRINGS.DUPLICANTS.MODIFIERS.MACHINETINKER.TOOLTIP;

            CraftingSpeed = db.Attributes.Add(new Attribute(CRAFTING_SPEED_MODIFIER_NAME, false, Attribute.Display.General, false, BASE_SPEED_VALUE));
            CraftingSpeed.SetFormatter(new PercentAttributeFormatter());

            MachinerySpeedModifier = new AttributeModifier(MACHINERY_SPEED_MODIFIER_NAME, MACHINERY_SPEED_MODIFIER, text);
            CraftingSpeedModifier  = new AttributeModifier(CRAFTING_SPEED_MODIFIER_NAME, CRAFTING_SPEED_MODIFIER, text);

            MachineTinkerEffect = db.effects.Add(new Effect(MACHINE_TINKER_EFFECT_NAME, text, description, MACHINE_TINKER_EFFECT_DURATION * Constants.SECONDS_PER_CYCLE, true, true, false));
            MachineTinkerEffect.Add(MachinerySpeedModifier);
            MachineTinkerEffect.Add(CraftingSpeedModifier);
        }
Exemplo n.º 11
0
    public Effect CreateRoomEffect()
    {
        Effect            effect   = new Effect("RoomRelaxationEffect", DUPLICANTS.MODIFIERS.STRESSREDUCTION_CLINIC.NAME, DUPLICANTS.MODIFIERS.STRESSREDUCTION_CLINIC.TOOLTIP, 0f, true, false, false, null, 0f, null);
        AttributeModifier modifier = new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, roomStressModificationValue / 600f, DUPLICANTS.MODIFIERS.STRESSREDUCTION_CLINIC.NAME, false, false, true);

        effect.Add(modifier);
        return(effect);
    }
Exemplo n.º 12
0
    public Effect CreateEffect()
    {
        Effect            effect   = new Effect("StressReduction", DUPLICANTS.MODIFIERS.STRESSREDUCTION.NAME, DUPLICANTS.MODIFIERS.STRESSREDUCTION.TOOLTIP, 0f, true, false, false, null, 0f, null);
        AttributeModifier modifier = new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, stressModificationValue / 600f, DUPLICANTS.MODIFIERS.STRESSREDUCTION.NAME, false, false, true);

        effect.Add(modifier);
        return(effect);
    }
Exemplo n.º 13
0
        public static void Postfix(Db __instance)
        {
            Utilities.AddWorldYaml("Asteroid_Slicksteria", typeof(PHO_STRINGS));


            Effect OwO_Effect = new Effect("OwO_effect", " OwO Effect", "This duplicant saw something so cute that he can't think of anything else.", 300f, true, true, false, null, 10f);

            OwO_Effect.Add(new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, -DUPLICANTSTATS.QOL_STRESS.BELOW_EXPECTATIONS.HARD, "OwO Effect"));
            __instance.effects.Add(OwO_Effect);
        }
Exemplo n.º 14
0
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = root;
     root.Update(UpdateState, UpdateRate.SIM_1000ms, true);
     futureOvercrowdedEffect = new Effect("FutureOvercrowded", CREATURES.MODIFIERS.FUTURE_OVERCROWDED.NAME, CREATURES.MODIFIERS.FUTURE_OVERCROWDED.TOOLTIP, 0f, true, false, true, null, 0f, null);
     futureOvercrowdedEffect.Add(new AttributeModifier(Db.Get().Amounts.Fertility.deltaAttribute.Id, -1f, CREATURES.MODIFIERS.FUTURE_OVERCROWDED.NAME, true, false, true));
     overcrowdedEffect = new Effect("Overcrowded", CREATURES.MODIFIERS.OVERCROWDED.NAME, CREATURES.MODIFIERS.OVERCROWDED.TOOLTIP, 0f, true, false, true, null, 0f, null);
     overcrowdedEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -5f, CREATURES.MODIFIERS.OVERCROWDED.NAME, false, false, true));
     stuckEffect = new Effect("Confined", CREATURES.MODIFIERS.CONFINED.NAME, CREATURES.MODIFIERS.CONFINED.TOOLTIP, 0f, true, false, true, null, 0f, null);
     stuckEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -10f, CREATURES.MODIFIERS.CONFINED.NAME, false, false, true));
 }
Exemplo n.º 15
0
            /// <summary>
            /// Applied after Initialize runs.
            /// </summary>
            internal static void Postfix(EntityModifierSet __instance)
            {
                TraitReworkUtils.FixTraits(__instance);
                PUtil.LogDebug("Updated traits");
                // Add "Disturbed" trait
                var disturbedEffect = new Effect(TraitTuning.DISTURBED_EFFECT, TraitStrings.
                                                 DISTURBED_NAME, TraitStrings.DISTURBED_DESC, 200.0f, true, true, true);

                disturbedEffect.Add(new AttributeModifier("StressDelta", 0.033333333f,
                                                          TraitStrings.DISTURBED_NAME));
                __instance.effects.Add(disturbedEffect);
            }
Exemplo n.º 16
0
    private void LoadEffects()
    {
        foreach (ModifierInfo modifierInfo in modifierInfos)
        {
            if (!effects.Exists(modifierInfo.Id) && (modifierInfo.Type == "Effect" || modifierInfo.Type == "Base" || modifierInfo.Type == "Need"))
            {
                string text        = Strings.Get($"STRINGS.DUPLICANTS.MODIFIERS.{modifierInfo.Id.ToUpper()}.NAME");
                string description = Strings.Get($"STRINGS.DUPLICANTS.MODIFIERS.{modifierInfo.Id.ToUpper()}.TOOLTIP");
                Effect effect      = new Effect(modifierInfo.Id, text, description, modifierInfo.Duration * 600f, modifierInfo.ShowInUI && modifierInfo.Type != "Need", modifierInfo.TriggerFloatingText, modifierInfo.IsBad, modifierInfo.EmoteAnim, modifierInfo.EmoteCooldown, modifierInfo.StompGroup);
                foreach (ModifierInfo modifierInfo2 in modifierInfos)
                {
                    if (modifierInfo2.Id == modifierInfo.Id)
                    {
                        effect.Add(new AttributeModifier(modifierInfo2.Attribute, ConvertValue(modifierInfo2.Value, modifierInfo2.Units), text, modifierInfo2.Multiplier, false, true));
                    }
                }
                effects.Add(effect);
            }
        }
        Effect effect2 = new Effect("Ranched", STRINGS.CREATURES.MODIFIERS.RANCHED.NAME, STRINGS.CREATURES.MODIFIERS.RANCHED.TOOLTIP, 600f, true, true, false, null, 0f, null);

        effect2.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, 5f, STRINGS.CREATURES.MODIFIERS.RANCHED.NAME, false, false, true));
        effect2.Add(new AttributeModifier(Db.Get().Amounts.Wildness.deltaAttribute.Id, -0.09166667f, STRINGS.CREATURES.MODIFIERS.RANCHED.NAME, false, false, true));
        effects.Add(effect2);
        Effect effect3 = new Effect("EggSong", STRINGS.CREATURES.MODIFIERS.INCUBATOR_SONG.NAME, STRINGS.CREATURES.MODIFIERS.INCUBATOR_SONG.TOOLTIP, 600f, true, false, false, null, 0f, null);

        effect3.Add(new AttributeModifier(Db.Get().Amounts.Incubation.deltaAttribute.Id, 4f, STRINGS.CREATURES.MODIFIERS.INCUBATOR_SONG.NAME, true, false, true));
        effects.Add(effect3);
        Reactable.ReactablePrecondition precon = delegate(GameObject go, Navigator.ActiveTransition n)
        {
            int cell = Grid.PosToCell(go);
            return(Grid.IsValidCell(cell) && Grid.IsGas(cell));
        };
        Effect effect4 = effects.Get("WetFeet");

        effect4.AddEmotePrecondition(precon);
        Effect effect5 = effects.Get("SoakingWet");

        effect5.AddEmotePrecondition(precon);
    }
        public Instance(IStateMachineTarget master, Def def)
            : base(master, def)
        {
            fertility = Db.Get().Amounts.Fertility.Lookup(base.gameObject);
            if (GenericGameSettings.instance.acceleratedLifecycle)
            {
                fertility.deltaAttribute.Add(new AttributeModifier(fertility.deltaAttribute.Id, 33.3333321f, "Accelerated Lifecycle", false, false, true));
            }
            float value = 100f / (def.baseFertileCycles * 600f);

            fertileEffect = new Effect("Fertile", CREATURES.MODIFIERS.BASE_FERTILITY.NAME, CREATURES.MODIFIERS.BASE_FERTILITY.TOOLTIP, 0f, false, false, false, null, 0f, null);
            fertileEffect.Add(new AttributeModifier(Db.Get().Amounts.Fertility.deltaAttribute.Id, value, CREATURES.MODIFIERS.BASE_FERTILITY.NAME, false, false, true));
            InitializeBreedingChances();
        }
Exemplo n.º 18
0
        private static Effect CreateEffect()
        {
            var effect     = new Effect("Medicine_Stimulant", "Stimulant", "Temporarily increases physical ability at the cost of increased metabolism.", 600f, show_in_ui: true, trigger_floating_text: true, is_bad: false);
            var attributes = new List <string> {
                Db.Get().Attributes.Athletics.Id,
                Db.Get().Attributes.Strength.Id,
                Db.Get().Attributes.Digging.Id,
                Db.Get().Attributes.Construction.Id,
            };
            var skill_multiplier      = 0.25f;
            var metabolism_multiplier = 0.5f;

            foreach (var attribute in attributes)
            {
                effect.Add(new AttributeModifier(attribute, 2, effect.Name));
                effect.Add(new AttributeModifier(attribute, skill_multiplier, effect.Name, is_multiplier: true));
            }
            var calorieIncrease = metabolism_multiplier * 1000 * (5.0f / 3);

            effect.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, -calorieIncrease, effect.Name));
            //effect.Add(new AttributeModifier("CaloriesMax", calorieIncrease * 1000, effect.Name));
            effect.Add(new AttributeModifier("AirConsumptionRate", 0.1f * metabolism_multiplier, effect.Name));
            return(effect);
        }
Exemplo n.º 19
0
        public override void InitializeStates(out StateMachine.BaseState default_state)
        {
            default_state = this.satisfiedState;
            // Create and configure the light effect
            Effect needLightEffect = new Effect("NeedLight", "Needs light", "This creature needs light to live properly.", 0f, true, true, true);

            needLightEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Metabolism.Id, -40f, CREATURES.MODIFIERS.UNHAPPY.NAME));
            needLightEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -10f, CREATURES.MODIFIERS.UNHAPPY.NAME));


            satisfiedState.Transition(needLightState, (CreatureLightMonitor.Instance smi) => smi.IsInDark(), UpdateRate.SIM_1000ms);
            needLightState.Transition(satisfiedState, (CreatureLightMonitor.Instance smi) => !smi.IsInDark(), UpdateRate.SIM_1000ms);

            satisfiedState.Enter(delegate(CreatureLightMonitor.Instance smi)
            {
            });

            needLightState.Enter(delegate(CreatureLightMonitor.Instance smi)
            {
            });

            // Toggle the effects when enter or ewit un needLight state
            needLightState.ToggleEffect((CreatureLightMonitor.Instance smi) => needLightEffect);
        }
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     timeToDrown = 75f;
     if (drowningEffect == null)
     {
         drowningEffect = new Effect("Drowning", CREATURES.STATUSITEMS.DROWNING.NAME, CREATURES.STATUSITEMS.DROWNING.TOOLTIP, 0f, false, false, true, null, 0f, null);
         drowningEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -100f, CREATURES.STATUSITEMS.DROWNING.NAME, false, false, true));
     }
     if (saturatedEffect == null)
     {
         saturatedEffect = new Effect("Saturated", CREATURES.STATUSITEMS.SATURATED.NAME, CREATURES.STATUSITEMS.SATURATED.TOOLTIP, 0f, false, false, true, null, 0f, null);
         saturatedEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -100f, CREATURES.STATUSITEMS.SATURATED.NAME, false, false, true));
     }
 }
Exemplo n.º 21
0
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = satisfied;
     satisfied.Transition(happy, IsHappy, UpdateRate.SIM_1000ms).Transition(unhappy, GameStateMachine <HappinessMonitor, Instance, IStateMachineTarget, Def> .Not(IsHappy), UpdateRate.SIM_1000ms);
     happy.DefaultState(happy.wild).Transition(satisfied, GameStateMachine <HappinessMonitor, Instance, IStateMachineTarget, Def> .Not(IsHappy), UpdateRate.SIM_1000ms);
     happy.wild.ToggleEffect((Instance smi) => happyWildEffect).TagTransition(GameTags.Creatures.Wild, happy.tame, true);
     happy.tame.ToggleEffect((Instance smi) => happyTameEffect).TagTransition(GameTags.Creatures.Wild, happy.wild, false);
     unhappy.DefaultState(unhappy.wild).Transition(satisfied, IsHappy, UpdateRate.SIM_1000ms);
     unhappy.wild.ToggleEffect((Instance smi) => unhappyWildEffect).TagTransition(GameTags.Creatures.Wild, unhappy.tame, true);
     unhappy.tame.ToggleEffect((Instance smi) => unhappyTameEffect).TagTransition(GameTags.Creatures.Wild, unhappy.wild, false);
     happyWildEffect = new Effect("Happy", CREATURES.MODIFIERS.HAPPY.NAME, CREATURES.MODIFIERS.HAPPY.TOOLTIP, 0f, true, false, false, null, 0f, null);
     happyTameEffect = new Effect("Happy", CREATURES.MODIFIERS.HAPPY.NAME, CREATURES.MODIFIERS.HAPPY.TOOLTIP, 0f, true, false, false, null, 0f, null);
     happyTameEffect.Add(new AttributeModifier(Db.Get().Amounts.Fertility.deltaAttribute.Id, 9f, CREATURES.MODIFIERS.HAPPY.NAME, true, false, true));
     unhappyWildEffect = new Effect("Unhappy", CREATURES.MODIFIERS.UNHAPPY.NAME, CREATURES.MODIFIERS.UNHAPPY.TOOLTIP, 0f, true, false, true, null, 0f, null);
     unhappyWildEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Metabolism.Id, -15f, CREATURES.MODIFIERS.UNHAPPY.NAME, false, false, true));
     unhappyTameEffect = new Effect("Unhappy", CREATURES.MODIFIERS.UNHAPPY.NAME, CREATURES.MODIFIERS.UNHAPPY.TOOLTIP, 0f, true, false, true, null, 0f, null);
     unhappyTameEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Metabolism.Id, -80f, CREATURES.MODIFIERS.UNHAPPY.NAME, false, false, true));
 }
Exemplo n.º 22
0
        protected override void OnPrefabInit()
        {
            base.OnPrefabInit();
            if (NeedLiquid == null)
            {
                NeedLiquid = new StatusItem("NeedLiquid", "CREATURES", "status_item_plant_liquid", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, StatusItem.ALL_OVERLAYS);
                Strings.Add($"STRINGS.CREATURES.STATUSITEMS.NEEDLIQUID.NAME", "NeedLiquid");
                Strings.Add($"STRINGS.CREATURES.STATUSITEMS.NEEDLIQUID.TOOLTIP", "This creature must be in water to survive !");
                NeedLiquid.resolveStringCallback = ((string str, object data) => str);
            }

            timeToDrown = 100f;
            if (drowningEffect == null)
            {
                drowningEffect = new Effect("GasDrowning", PHO_STRINGS.DROWNING.NAME, PHO_STRINGS.DROWNING.TOOLTIP, 0f, false, false, true, null, 0f, null);
                drowningEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -100f, CREATURES.STATUSITEMS.DROWNING.NAME, false, false, true));
            }
        }
Exemplo n.º 23
0
        private static void AddBuildingAndEffects()
        {
            Utils.AddBuildingToPlanScreen("Furniture", CarouselCentrifugeConfig.ID, EspressoMachineConfig.ID);
#if VANILLA
            const string requiredTech = "ArtificialFriends";
#elif EXPANSION1
            const string requiredTech = "SpaceProgram";
#endif
            Utils.AddBuildingToTechnology(requiredTech, CarouselCentrifugeConfig.ID);

            moraleModifier = new AttributeModifier(
                attribute_id: "QualityOfLife",
                value: CarouselCentrifugeOptions.Instance.MoraleBonus,
                description: STRINGS.DUPLICANTS.MODIFIERS.RIDEONCAROUSEL.NAME,
                is_multiplier: false,
                uiOnly: false,
                is_readonly: false
                );

            specificEffect = new Effect(
                id: CarouselCentrifugeWorkable.specificEffectName,
                name: STRINGS.DUPLICANTS.MODIFIERS.RIDEONCAROUSEL.NAME,
                description: STRINGS.DUPLICANTS.MODIFIERS.RIDEONCAROUSEL.TOOLTIP,
                duration: (CarouselCentrifugeOptions.Instance.SpecificEffectDuration - 0.05f) * Constants.SECONDS_PER_CYCLE,
                show_in_ui: false,
                trigger_floating_text: true,
                is_bad: false
                );
            specificEffect.Add(moraleModifier);

            trackingEffect = new Effect(
                id: CarouselCentrifugeWorkable.trackingEffectName,
                name: "",
                description: "",
                duration: CarouselCentrifugeOptions.Instance.TrackingEffectDuration * Constants.SECONDS_PER_CYCLE,
                show_in_ui: false,
                trigger_floating_text: false,
                is_bad: false
                );

            Db.Get().effects.Add(specificEffect);
            Db.Get().effects.Add(trackingEffect);
        }
    public override void Initialize()
    {
        base.Initialize();
        Urges                  = new Urges();
        AssignableSlots        = new AssignableSlots();
        StateMachineCategories = new StateMachineCategories();
        Personalities          = new Personalities();
        Faces                  = new Faces();
        Shirts                 = new Shirts();
        Expressions            = new Expressions(Root);
        Thoughts               = new Thoughts(Root);
        Deaths                 = new Deaths(Root);
        StatusItemCategories   = new StatusItemCategories(Root);
        Techs                  = new Techs(Root);
        Techs.Load(researchTreeFile);
        TechTreeTitles = new TechTreeTitles(Root);
        TechTreeTitles.Load(researchTreeFile);
        TechItems             = new TechItems(Root);
        Accessories           = new Accessories(Root);
        AccessorySlots        = new AccessorySlots(Root, null, null, null);
        ScheduleBlockTypes    = new ScheduleBlockTypes(Root);
        ScheduleGroups        = new ScheduleGroups(Root);
        RoomTypeCategories    = new RoomTypeCategories(Root);
        RoomTypes             = new RoomTypes(Root);
        ArtifactDropRates     = new ArtifactDropRates(Root);
        SpaceDestinationTypes = new SpaceDestinationTypes(Root);
        Diseases            = new Diseases(Root);
        Sicknesses          = new Database.Sicknesses(Root);
        SkillPerks          = new SkillPerks(Root);
        SkillGroups         = new SkillGroups(Root);
        Skills              = new Skills(Root);
        ColonyAchievements  = new ColonyAchievements(Root);
        MiscStatusItems     = new MiscStatusItems(Root);
        CreatureStatusItems = new CreatureStatusItems(Root);
        BuildingStatusItems = new BuildingStatusItems(Root);
        ChoreTypes          = new ChoreTypes(Root);
        Effect effect = new Effect("CenterOfAttention", DUPLICANTS.MODIFIERS.CENTEROFATTENTION.NAME, DUPLICANTS.MODIFIERS.CENTEROFATTENTION.TOOLTIP, 0f, true, true, false, null, 0f, null);

        effect.Add(new AttributeModifier("StressDelta", -0.008333334f, DUPLICANTS.MODIFIERS.CENTEROFATTENTION.NAME, false, false, true));
        effects.Add(effect);
        CollectResources(Root, ResourceTable);
    }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = incubating;
     root.Enter(delegate(Instance smi)
     {
         smi.OnOperationalChanged(null);
     });
     incubating.PlayAnim("idle", KAnim.PlayMode.Loop).Transition(hatching_pre, IsReadyToHatch, UpdateRate.SIM_1000ms).TagTransition(GameTags.Entombed, entombed, false)
     .ParamTransition(isSuppressed, suppressed, GameStateMachine <IncubationMonitor, Instance, IStateMachineTarget, Def> .IsTrue)
     .ToggleEffect((Instance smi) => smi.incubatingEffect);
     entombed.TagTransition(GameTags.Entombed, incubating, true);
     suppressed.ToggleEffect((Instance smi) => suppressedEffect).ParamTransition(isSuppressed, incubating, GameStateMachine <IncubationMonitor, Instance, IStateMachineTarget, Def> .IsFalse).TagTransition(GameTags.Entombed, entombed, false)
     .Transition(not_viable, NoLongerViable, UpdateRate.SIM_1000ms);
     hatching_pre.Enter(DropSelfFromStorage).PlayAnim("hatching_pre").OnAnimQueueComplete(hatching_pst);
     hatching_pst.Enter(SpawnBaby).PlayAnim("hatching_pst").OnAnimQueueComplete(null)
     .Exit(DeleteSelf);
     not_viable.Enter(SpawnGenericEgg).GoTo(null).Exit(DeleteSelf);
     suppressedEffect = new Effect("IncubationSuppressed", CREATURES.MODIFIERS.INCUBATING_SUPPRESSED.NAME, CREATURES.MODIFIERS.INCUBATING_SUPPRESSED.TOOLTIP, 0f, true, false, true, null, 0f, null);
     suppressedEffect.Add(new AttributeModifier(Db.Get().Amounts.Viability.deltaAttribute.Id, -0.0166666675f, CREATURES.MODIFIERS.INCUBATING_SUPPRESSED.NAME, false, false, true));
 }
Exemplo n.º 26
0
            public Instance(IStateMachineTarget master, Def def) : base(master, def)
            {
                fertility = Db.Get().Amounts.Fertility.Lookup(gameObject);
                if (Klei.GenericGameSettings.instance.acceleratedLifecycle)
                {
                    // Debug setting
                    fertility.deltaAttribute.Add(new AttributeModifier(fertility.
                                                                       deltaAttribute.Id, 33.3333333f, "Accelerated Lifecycle", false, false,
                                                                       true));
                }
                float base_fertile_rate = 1.0f / (def.baseFertileCycles * 6.0f);

                fertileEffect = new Effect("Fertile", STRINGS.CREATURES.MODIFIERS.
                                           BASE_FERTILITY.NAME, STRINGS.CREATURES.MODIFIERS.BASE_FERTILITY.TOOLTIP,
                                           0f, false, false, false);
                fertileEffect.Add(new AttributeModifier(Db.Get().Amounts.Fertility.
                                                        deltaAttribute.Id, base_fertile_rate, STRINGS.CREATURES.MODIFIERS.
                                                        BASE_FERTILITY.NAME));
                InitializeBreedingChances();
            }
Exemplo n.º 27
0
        public static void Postfix(Effect ___happyWildEffect, Effect ___happyTameEffect, Effect ___unhappyWildEffect, Effect ___unhappyTameEffect)
        {
            if (CustomizeCritterState.StateManager.State.happyWildEffect != null)
            {
                ___happyWildEffect.SelfModifiers.Clear();
                foreach (var attribute in CustomizeCritterState.StateManager.State.happyWildEffect)
                {
                    ___happyWildEffect.Add(new AttributeModifier(attribute.id, attribute.value, STRINGS.CREATURES.MODIFIERS.HAPPY.NAME, attribute.multiplier ?? false));
                }
            }

            if (CustomizeCritterState.StateManager.State.happyTameEffect != null)
            {
                ___happyTameEffect.SelfModifiers.Clear();
                foreach (var attribute in CustomizeCritterState.StateManager.State.happyTameEffect)
                {
                    ___happyTameEffect.Add(new AttributeModifier(attribute.id, attribute.value, STRINGS.CREATURES.MODIFIERS.HAPPY.NAME, attribute.multiplier ?? false));
                }
            }

            if (CustomizeCritterState.StateManager.State.unhappyWildEffect != null)
            {
                ___unhappyWildEffect.SelfModifiers.Clear();
                foreach (var attribute in CustomizeCritterState.StateManager.State.unhappyWildEffect)
                {
                    ___unhappyWildEffect.Add(new AttributeModifier(attribute.id, attribute.value, STRINGS.CREATURES.MODIFIERS.HAPPY.NAME, attribute.multiplier ?? false));
                }
            }

            if (CustomizeCritterState.StateManager.State.unhappyTameEffect != null)
            {
                ___unhappyTameEffect.SelfModifiers.Clear();
                foreach (var attribute in CustomizeCritterState.StateManager.State.unhappyTameEffect)
                {
                    ___unhappyTameEffect.Add(new AttributeModifier(attribute.id, attribute.value, STRINGS.CREATURES.MODIFIERS.HAPPY.NAME, attribute.multiplier ?? false));
                }
            }
        }
Exemplo n.º 28
0
            public static void Prefix()
            {
                Strings.Add("STRINGS.ITEMS.FOOD." + FilamentsConfig.Id.ToUpper() + ".NAME", FilamentsConfig.Name);
                Strings.Add("STRINGS.ITEMS.FOOD." + FilamentsConfig.Id.ToUpper() + ".DESC", FilamentsConfig.Description);

                Strings.Add("STRINGS.ITEMS.FOOD." + MacedoniaConfig.Id.ToUpper() + ".NAME", MacedoniaConfig.Name);
                Strings.Add("STRINGS.ITEMS.FOOD." + MacedoniaConfig.Id.ToUpper() + ".DESC", MacedoniaConfig.Description);

                Strings.Add("STRINGS.ITEMS.FOOD." + NectarConfig.Id.ToUpper() + ".NAME", NectarConfig.Name);
                Strings.Add("STRINGS.ITEMS.FOOD." + NectarConfig.Id.ToUpper() + ".DESC", NectarConfig.Description);

                /*          Strings.Add("STRINGS.DUPLICANTS.DISEASES." + SweetPollenGerms.ID.ToUpper() + ".NAME", SweetPollenGerms.Name);
                 *        Strings.Add("STRINGS.DUPLICANTS.DISEASES." + SweetPollenGerms.ID.ToUpper() + ".LEGEND_HOVERTEXT", SweetPollenGerms.Tooltip);*/

                Strings.Add("STRINGS.ITEMS.PILLS." + FloralAntihistamineConfig.ID.ToUpper() + ".NAME", FloralAntihistamineConfig.Name);
                Strings.Add("STRINGS.ITEMS.PILLS." + FloralAntihistamineConfig.ID.ToUpper() + ".DESC", FloralAntihistamineConfig.Description);
                Strings.Add("STRINGS.ITEMS.PILLS." + FloralAntihistamineConfig.ID.ToUpper() + ".RECIPEDESC", FloralAntihistamineConfig.Description);

                Strings.Add("STRINGS.ITEMS.PILLS." + MendingSerumConfig.ID.ToUpper() + ".NAME", MendingSerumConfig.Name);
                Strings.Add("STRINGS.ITEMS.PILLS." + MendingSerumConfig.ID.ToUpper() + ".DESC", MendingSerumConfig.Description);
                Strings.Add("STRINGS.ITEMS.PILLS." + MendingSerumConfig.ID.ToUpper() + ".RECIPEDESC", MendingSerumConfig.Description);


                //Db.Get().Diseases.Add(new SweetPollenGerms());
                //var effect1 = new Effect("SmelledFlowersLonger", "Smelled sweet scents", "This dupe has smelled sweet scents and feels relaxed", 600.00f * 2, true, true, false, (string)null, 0.0f, (string)null);
                //effect1.Add(new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, -0.008333334f * 2, "The sweet smell relieves some stress", false, false, true));
                var effect2 = new Effect(FloralAntihistamineConfig.Effect_, "Floral Histamine Suppression", "Helps with allergies", 600.00f * 10, true, true, false, (string)null, 0.0f, (string)null);
                //effect2.Add(new AttributeModifier(Db.Get().Amounts.ImmuneLevel.deltaAttribute.Id, +0.008333334f * 10, "Inmunity level is rising", false, false, true));
                var effect3 = new Effect(MendingSerumConfig.Effect_, "Regeneration", "This dupe is constantly healing", 600.00f * 5, true, true, false, (string)null, 0.0f, (string)null);

                effect3.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.deltaAttribute.Id, +0.008333334f, "Healing", false, false, true));

                //Db.Get().effects.Add(effect1);
                Db.Get().effects.Add(effect2);
                Db.Get().effects.Add(effect3);
            }
Exemplo n.º 29
0
        public BoardCoordinatesViewModel(ConnectionProxy connectionProxy, Player mainPlayer, Enemy mainEnemy)
        {
            _connectionProxy = connectionProxy;
            MainPlayer       = mainPlayer;

            memento         = new MementoCareTaker();
            memento.Memento = MainPlayer.CreateMemento();

            MainEnemy = mainEnemy;
            Random randNum = new Random();

            UniqueID  = randNum.Next(100, 255);
            UniqueID2 = randNum.Next(100, 255);
            UniqueID3 = randNum.Next(100, 255);

            CurrentPlayer.color = UniqueID.ToString() + " " + UniqueID2.ToString() + " " + UniqueID3.ToString();

            enemySteal    = new StealPointsAbility();
            teleportEnemy = new TeleportAbility();
            dazeEnemy     = new DazePlayerAbility();

            enemySteal.SetEnemy(MainEnemy);
            teleportEnemy.SetEnemy(enemySteal);
            dazeEnemy.SetEnemy(teleportEnemy);


            for (int x = 0; x < 20; x++)
            {
                for (int y = 0; y < 20; y++)
                {
                    TilesSet.AddTile(x, y, new Tile(false, true, TileType.Neutral, x, y));
                }
            }

            //playerColor = UniqueID.ToString() + " " + UniqueID2.ToString() + " " + UniqueID3.ToString();
            //playerColor.Color = Color.FromArgb(255, 255, 255, 0);

            //SendCoordinatesCommand = new SendCoordinatesChatMessageCommand(this, chatService);
            MoveDownChatMessageCommand  = new MoveDownChatMessageCommand(this, _connectionProxy, MainPlayer);
            MoveLeftChatMessageCommand  = new MoveLeftChatMessageCommand(this, _connectionProxy, MainPlayer);
            MoveRightChatMessageCommand = new MoveRightChatMessageCommand(this, _connectionProxy, MainPlayer);
            MoveUpChatMessageCommand    = new MoveUpChatMessageCommand(this, _connectionProxy, MainPlayer);
            Pause       = new Pause(this, _connectionProxy);
            RestartGame = new RestartGame(this, _connectionProxy);

            _message = "Waiting for response";

            x           = MainPlayer.PosX;
            y           = MainPlayer.PosY;
            playerColor = MainPlayer.Color;

            /* CHAIN OF RESPONSIBILITY */

            EnemyDamageDealer    = new EnemyDamage();
            MagicianDamageDealer = new MagicianDamage();
            ThiefDamageDealer    = new ThiefDamage();
            IceDamageDealer      = new IceDamage();

            IceDamageDealer.SetSuccessor(ThiefDamageDealer);
            ThiefDamageDealer.SetSuccessor(MagicianDamageDealer);
            MagicianDamageDealer.SetSuccessor(EnemyDamageDealer);

            /* CHAIN OF RESPONSIBILITY */

            CurrentPlayer.x = x;
            CurrentPlayer.y = y;

            _connectionProxy.AddMessageReceiver(ChatService_CoordinatesMessageReceived);

            //chatService.CoordinatesReceived += ChatService_CoordinatesMessageReceived;
            facade = new Facade(_connectionProxy);

            root = new Effect(ComponentType.Effect);
            //Buffai

            Effect buff         = new Effect(ComponentType.Buff);
            Effect negativeBuff = new Effect(ComponentType.Negative); //negative
            Effect positiveBuff = new Effect(ComponentType.Positive); //positive

            positiveBuff.Add(new CountLeaf(ComponentType.ColorSplash));
            positiveBuff.Add(new CountLeaf(ComponentType.FreezeOthers));

            negativeBuff.Add(new CountLeaf(ComponentType.BlackSplash));
            negativeBuff.Add(new CountLeaf(ComponentType.FreezeYourself));

            buff.Add(negativeBuff);
            buff.Add(positiveBuff);

            // /Buffai
            // Bonusai

            Effect bonus = new Effect(ComponentType.Bonus);

            bonus.Add(new CountLeaf(ComponentType.JackPot));
            bonus.Add(new CountLeaf(ComponentType.Normal));
            bonus.Add(new CountLeaf(ComponentType.Joke));

            //Bonusai

            root.Add(buff);
            root.Add(bonus);

            /* INTERPRETER DESIGN PATTERN IMPLEMENTATION */
            tree = new List <ExpressionRoman>();
            tree.Add(new ThousandExpression());
            tree.Add(new HundredExpression());
            tree.Add(new TenExpression());
            tree.Add(new OneExpression());
            /* INTERPRETER DESIGN PATTERN IMPLEMENTATION */


            /* VISITOR DESIGN PATTERN IMPLEMENTATION */
            game = new GameStructure();
            game.Attach(new Hard());

            BonusSpawnRate  bonusSpawn  = new BonusSpawnRate();
            BuffSpawnRate   buffSpawn   = new BuffSpawnRate();
            DebuffSpawnRate debuffSpawn = new DebuffSpawnRate();

            game.Accept(bonusSpawn);
            game.Accept(buffSpawn);
            game.Accept(debuffSpawn);
            /* VISITOR DESIGN PATTERN IMPLEMENTATION */

            /* Flyweight design pattern */


            /* Flyweight design pattern */
        }
Exemplo n.º 30
0
        internal static void Init()
        {
            var db = Db.Get();

            // тюнингуем и актифируем комнату
            // подхватывать максимальный размер комнаты из тюнинга
            int maxRoomSize = TuningData <RoomProber.Tuning> .Get().maxRoomSize;

            var MAXIMUM_SIZE_MAX = new RoomConstraints.Constraint(
                building_criteria: null,
                room_criteria: (Room room) => room.cavity.numCells <= maxRoomSize,
                times_required: 1,
                name: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.NAME, maxRoomSize),
                description: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.DESCRIPTION, maxRoomSize),
                stomp_in_conflict: null);

            var additional_constraints = db.RoomTypes.MachineShop.additional_constraints;

            for (int i = 0; i < additional_constraints.Length; i++)
            {
                if (additional_constraints[i] == RoomConstraints.MAXIMUM_SIZE_96)
                {
                    additional_constraints[i] = MAXIMUM_SIZE_MAX;
                    break;
                }
            }

            db.RoomTypes.Add(db.RoomTypes.MachineShop);

            // детектим "Rooms Expanded". модифицируем "мастерскую" чтобы она могла быть обгрейднутна до "кухни"
            var RoomsExpanded = PPatchTools.GetTypeSafe("RoomsExpanded.RoomTypes_AllModded", "RoomsExpandedMerged");

            if (RoomsExpanded != null)
            {
                PUtil.LogDebug("RoomsExpanded found. Attempt to add compatibility.");
                try
                {
                    KitchenRoom = (RoomType)RoomsExpanded.GetPropertySafe <RoomType>("KitchenRoom", true)?.GetValue(null, null);
                    if (KitchenRoom != null)
                    {
                        var upgrade_paths = db.RoomTypes.MachineShop.upgrade_paths.AddToArray(KitchenRoom);
                        Traverse.Create(db.RoomTypes.MachineShop).Property(nameof(RoomType.upgrade_paths)).SetValue(upgrade_paths);
                        Traverse.Create(db.RoomTypes.MachineShop).Property(nameof(RoomType.priority)).SetValue(KitchenRoom.priority);
                        KitchenBuildingTag = "KitchenBuildingTag".ToTag();
                        RoomsExpandedFound = true;
                    }
                }
                catch (System.Exception e)
                {
                    PUtil.LogExcWarn(e);
                }
            }

            // добавляем перк для работы на станции
            CanMachineTinker = db.SkillPerks.Add(new SimpleSkillPerk(
                                                     id: REQUIRED_ROLE_PERK,
                                                     description: STRINGS.PERK_CAN_MACHINE_TINKER.DESCRIPTION));
            db.Skills.Technicals1.perks.Add(CanMachineTinker);

            // добавляем модификаторы и эффекты
            string text        = DUPLICANTS.MODIFIERS.MACHINETINKER.NAME;
            string description = STRINGS.DUPLICANTS.MODIFIERS.MACHINETINKER.TOOLTIP;

            CraftingSpeed = db.Attributes.Add(new Attribute(
                                                  id: CRAFTING_SPEED_MODIFIER_NAME,
                                                  is_trainable: false,
                                                  show_in_ui: Attribute.Display.General,
                                                  is_profession: false,
                                                  base_value: BASE_SPEED_VALUE));
            CraftingSpeed.SetFormatter(new PercentAttributeFormatter());

            MachinerySpeedModifier = new AttributeModifier(
                attribute_id: MACHINERY_SPEED_MODIFIER_NAME,
                value: MACHINERY_SPEED_MODIFIER,
                description: text,
                is_readonly: false);
            CraftingSpeedModifier = new AttributeModifier(
                attribute_id: CRAFTING_SPEED_MODIFIER_NAME,
                value: CRAFTING_SPEED_MODIFIER,
                description: text,
                is_readonly: false);

            MachineTinkerEffect = db.effects.Add(new Effect(
                                                     id: MACHINE_TINKER_EFFECT_NAME,
                                                     name: text,
                                                     description: description,
                                                     duration: MACHINE_TINKER_EFFECT_DURATION * Constants.SECONDS_PER_CYCLE,
                                                     show_in_ui: true,
                                                     trigger_floating_text: true,
                                                     is_bad: false));
            MachineTinkerEffect.Add(MachinerySpeedModifier);
            MachineTinkerEffect.Add(CraftingSpeedModifier);

            MachineTinkerEffectDuration = db.AttributeConverters.Create(
                id: "MachineTinkerEffectDuration",
                name: "Engie's Jerry Rig Effect Duration",
                description: STRINGS.DUPLICANTS.ATTRIBUTES.MACHINERY.MACHINE_TINKER_EFFECT_MODIFIER,
                attribute: db.Attributes.Machinery,
                multiplier: MACHINE_TINKER_EFFECT_DURATION_PER_SKILL,
                base_value: 0,
                formatter: new ToPercentAttributeFormatter(1f, GameUtil.TimeSlice.None),
                available_dlcs: DlcManager.AVAILABLE_ALL_VERSIONS);
        }