public Buff(Game game, string buffName, float dur, byte stacks, BuffType buffType, IObjAiBase onto, IObjAiBase from) { _game = game; _scriptEngine = game.ScriptEngine; Duration = dur; StackCount = stacks; Name = buffName; TimeElapsed = 0; _remove = false; TargetUnit = onto; SourceUnit = from; BuffType = buffType; Slot = onto.GetNewBuffSlot(this); }
public Buff(Game game, string buffName, float duration, int stacks, ISpell originspell, IObjAiBase onto, IObjAiBase from, bool infiniteDuration = false) { if (duration < 0) { throw new ArgumentException("Error: Duration was set to under 0."); } _infiniteDuration = infiniteDuration; _game = game; _remove = false; _scriptEngine = game.ScriptEngine; _buffGameScript = _scriptEngine.CreateObject <IBuffGameScript>(buffName, buffName); BuffAddType = _buffGameScript.BuffAddType; if (BuffAddType == (BuffAddType.STACKS_AND_OVERLAPS | BuffAddType.STACKS_AND_RENEWS) && _buffGameScript.MaxStacks < 2) { throw new ArgumentException("Error: Tried to create Stackable Buff, but MaxStacks was less than 2."); } BuffType = _buffGameScript.BuffType; Duration = duration; IsHidden = _buffGameScript.IsHidden; if (_buffGameScript.MaxStacks > 254 && !(BuffType == BuffType.COUNTER)) { MaxStacks = 254; } else { MaxStacks = _buffGameScript.MaxStacks; } Name = buffName; OriginSpell = originspell; if (onto.HasBuff(Name) && BuffAddType == BuffAddType.STACKS_AND_OVERLAPS) { // Put parent buff data into children buffs StackCount = onto.GetBuffWithName(Name).StackCount; Slot = onto.GetBuffWithName(Name).Slot; } else { StackCount = stacks; Slot = onto.GetNewBuffSlot(this); } SourceUnit = from; TimeElapsed = 0; TargetUnit = onto; }