EX9_017.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Garurumon
  5. namespace DCGO.CardEffects.EX9
  6. {
  7. public class EX9_017 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.IsLevel3)
  18. {
  19. if (targetPermanent.TopCard.EqualsTraits("DM"))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  27. permanentCondition: PermanentCondition,
  28. digivolutionCost: 2,
  29. ignoreDigivolutionRequirement: false,
  30. card: card,
  31. condition: null)
  32. );
  33. }
  34. #endregion
  35. #region Training
  36. if (timing == EffectTiming.OnDeclaration)
  37. {
  38. cardEffects.Add(CardEffectFactory.TrainingEffect(card: card));
  39. }
  40. #endregion
  41. #region On Play
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Place 1 digimon in hand as source, to trash digimon sources", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  47. cardEffects.Add(activateClass);
  48. string EffectDescription()
  49. {
  50. return
  51. "[On Play] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, for each of its face-down digivolution cards, trash any 1 digivolution card from your opponent's Digimon.";
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  60. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardCondition);
  61. }
  62. bool CanSelectHandCardCondition(CardSource cardSource)
  63. {
  64. return true;
  65. }
  66. bool CanSelectPermanentCondition(Permanent permanent)
  67. {
  68. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  69. permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1;
  70. }
  71. bool CanSelectCardCondition(CardSource cardSource)
  72. {
  73. return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable hashtable)
  76. {
  77. CardSource selectedCard = null;
  78. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  79. selectHandEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectHandCardCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: 1,
  85. canNoSelect: true,
  86. canEndNotMax: false,
  87. isShowOpponent: true,
  88. selectCardCoroutine: SelectCardCoroutine,
  89. afterSelectCardCoroutine: null,
  90. mode: SelectHandEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectHandEffect.SetUpCustomMessage("Select 1 card to place face-down on bottom of digivolution cards.",
  93. "The opponent is selecting 1 card to place face-down on bottom of digivolution cards.");
  94. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  95. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  96. IEnumerator SelectCardCoroutine(CardSource cardSource)
  97. {
  98. selectedCard = cardSource;
  99. yield return null;
  100. }
  101. if (selectedCard)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  104. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  105. .AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  107. permanentCondition: CanSelectPermanentCondition,
  108. cardCondition: CanSelectCardCondition,
  109. maxCount: card.PermanentOfThisCard().DigivolutionCards.Filter(source => source.IsFlipped).Count,
  110. canNoTrash: false,
  111. isFromOnly1Permanent: false,
  112. activateClass: activateClass
  113. ));
  114. }
  115. }
  116. }
  117. #endregion
  118. #region When Digivolving
  119. if (timing == EffectTiming.OnEnterFieldAnyone)
  120. {
  121. ActivateClass activateClass = new ActivateClass();
  122. activateClass.SetUpICardEffect("Place 1 digimon in hand as source, to trash digimon sources", CanUseCondition, card);
  123. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  124. cardEffects.Add(activateClass);
  125. string EffectDescription()
  126. {
  127. return
  128. "[When Digivolving] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, for each of its face-down digivolution cards, trash any 1 digivolution card from your opponent's Digimon.";
  129. }
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  137. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardCondition);
  138. }
  139. bool CanSelectHandCardCondition(CardSource cardSource)
  140. {
  141. return true;
  142. }
  143. bool CanSelectPermanentCondition(Permanent permanent)
  144. {
  145. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  146. permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1;
  147. }
  148. bool CanSelectCardCondition(CardSource cardSource)
  149. {
  150. return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  151. }
  152. IEnumerator ActivateCoroutine(Hashtable hashtable)
  153. {
  154. CardSource selectedCard = null;
  155. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  156. selectHandEffect.SetUp(
  157. selectPlayer: card.Owner,
  158. canTargetCondition: CanSelectHandCardCondition,
  159. canTargetCondition_ByPreSelecetedList: null,
  160. canEndSelectCondition: null,
  161. maxCount: 1,
  162. canNoSelect: true,
  163. canEndNotMax: false,
  164. isShowOpponent: true,
  165. selectCardCoroutine: SelectCardCoroutine,
  166. afterSelectCardCoroutine: null,
  167. mode: SelectHandEffect.Mode.Custom,
  168. cardEffect: activateClass);
  169. selectHandEffect.SetUpCustomMessage("Select 1 card to place face-down on bottom of digivolution cards.",
  170. "The opponent is selecting 1 card to place face-down on bottom of digivolution cards.");
  171. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  172. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  173. IEnumerator SelectCardCoroutine(CardSource cardSource)
  174. {
  175. selectedCard = cardSource;
  176. yield return null;
  177. }
  178. if (selectedCard)
  179. {
  180. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  181. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  182. .AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  183. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  184. permanentCondition: CanSelectPermanentCondition,
  185. cardCondition: CanSelectCardCondition,
  186. maxCount: card.PermanentOfThisCard().DigivolutionCards.Filter(source => source.IsFlipped).Count,
  187. canNoTrash: false,
  188. isFromOnly1Permanent: false,
  189. activateClass: activateClass
  190. ));
  191. }
  192. }
  193. }
  194. #endregion
  195. #region ESS - Jamming
  196. if (timing == EffectTiming.None)
  197. {
  198. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  199. }
  200. #endregion
  201. return cardEffects;
  202. }
  203. }
  204. }