DaiPenmon_BT18_026.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class DaiPenmon_BT18_026 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.ContainsTraits("Hybrid")
  17. && (targetPermanent.TopCard.CardColors.Contains(CardColor.Blue) ||
  18. targetPermanent.TopCard.CardColors.Contains(CardColor.Red));
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Hand - Main
  30. if (timing == EffectTiming.OnDeclaration)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Your blue or red tamer digivolves into this card", CanUseCondition,
  34. card);
  35. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  36. cardEffects.Add(activateClass);
  37. string EffectDescription()
  38. {
  39. return
  40. "[Hand] [Main] By placing 1 [Kumamon] and [Korikakumon] from your trash under 1 of your blue or red Tamers, that Tamer digivolves into this card for digivolution cost of 3, ignoring its digivolution requirements.";
  41. }
  42. bool CanSelectHumanSpiritCardCondition(CardSource cardSource)
  43. {
  44. return cardSource.EqualsCardName("Kumamon");
  45. }
  46. bool CanSelectBeastSpiritCardCondition(CardSource cardSource)
  47. {
  48. return cardSource.EqualsCardName("Korikakumon");
  49. }
  50. bool CanSelectTamerPermanentCondition(Permanent permanent)
  51. {
  52. return permanent != null && CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  53. permanent.IsTamer &&
  54. (permanent.TopCard.CardColors.Contains(CardColor.Blue) || permanent.TopCard.CardColors.Contains(CardColor.Red));
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return card.Owner.HandCards.Contains(card) &&
  59. CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerPermanentCondition) &&
  60. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectHumanSpiritCardCondition) &&
  61. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectBeastSpiritCardCondition);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerPermanentCondition))
  66. {
  67. Permanent selectedPermanent = null;
  68. SelectPermanentEffect selectPermanentEffect =
  69. GManager.instance.GetComponent<SelectPermanentEffect>();
  70. selectPermanentEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CanSelectTamerPermanentCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: 1,
  76. canNoSelect: false,
  77. canEndNotMax: false,
  78. selectPermanentCoroutine: SelectPermanentCoroutine,
  79. afterSelectPermanentCoroutine: null,
  80. mode: SelectPermanentEffect.Mode.Custom,
  81. cardEffect: activateClass);
  82. selectPermanentEffect.SetUpCustomMessage("Select 1 tamer to digivolve.",
  83. "The opponent is selecting 1 tamer to digivolve.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. selectedPermanent = permanent;
  88. yield return null;
  89. }
  90. if (selectedPermanent != null &&
  91. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectHumanSpiritCardCondition) &&
  92. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectBeastSpiritCardCondition))
  93. {
  94. bool digivolve = false;
  95. List<CardSource> selectedCards = new List<CardSource>();
  96. SelectCardEffect selectCardEffect =
  97. GManager.instance.GetComponent<SelectCardEffect>();
  98. selectCardEffect.SetUp(
  99. canTargetCondition: (cardSource) =>
  100. CanSelectHumanSpiritCardCondition(cardSource) ||
  101. CanSelectBeastSpiritCardCondition(cardSource),
  102. canTargetCondition_ByPreSelecetedList: CanTargetConditionByPreSelectedList,
  103. canEndSelectCondition: CanEndSelectCondition,
  104. canNoSelect: () => false,
  105. selectCardCoroutine: SelectCardCoroutine,
  106. afterSelectCardCoroutine: null,
  107. message:
  108. "Select cards to place on the bottom of Digivolution cards\n(cards will be placed in the digivolution cards so that cards with lower numbers are on top).",
  109. maxCount: 2,
  110. canEndNotMax: false,
  111. isShowOpponent: true,
  112. mode: SelectCardEffect.Mode.Custom,
  113. root: SelectCardEffect.Root.Trash,
  114. customRootCardList: null,
  115. canLookReverseCard: true,
  116. selectPlayer: card.Owner,
  117. cardEffect: activateClass);
  118. yield return ContinuousController.instance.StartCoroutine(
  119. selectCardEffect.Activate());
  120. bool CanTargetConditionByPreSelectedList(List<CardSource> cardSources,
  121. CardSource cardSource)
  122. {
  123. if (cardSources.Count(CanSelectHumanSpiritCardCondition) >= 1)
  124. {
  125. if (CanSelectHumanSpiritCardCondition(cardSource))
  126. {
  127. return false;
  128. }
  129. }
  130. if (cardSources.Count(CanSelectBeastSpiritCardCondition) >= 1)
  131. {
  132. if (CanSelectBeastSpiritCardCondition(cardSource))
  133. {
  134. return false;
  135. }
  136. }
  137. return true;
  138. }
  139. bool CanEndSelectCondition(List<CardSource> cardSources)
  140. {
  141. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,
  142. CanSelectHumanSpiritCardCondition))
  143. {
  144. if (cardSources.Count(CanSelectHumanSpiritCardCondition) == 0)
  145. {
  146. return false;
  147. }
  148. }
  149. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,
  150. CanSelectBeastSpiritCardCondition))
  151. {
  152. if (cardSources.Count(CanSelectBeastSpiritCardCondition) == 0)
  153. {
  154. return false;
  155. }
  156. }
  157. if (cardSources.Count(CanSelectHumanSpiritCardCondition) >= 2)
  158. {
  159. return false;
  160. }
  161. if (cardSources.Count(CanSelectBeastSpiritCardCondition) >= 2)
  162. {
  163. return false;
  164. }
  165. return true;
  166. }
  167. IEnumerator SelectCardCoroutine(CardSource cardSource)
  168. {
  169. selectedCards.Add(cardSource);
  170. yield return null;
  171. }
  172. if (selectedCards.Count >= 1)
  173. {
  174. yield return ContinuousController.instance.StartCoroutine(
  175. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  176. if (selectedCards.Count == 2)
  177. {
  178. digivolve = true;
  179. }
  180. }
  181. if (digivolve)
  182. {
  183. yield return ContinuousController.instance.StartCoroutine(
  184. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  185. targetPermanent: selectedPermanent,
  186. cardCondition: source => source == card,
  187. payCost: true,
  188. reduceCostTuple: null,
  189. fixedCostTuple: null,
  190. ignoreDigivolutionRequirementFixedCost: 3,
  191. isHand: true,
  192. activateClass: activateClass,
  193. successProcess: null));
  194. }
  195. }
  196. }
  197. }
  198. }
  199. #endregion
  200. #region Iceclad
  201. if (timing == EffectTiming.None)
  202. {
  203. cardEffects.Add(CardEffectFactory.IcecladSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  204. }
  205. #endregion
  206. #region When Digivolving
  207. if (timing == EffectTiming.OnEnterFieldAnyone)
  208. {
  209. ActivateClass activateClass = new ActivateClass();
  210. activateClass.SetUpICardEffect(" Delete 1 of your opponent's Digimon with no digivolution cards",
  211. CanUseCondition, card);
  212. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  213. cardEffects.Add(activateClass);
  214. string EffectDescription()
  215. {
  216. return
  217. "[When Digivolving] Delete 1 of your opponent's Digimon with no digivolution cards.";
  218. }
  219. bool CanUseCondition(Hashtable hashtable)
  220. {
  221. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  222. }
  223. bool CanSelectPermanentCondition(Permanent permanent)
  224. {
  225. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  226. permanent.HasNoDigivolutionCards;
  227. }
  228. bool CanActivateCondition(Hashtable hashtable)
  229. {
  230. return CardEffectCommons.IsExistOnBattleArea(card) &&
  231. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  232. }
  233. IEnumerator ActivateCoroutine(Hashtable hashtable)
  234. {
  235. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  236. selectPermanentEffect.SetUp(
  237. selectPlayer: card.Owner,
  238. canTargetCondition: CanSelectPermanentCondition,
  239. canTargetCondition_ByPreSelecetedList: null,
  240. canEndSelectCondition: null,
  241. maxCount: 1,
  242. canNoSelect: false,
  243. canEndNotMax: false,
  244. selectPermanentCoroutine: null,
  245. afterSelectPermanentCoroutine: null,
  246. mode: SelectPermanentEffect.Mode.Destroy,
  247. cardEffect: activateClass);
  248. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  249. "The opponent is selecting 1 Digimon to delete.");
  250. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  251. }
  252. }
  253. #endregion
  254. #region Your Turn - ESS
  255. if (timing == EffectTiming.None)
  256. {
  257. bool Condition()
  258. {
  259. return CardEffectCommons.IsExistOnBattleArea(card);
  260. }
  261. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true,
  262. card: card, condition: Condition));
  263. }
  264. #endregion
  265. return cardEffects;
  266. }
  267. }
  268. }