WhenAddHand.cs 884 B

123456789101112131415161718192021222324252627282930
  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 hand cards added" effect
  9. public static bool CanTriggerWhenAddHand(Hashtable hashtable, Func<Player, bool> playerCondition, Func<ICardEffect, bool> cardEffectCondition)
  10. {
  11. List<Player> Players = GetPlayersFromHashtable(hashtable);
  12. if (Players != null)
  13. {
  14. if (Players.Count(player => playerCondition == null || playerCondition(player)) >= 1)
  15. {
  16. ICardEffect CardEffect = GetCardEffectFromHashtable(hashtable);
  17. if (cardEffectCondition == null || cardEffectCondition(CardEffect))
  18. {
  19. return true;
  20. }
  21. }
  22. }
  23. return false;
  24. }
  25. #endregion
  26. }