P_205.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Insane Synthetic Monster
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_205 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region ignoring colors
  13. if (timing == EffectTiming.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. => CardEffectCommons.HasMatchConditionPermanent((permanent) => permanent.TopCard.Owner == card.Owner && (permanent.IsTamer || permanent.IsDigimon) && permanent.TopCard.HasDMTraits, true);
  21. bool CardCondition(CardSource cardSource)
  22. => cardSource == card;
  23. }
  24. #endregion
  25. #region Main/Security Shared
  26. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  27. {
  28. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DrawAndDiscardCards(
  29. player: (card.Owner, card.Owner),
  30. drawAmount: 2,
  31. trashAmount: 2,
  32. card: card,
  33. activateClass: activateClass));
  34. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  35. }
  36. #endregion
  37. #region Main
  38. if (timing == EffectTiming.OptionSkill)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Draw 2, Trash 2.", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(null, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDescription());
  43. cardEffects.Add(activateClass);
  44. string EffectDescription()
  45. {
  46. return "[Main] <Draw 2> and trash 2 cards in your hand. Then, place this card in the battle area.";
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  51. }
  52. }
  53. #endregion
  54. #region Main - Delay
  55. if (timing == EffectTiming.OnDeclaration)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("By delete 1 7 play cost or less digimon, play 1 [Kimeramon]/[Millenniummon] in its name digimon from trash for 3 reduced play cost", CanUseCondition, card);
  59. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  60. cardEffects.Add(activateClass);
  61. string EffectDiscription()
  62. {
  63. return "[Main] <Delay>. By deleting 1 of your play cost 7 or lower Digimon, you may play 1 Digimon card with [Kimeramon] or [Millenniummon] in its name from your trash with the play cost reduced by 3.";
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.IsExistOnField(card);
  72. }
  73. bool CanSelectPermanentCondition(Permanent permanent)
  74. {
  75. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  76. && permanent.TopCard.HasPlayCost && permanent.TopCard.BasePlayCostFromEntity <= 7;
  77. }
  78. bool CanSelectCardCondition(CardSource cardSource)
  79. {
  80. return cardSource.IsDigimon
  81. && cardSource.ContainsCardName("Kimeramon") || cardSource.ContainsCardName("Millenniummon")
  82. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable hashtable)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  87. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  88. activateClass: activateClass,
  89. successProcess: permanents => DeleteOptionSuccessProcess(),
  90. failureProcess: null)
  91. );
  92. IEnumerator DeleteOptionSuccessProcess()
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  95. {
  96. Permanent selectedPermanent = null;
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: true,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  112. {
  113. selectedPermanent = permanent;
  114. yield return null;
  115. }
  116. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete", "The opponent is selecting 1 Digimon to delete");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  119. targetPermanents: new List<Permanent>() { selectedPermanent },
  120. activateClass: activateClass,
  121. successProcess: permanents => DeleteDigimonSuccessProcess(),
  122. failureProcess: null)
  123. );
  124. IEnumerator DeleteDigimonSuccessProcess()
  125. {
  126. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  127. {
  128. CardSource selectedTrashCard = null;
  129. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  130. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectCardCondition));
  131. selectCardEffect.SetUp(
  132. canTargetCondition: CanSelectCardCondition,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. canNoSelect: () => true,
  136. selectCardCoroutine: SelectCardCoroutine,
  137. afterSelectCardCoroutine: null,
  138. message: "Select 1 [Kimeramon]/[Millenniummon] to play",
  139. maxCount: maxCount,
  140. canEndNotMax: false,
  141. isShowOpponent: true,
  142. mode: SelectCardEffect.Mode.Custom,
  143. root: SelectCardEffect.Root.Trash,
  144. customRootCardList: null,
  145. canLookReverseCard: true,
  146. selectPlayer: card.Owner,
  147. cardEffect: activateClass);
  148. IEnumerator SelectCardCoroutine(CardSource cardSource)
  149. {
  150. selectedTrashCard = cardSource;
  151. yield return null;
  152. }
  153. selectCardEffect.SetUpCustomMessage("Select 1 [Kimeramon]/[Millenniummon] to play", "The opponent is selecting 1 [Kimeramon]/[Millenniummon] to play");
  154. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Card");
  155. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  156. if (selectedTrashCard != null)
  157. {
  158. int cost = selectedTrashCard.BasePlayCostFromEntity - 3;
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  160. cardSources: new List<CardSource>() { selectedTrashCard },
  161. activateClass: activateClass,
  162. payCost: true,
  163. isTapped: false,
  164. root: SelectCardEffect.Root.Trash,
  165. activateETB: true,
  166. fixedCost: cost));
  167. }
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. #endregion
  175. #region Security
  176. if (timing == EffectTiming.SecuritySkill)
  177. {
  178. ActivateClass activateClass = new ActivateClass();
  179. activateClass.SetUpICardEffect("Draw 2, Trash 2.", CanUseCondition, card);
  180. activateClass.SetUpActivateClass(null, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDescription());
  181. cardEffects.Add(activateClass);
  182. string EffectDescription()
  183. {
  184. return "[Security] <Draw 2> and trash 2 cards in your hand. Then, place this card in the battle area.";
  185. }
  186. bool CanUseCondition(Hashtable hashtable)
  187. {
  188. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  189. }
  190. }
  191. #endregion
  192. return cardEffects;
  193. }
  194. }
  195. }