BT22_036.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Chaperomon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_036 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Overclock
  13. if (timing == EffectTiming.OnEndTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.OverclockSelfEffect(trait: "Puppet", isInheritedEffect: false, card: card,
  16. condition: null));
  17. }
  18. #endregion
  19. #region Hand Main
  20. if (timing == EffectTiming.OnDeclaration)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Place 1 [ShoeShoemon] from trash into a [Shoemon] sources, then digivolve", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[Hand] [Main] If you have [Arisa Kinosaki], by placing 1 [ShoeShoemon] from your trash as any of your [Shoemon]'s bottom digivolution card, it digivolves into this card for a digivolution cost of 3, ignoring digivolution requirements.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnHand(card)
  33. && CardEffectCommons.IsOwnerTurn(card)
  34. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsArisaKinosaki)
  35. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsShoemon)
  36. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsShoeShoemon);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnHand(card)
  41. && CardEffectCommons.IsOwnerTurn(card)
  42. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsArisaKinosaki)
  43. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsShoemon)
  44. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsShoeShoemon);
  45. }
  46. bool IsArisaKinosaki(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && permanent.TopCard.EqualsCardName("Arisa Kinosaki");
  47. bool IsShoemon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && permanent.TopCard.EqualsCardName("Shoemon");
  48. bool IsShoeShoemon(CardSource cardSource) => cardSource.EqualsCardName("ShoeShoemon");
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. CardSource selectedShoeShoeMon = null;
  52. #region Select ShoeShoemon From trash
  53. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsShoeShoemon));
  54. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  55. selectCardEffect.SetUp(
  56. canTargetCondition: IsShoeShoemon,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. canNoSelect: () => false,
  60. selectCardCoroutine: SelectCardCoroutine,
  61. afterSelectCardCoroutine: null,
  62. message: "Select 1 [ShoeShoemon] to add to sources",
  63. maxCount: maxCount,
  64. canEndNotMax: false,
  65. isShowOpponent: true,
  66. mode: SelectCardEffect.Mode.Custom,
  67. root: SelectCardEffect.Root.Trash,
  68. customRootCardList: null,
  69. canLookReverseCard: true,
  70. selectPlayer: card.Owner,
  71. cardEffect: activateClass);
  72. IEnumerator SelectCardCoroutine(CardSource cardSource)
  73. {
  74. selectedShoeShoeMon = cardSource;
  75. yield return null;
  76. }
  77. selectCardEffect.SetUpCustomMessage("Select 1 [ShoeShoemon] to add to sources.", "The opponent is selecting 1 [ShoeShoemon] to add to sources.");
  78. yield return StartCoroutine(selectCardEffect.Activate());
  79. #endregion
  80. if (selectedShoeShoeMon != null)
  81. {
  82. Permanent selectedShoemon = null;
  83. #region Select Shoemon on Field
  84. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, IsShoemon));
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: IsShoemon,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: maxCount1,
  92. canNoSelect: false,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: SelectPermanentCoroutine,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. selectedShoemon = permanent;
  101. yield return null;
  102. }
  103. selectPermanentEffect.SetUpCustomMessage("Select 1 [Shoemon] to gain source", "The opponent is selecting 1 [Shoemon] to gain source");
  104. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  105. #endregion
  106. if (selectedShoemon != null)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(
  109. selectedShoemon.AddDigivolutionCardsBottom(new List<CardSource>() { selectedShoeShoeMon }, activateClass));
  110. if (selectedShoemon.DigivolutionCards.Contains(selectedShoeShoeMon)) yield return ContinuousController.instance.StartCoroutine(
  111. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  112. targetPermanent: selectedShoemon,
  113. cardCondition: cs => cs == card,
  114. payCost: true,
  115. reduceCostTuple: null,
  116. fixedCostTuple: null,
  117. ignoreDigivolutionRequirementFixedCost: 3,
  118. isHand: true,
  119. activateClass: activateClass,
  120. successProcess: null,
  121. isOptional: false));
  122. }
  123. }
  124. yield return null;
  125. }
  126. }
  127. #endregion
  128. #region All Turns - ESS
  129. if (timing == EffectTiming.WhenRemoveField)
  130. {
  131. ActivateClass activateClass = new ActivateClass();
  132. activateClass.SetUpICardEffect("Delete 1 of your other Digimon to prevent this Digimon from leaving", CanUseCondition, card);
  133. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  134. activateClass.SetIsInheritedEffect(true);
  135. activateClass.SetHashString("BT22_036_Substitute");
  136. cardEffects.Add(activateClass);
  137. string EffectDescription()
  138. {
  139. return "[All Turns] [Once Per Turn] When this Digimon would leave the battle area other than by your effects, by deleting 1 of your Tokens or other [Puppet] trait Digimon, it doesn't leave.";
  140. }
  141. bool CanSelectPermanentCondition(Permanent permanent)
  142. {
  143. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  144. permanent != card.PermanentOfThisCard() &&
  145. (permanent.IsToken || permanent.TopCard.ContainsTraits("Puppet"));
  146. }
  147. bool CanUseCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  150. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card) &&
  151. !CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card));
  152. }
  153. bool CanActivateCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  156. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  157. }
  158. IEnumerator ActivateCoroutine(Hashtable hashtable)
  159. {
  160. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  161. {
  162. Permanent thisCardPermanent = card.PermanentOfThisCard();
  163. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  164. selectPermanentEffect.SetUp(
  165. selectPlayer: card.Owner,
  166. canTargetCondition: CanSelectPermanentCondition,
  167. canTargetCondition_ByPreSelecetedList: null,
  168. canEndSelectCondition: null,
  169. maxCount: 1,
  170. canNoSelect: true,
  171. canEndNotMax: false,
  172. selectPermanentCoroutine: SelectPermanentCoroutine,
  173. afterSelectPermanentCoroutine: null,
  174. mode: SelectPermanentEffect.Mode.Custom,
  175. cardEffect: activateClass);
  176. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  177. "The opponent is selecting 1 Digimon to delete.");
  178. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  179. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  180. {
  181. yield return ContinuousController.instance.StartCoroutine(
  182. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  183. targetPermanents: new List<Permanent>() { permanent },
  184. activateClass: activateClass,
  185. successProcess: _ => SuccessProcess(),
  186. failureProcess: null));
  187. IEnumerator SuccessProcess()
  188. {
  189. thisCardPermanent.willBeRemoveField = false;
  190. thisCardPermanent.HideDeleteEffect();
  191. thisCardPermanent.HideHandBounceEffect();
  192. thisCardPermanent.HideDeckBounceEffect();
  193. thisCardPermanent.HideWillRemoveFieldEffect();
  194. yield return null;
  195. }
  196. }
  197. }
  198. }
  199. }
  200. #endregion
  201. return cardEffects;
  202. }
  203. }
  204. }