Esempio n. 1
0
            public static void Prefix()
            {
                ResourceSet <Effect> effects = Db.Get().effects;

                foreach (Effect e in LifeStagePreset.GetGenericEffects())
                {
                    effects.Add(e);
                }
            }
Esempio n. 2
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);
    }
Esempio n. 3
0
 public Resource(string id, ResourceSet parent = null, string name = null)
 {
     Debug.Assert(id != null);
     Id     = id;
     IdHash = new HashedString(Id);
     Guid   = new ResourceGuid(id, parent);
     parent?.Add(this);
     if (name != null)
     {
         Name = name;
     }
     else
     {
         Name = id;
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Copies all values from source to target resource set
 /// </summary>
 private static void CopyResourceSetContent(ResourceSet source, ResourceSet target, BaseValuesFilter filter)
 {
     foreach (var sourceResourceItem in source.Values.Where(p => !p.Locked))
     {
         if (!target.ContainsKey(sourceResourceItem.Name))
         {
             var targetResourceItem = new ResourceItem();
             targetResourceItem.Name = sourceResourceItem.Name;
             targetResourceItem.Value = sourceResourceItem.Value;
             target.Add(sourceResourceItem.Name, targetResourceItem);
         }
         else
         {
             if (target[sourceResourceItem.Name].ValueEmpty || filter == BaseValuesFilter.AllUnlocked)
             {
                 target[sourceResourceItem.Name].Value = sourceResourceItem.Value;
             }
         }
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Copies all values from source to target resource set
 /// </summary>
 private static void CopyResourceSetContent(ResourceSet source, ResourceSet target, BaseValuesFilter filter)
 {
     foreach (var sourceResourceItem in source.Values.Where(p => !p.Locked))
     {
         if (!target.ContainsKey(sourceResourceItem.Name))
         {
             var targetResourceItem = new ResourceItem();
             targetResourceItem.Name  = sourceResourceItem.Name;
             targetResourceItem.Value = sourceResourceItem.Value;
             target.Add(sourceResourceItem.Name, targetResourceItem);
         }
         else
         {
             if (target[sourceResourceItem.Name].ValueEmpty || filter == BaseValuesFilter.AllUnlocked)
             {
                 target[sourceResourceItem.Name].Value = sourceResourceItem.Value;
             }
         }
     }
 }
Esempio n. 6
0
        private async Task OnFooChange(WatchEventType type, Foo item)
        {
            switch (type)
            {
            case WatchEventType.Added:
                await OnFooAdded(item);

                _foos.Add(item);
                return;

            case WatchEventType.Modified:
                await OnFooUpdated(item);

                _foos.Update(item);
                return;

            case WatchEventType.Deleted:
                await OnFooDeleted(item);

                _foos.Remove(item);
                return;
            }
            ;
        }