CollisionClass.cs 710 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. public class CollisionClass : ICardEffect, ICollisionEffect
  3. {
  4. public void SetUpCollisionClass(Func<Permanent, bool> PermanentCondition)
  5. {
  6. this.PermanentCondition = PermanentCondition;
  7. }
  8. Func<Permanent, bool> PermanentCondition { get; set; }
  9. public bool HasCollision(Permanent permanent)
  10. {
  11. if (PermanentCondition != null)
  12. {
  13. if (permanent != null)
  14. {
  15. if (permanent.TopCard != null)
  16. {
  17. if (PermanentCondition(permanent))
  18. {
  19. return true;
  20. }
  21. }
  22. }
  23. }
  24. return false;
  25. }
  26. }