EX5_056.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. public class EX5_056 : CEntity_Effect
  4. {
  5. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  6. {
  7. List<ICardEffect> cardEffects = new List<ICardEffect>();
  8. if (timing == EffectTiming.OnEnterFieldAnyone)
  9. {
  10. ActivateClass activateClass = new ActivateClass();
  11. activateClass.SetUpICardEffect("Draw cards and trash 1 card from hand", CanUseCondition, card);
  12. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  13. cardEffects.Add(activateClass);
  14. string EffectDiscription()
  15. {
  16. return "[On Play] For each of your opponent's Digimon, <Draw 1> (Draw 1 card from your deck). Then, trash 1 card in your hand.";
  17. }
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  21. }
  22. bool CanActivateCondition(Hashtable hashtable)
  23. {
  24. if (CardEffectCommons.IsExistOnBattleArea(card))
  25. {
  26. if (card.Owner.LibraryCards.Count >= 1)
  27. {
  28. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  29. {
  30. return true;
  31. }
  32. }
  33. if (card.Owner.HandCards.Count >= 1)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, card.Owner.Enemy.GetBattleAreaDigimons().Count, activateClass).Draw());
  43. if (card.Owner.HandCards.Count >= 1)
  44. {
  45. int discardCount = 1;
  46. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  47. selectHandEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: (cardSource) => true,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: discardCount,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. isShowOpponent: true,
  56. selectCardCoroutine: null,
  57. afterSelectCardCoroutine: null,
  58. mode: SelectHandEffect.Mode.Discard,
  59. cardEffect: activateClass);
  60. yield return StartCoroutine(selectHandEffect.Activate());
  61. }
  62. }
  63. }
  64. if (timing == EffectTiming.OnEnterFieldAnyone)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  69. activateClass.SetHashString("Memory1_EX5_065");
  70. activateClass.SetIsInheritedEffect(true);
  71. cardEffects.Add(activateClass);
  72. string EffectDiscription()
  73. {
  74. return "[All Turns] [Once Per Turn] When an effect plays an opponent's Digimon, gain 1 memory.";
  75. }
  76. bool PermanentCondition(Permanent permanent)
  77. {
  78. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. if (CardEffectCommons.IsExistOnBattleArea(card))
  83. {
  84. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  85. {
  86. if (CardEffectCommons.IsByEffect(hashtable, null))
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. bool CanActivateCondition(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.IsExistOnBattleArea(card))
  97. {
  98. return true;
  99. }
  100. return false;
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  105. }
  106. }
  107. return cardEffects;
  108. }
  109. }