Exemplo n.º 1
0
        public bool ContainDef(BuffDef def)
        {
            if (FindWithDef(def) != null)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public Buff(BuffDef buffDef, ThingWithComps caster)
        {
            def      = buffDef;
            uniqueID = def.defName + "_" + GetHashCode();

            canDespell = buffDef.canDespell;

            this.caster = caster;

            spellLevel      = buffDef.spellLevel;
            maxOverlapLevel = buffDef.maxOverlapLevel;
            duration        = buffDef.duration.SecondsToTicks();
            repeatCycle     = buffDef.duration.SecondsToTicks();
        }
Exemplo n.º 3
0
        public void RemoveWithDef(BuffDef def)
        {
            try
            {
                if (def != null)
                {
                    RemoveBuff(buffList.Find(buff => buff.Def == def));
                }

                Log.Error(parent + " RemoveBuff - Can't Find Buff: Cause def is Empty ");
            }
            catch (Exception ee)
            {
                Log.Error("Error : " + ee);
            }
        }
Exemplo n.º 4
0
        public void AddBuff(BuffDef def, ThingWithComps caster)
        {
            try
            {
                if (!(Activator.CreateInstance(def.buffClass, def, caster) is Buff buff))
                {
                    return;
                }

                buff.Caster = caster;
                buffList.Add(buff);
                buff.Owner = this;
            }
            catch (Exception ee)
            {
                Log.Error("Error : " + ee);
            }
        }
Exemplo n.º 5
0
        public void RemoveBuffAll(BuffDef def)
        {
            try
            {
                if (def != null)
                {
                    var removeList = FindAllWithDef(def);
                    if (removeList != null)
                    {
                        foreach (var buff in removeList)
                        {
                            RemoveBuff(buff);
                        }
                    }
                }

                Log.Error(parent + " RemoveBuffAll - Can't Find Buff: Cause def is Empty ");
            }
            catch (Exception ee)
            {
                Log.Error("Error : " + ee);
            }
        }