public bool IsEnabled() { var flag = true; EnableConditions.ForEach(p => flag &= p.Eval(Owner)); flag &= TurnsActive < 0 || Owner.Game.Turn <= Turn + TurnsActive; if (!flag) { Owner.Game.LazyRemoves.Enqueue(this); } return(flag); }
public bool IsEnabled() { var flag = true; EnableConditions.ForEach(p => flag &= p.Eval(Owner)); RemoveTriggers.ToList().ForEach(p => flag &= Owner.Controller[p.Key] <= p.Value); flag &= TurnsActive < 0 || Owner.Game.Turn <= Turn + TurnsActive; if (!flag && !Owner.Game.LazyRemoves.Contains(this)) { Owner.Game.LazyRemoves.Enqueue(this); // execute removal task here, ex. health rentantion if (RemovalTask != null) { Game.Log(LogLevel.INFO, BlockType.TRIGGER, "Enchant", "executing removal task priority here"); Owner.Controller.Game.TaskQueue.Execute(RemovalTask, Owner.Controller, Owner, Owner); } } return(flag); }