CanNotSelectBySkillClass.cs 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CanNotSelectBySkillClass : ICardEffect, ICanNotSelectBySkillEffect
  6. {
  7. Func<Permanent, bool> PermanentCondition { get; set; }
  8. Func<ICardEffect, bool> CardEffectCondition { get; set; }
  9. public void SetUpCanNotSelectBySkillClass(Func<Permanent, bool> PermanentCondition, Func<ICardEffect, bool> CardEffectCondition)
  10. {
  11. this.PermanentCondition = PermanentCondition;
  12. this.CardEffectCondition = CardEffectCondition;
  13. }
  14. public bool CanNotSelectBySkill(Permanent permanent, ICardEffect cardEffect)
  15. {
  16. if (permanent != null && permanent.TopCard != null && cardEffect != null && cardEffect.EffectSourceCard != null)
  17. {
  18. if (PermanentCondition != null && CardEffectCondition != null)
  19. {
  20. if (PermanentCondition(permanent) && CardEffectCondition(cardEffect))
  21. {
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. }
  28. }