BT7_043.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT7_043 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place 1 card from hand to the top of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may reveal 1 green Digimon card from your hand. If you do, place it on top of your deck.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.HasCardColor(CardColor.Green);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (card.Owner.HandCards.Count >= 1)
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  45. {
  46. int maxCount = 1;
  47. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  48. selectHandEffect.SetUp(
  49. selectPlayer: card.Owner,
  50. canTargetCondition: CanSelectCardCondition,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canEndSelectCondition: null,
  53. maxCount: maxCount,
  54. canNoSelect: true,
  55. canEndNotMax: false,
  56. isShowOpponent: true,
  57. selectCardCoroutine: null,
  58. afterSelectCardCoroutine: null,
  59. mode: SelectHandEffect.Mode.PutLibraryTop,
  60. cardEffect: activateClass);
  61. yield return StartCoroutine(selectHandEffect.Activate());
  62. }
  63. }
  64. }
  65. return cardEffects;
  66. }
  67. }