BT12_026.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_026 : 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("Place 1 card to digivolution cards to trash digivolution cards", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] By placing 1 blue level 5 or lower Digimon card from your hand under this Digimon as its bottom digivolution card, trash the bottom 2 digivolution cards of 2 of your opponent's Digimon.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.HasCardColor(CardColor.Blue))
  25. {
  26. if (cardSource.Level <= 5)
  27. {
  28. if (cardSource.HasLevel)
  29. {
  30. if (cardSource.IsDigimon)
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  42. {
  43. if (permanent.CanSelectBySkill(activateClass))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (card.Owner.HandCards.Count >= 1)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. bool added = false;
  68. if (!card.PermanentOfThisCard().IsToken)
  69. {
  70. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  71. {
  72. List<CardSource> selectedCards = new List<CardSource>();
  73. int maxCount = 1;
  74. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  75. selectHandEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectCardCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: true,
  82. canEndNotMax: false,
  83. isShowOpponent: true,
  84. selectCardCoroutine: SelectCardCoroutine,
  85. afterSelectCardCoroutine: null,
  86. mode: SelectHandEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  89. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  90. yield return StartCoroutine(selectHandEffect.Activate());
  91. IEnumerator SelectCardCoroutine(CardSource cardSource)
  92. {
  93. selectedCards.Add(cardSource);
  94. yield return null;
  95. }
  96. if (selectedCards.Count >= 1)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  99. added = true;
  100. }
  101. }
  102. }
  103. if (added)
  104. {
  105. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  106. {
  107. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  108. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  109. selectPermanentEffect.SetUp(
  110. selectPlayer: card.Owner,
  111. canTargetCondition: CanSelectPermanentCondition,
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. maxCount: maxCount,
  115. canNoSelect: false,
  116. canEndNotMax: false,
  117. selectPermanentCoroutine: SelectPermanentCoroutine,
  118. afterSelectPermanentCoroutine: null,
  119. mode: SelectPermanentEffect.Mode.Custom,
  120. cardEffect: activateClass);
  121. selectPermanentEffect.SetUpCustomMessage("Select Digimon that will trash digivolution cards.", "The opponent is selecting Digimon that will trash digivolution cards.");
  122. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  123. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  124. {
  125. Permanent selectedPermanent = permanent;
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 2, isFromTop: false, activateClass: activateClass));
  127. }
  128. }
  129. }
  130. }
  131. }
  132. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  136. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  137. activateClass.SetHashString("Memory+1_BT12_026");
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. {
  141. return "[All Turns][Once Per Turn] If a digivolution card of an opponent's Digimon is trashed, gain 1 memory.";
  142. }
  143. bool PermanentCondition(Permanent permanent)
  144. {
  145. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  146. }
  147. bool CanUseCondition(Hashtable hashtable)
  148. {
  149. if (CardEffectCommons.IsExistOnBattleArea(card))
  150. {
  151. if (CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, PermanentCondition, cardEffect => true, cardSource => true))
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. bool CanActivateCondition(Hashtable hashtable)
  159. {
  160. if (CardEffectCommons.IsExistOnBattleArea(card))
  161. {
  162. return true;
  163. }
  164. return false;
  165. }
  166. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  169. }
  170. }
  171. return cardEffects;
  172. }
  173. }
  174. }