public bool ContainDef(BuffDef def) { if (FindWithDef(def) != null) { return(true); } return(false); }
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(); }
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); } }
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); } }
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); } }