OnAddDigivolutionCards.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. public partial class CardEffectCommons
  7. {
  8. #region Can trigger "When digivolution card is added due to effect" effect
  9. public static bool CanTriggerOnAddDigivolutionCard(Hashtable hashtable, Func<Permanent, bool> permanentCondition, Func<ICardEffect, bool> cardEffectCondition, Func<CardSource, bool> cardCondition)
  10. {
  11. if (hashtable != null)
  12. {
  13. Permanent Permanent = GetPermanentFromHashtable(hashtable);
  14. if (Permanent != null)
  15. {
  16. if (Permanent.TopCard != null)
  17. {
  18. if (permanentCondition == null || permanentCondition(Permanent))
  19. {
  20. ICardEffect CardEffect = GetCardEffectFromHashtable(hashtable);
  21. if (CardEffect != null)
  22. {
  23. if (cardEffectCondition == null || cardEffectCondition(CardEffect))
  24. {
  25. List<CardSource> CardSources = GetCardSourcesFromHashtable(hashtable);
  26. if (CardSources != null)
  27. {
  28. if (CardSources.Count(cardSource => cardCondition == null || cardCondition(cardSource)) >= 1)
  29. {
  30. return true;
  31. }
  32. }
  33. }
  34. }
  35. }
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. #endregion
  42. }