CannotReduceCostClass.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CannotReduceCostClass : ICardEffect, ICannotReduceCostEffect
  6. {
  7. public void SetUpCannotReduceCostClass(Func<Player, bool> playerCondition, Func<List<Permanent>, bool> targetPermanentsCondition,
  8. Func<CardSource, bool> cardCondition)
  9. {
  10. _playerCondition = playerCondition;
  11. _targetPermanentsCondition = targetPermanentsCondition;
  12. _cardCondition = cardCondition;
  13. }
  14. Func<Player, bool> _playerCondition = null;
  15. Func<List<Permanent>, bool> _targetPermanentsCondition = null;
  16. Func<CardSource, bool> _cardCondition = null;
  17. public bool CannotReduceCost(Player player, List<Permanent> targetPermanents, CardSource cardSource)
  18. {
  19. if (_playerCondition != null)
  20. {
  21. if (player != null)
  22. {
  23. if (_playerCondition(player))
  24. {
  25. if (_targetPermanentsCondition != null)
  26. {
  27. if (_targetPermanentsCondition(targetPermanents))
  28. {
  29. if (cardSource != null)
  30. {
  31. if (_cardCondition != null)
  32. {
  33. if (_cardCondition(cardSource))
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. }