BT21_100.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //BT21_100 The Digimon I Designed
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_100 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Ignore Color Requirements
  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 IgnoreColorConditions(Permanent permanent)
  20. {
  21. return permanent.TopCard.EqualsCardName("Takato Matsuki");
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, IgnoreColorConditions);
  26. }
  27. bool CardCondition(CardSource cardSource)
  28. {
  29. return cardSource == card;
  30. }
  31. }
  32. #endregion
  33. #region Main
  34. if (timing == EffectTiming.OptionSkill)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Draw 1 trash 1", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  39. cardEffects.Add(activateClass);
  40. string EffectDescription()
  41. {
  42. return "[Main] <Draw 1> and trash 1 card in your hand. Then, place this card in the battle area.";
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  51. if (card.Owner.HandCards.Count >= 1)
  52. {
  53. int discardCount = Math.Min(1, card.Owner.HandCards.Count);
  54. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  55. selectHandEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: (cardSource) => true,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: discardCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. isShowOpponent: true,
  64. selectCardCoroutine: null,
  65. afterSelectCardCoroutine: null,
  66. mode: SelectHandEffect.Mode.Discard,
  67. cardEffect: activateClass);
  68. yield return StartCoroutine(selectHandEffect.Activate());
  69. }
  70. yield return ContinuousController.instance.StartCoroutine(
  71. CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  72. }
  73. }
  74. #endregion
  75. #region Delay
  76. if(timing == EffectTiming.OnDestroyedAnyone)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Digivolve to Gallant line when deletion happens", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDescription());
  81. cardEffects.Add(activateClass);
  82. string EffectDescription()
  83. {
  84. return "[Your Turn] When effects delete Digimon, <Delay>.\r\n• 1 of your Digimon with [Guilmon] or [Growlmon] in its name may digivolve into a Digimon card with [Growlmon], [Gallantmon] or [Megidramon] in its name in the trash without paying the cost.";
  85. }
  86. bool TriggerPermanentCondition(Permanent permanent)
  87. {
  88. return permanent.IsDigimon;
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.IsOwnerTurn(card) &&
  93. CardEffectCommons.CanDeclareOptionDelayEffect(card) &&
  94. CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, TriggerPermanentCondition) &&
  95. CardEffectCommons.IsByEffect(hashtable, null);
  96. }
  97. bool CanSelectPermanentCondition(Permanent permanent)
  98. {
  99. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  100. {
  101. if (permanent.TopCard.ContainsCardName("Guilmon") || permanent.TopCard.ContainsCardName("Growlmon"))
  102. {
  103. foreach (CardSource cardSource in card.Owner.TrashCards)
  104. {
  105. if (CanSelectCardCondition(cardSource))
  106. {
  107. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  108. {
  109. return true;
  110. }
  111. }
  112. }
  113. }
  114. }
  115. return false;
  116. }
  117. bool CanSelectCardCondition(CardSource cardSource)
  118. {
  119. return cardSource.ContainsCardName("Growlmon") ||
  120. cardSource.ContainsCardName("Gallantmon") ||
  121. cardSource.ContainsCardName("Megidramon");
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable hashtable)
  124. {
  125. yield return ContinuousController.instance.StartCoroutine(
  126. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  127. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  128. activateClass: activateClass, successProcess: _ => SuccessProcess(),
  129. failureProcess: null));
  130. }
  131. IEnumerator SuccessProcess()
  132. {
  133. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  134. {
  135. Permanent selectedPermanent = null;
  136. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  137. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  138. selectPermanentEffect.SetUp(
  139. selectPlayer: card.Owner,
  140. canTargetCondition: CanSelectPermanentCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: maxCount,
  144. canNoSelect: true,
  145. canEndNotMax: false,
  146. selectPermanentCoroutine: SelectPermanentCoroutine,
  147. afterSelectPermanentCoroutine: null,
  148. mode: SelectPermanentEffect.Mode.Custom,
  149. cardEffect: activateClass);
  150. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.",
  151. "The opponent is selecting 1 Digimon that will digivolve.");
  152. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  153. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  154. {
  155. selectedPermanent = permanent;
  156. yield return null;
  157. }
  158. if (selectedPermanent != null)
  159. {
  160. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  161. targetPermanent: selectedPermanent,
  162. cardCondition: CanSelectCardCondition,
  163. payCost: false,
  164. reduceCostTuple: null,
  165. fixedCostTuple: null,
  166. ignoreDigivolutionRequirementFixedCost: -1,
  167. isHand: false,
  168. activateClass: activateClass,
  169. successProcess: null));
  170. }
  171. }
  172. }
  173. }
  174. #endregion
  175. #region Security
  176. if (timing == EffectTiming.SecuritySkill)
  177. {
  178. ActivateClass activateClass = new ActivateClass();
  179. activateClass.SetUpICardEffect("Gain 1 memory", CanUseCondition, card);
  180. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  181. activateClass.SetIsSecurityEffect(true);
  182. cardEffects.Add(activateClass);
  183. string EffectDescription()
  184. {
  185. return
  186. "[Security] Gain 1 memory. Then, place this card in the battle area.";
  187. }
  188. bool CanUseCondition(Hashtable hashtable)
  189. {
  190. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable hashtable)
  193. {
  194. yield return ContinuousController.instance.StartCoroutine(
  195. card.Owner.AddMemory(1, activateClass));
  196. yield return ContinuousController.instance.StartCoroutine(
  197. CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  198. }
  199. }
  200. #endregion
  201. return cardEffects;
  202. }
  203. }
  204. }