EX3_011.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX3
  6. {
  7. public class EX3_011 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Delete 1 Digimon with 5000 DP or less and play 1 [Hina Kurihara] from hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Delete 1 of your opponent's Digimon with 5000 DP or less. Then, you may play 1 [Hina Kurihara] from your hand without paying the cost.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. if (cardSource.CardNames.Contains("Hina Kurihara") || cardSource.CardNames.Contains("HinaKurihara"))
  36. {
  37. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. return true;
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  59. {
  60. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: null,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Destroy,
  73. cardEffect: activateClass);
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. }
  76. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  77. {
  78. List<CardSource> selectedCards = new List<CardSource>();
  79. int maxCount = 1;
  80. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  81. selectHandEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectCardCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: maxCount,
  87. canNoSelect: true,
  88. canEndNotMax: false,
  89. isShowOpponent: true,
  90. selectCardCoroutine: SelectCardCoroutine,
  91. afterSelectCardCoroutine: null,
  92. mode: SelectHandEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  95. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  96. yield return StartCoroutine(selectHandEffect.Activate());
  97. IEnumerator SelectCardCoroutine(CardSource cardSource)
  98. {
  99. selectedCards.Add(cardSource);
  100. yield return null;
  101. }
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  103. }
  104. }
  105. }
  106. if (timing == EffectTiming.OnDestroyedAnyone)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  111. activateClass.SetIsInheritedEffect(true);
  112. activateClass.SetHashString("Memory+1_EX3_011");
  113. cardEffects.Add(activateClass);
  114. string EffectDiscription()
  115. {
  116. return "[All Turns][Once Per Turn] When an opponent's Digimon is deleted, if this Digimon has an [On Play] effect, gain 1 memory.";
  117. }
  118. bool PermanentCondition(Permanent permanent)
  119. {
  120. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. if (CardEffectCommons.IsExistOnBattleArea(card))
  125. {
  126. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  127. {
  128. return true;
  129. }
  130. }
  131. return false;
  132. }
  133. bool CanActivateCondition(Hashtable hashtable)
  134. {
  135. if (CardEffectCommons.IsExistOnBattleArea(card))
  136. {
  137. if (card.PermanentOfThisCard().TopCard.HasOnPlayEffect)
  138. {
  139. return true;
  140. }
  141. }
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  145. {
  146. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  147. }
  148. }
  149. return cardEffects;
  150. }
  151. }
  152. }