BT17_038.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT17
  6. {
  7. public class BT17_038 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. // Alternate Digivolution
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Sakuyamon: Maid Mode");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: true,
  22. card: card, condition: null));
  23. }
  24. #endregion
  25. #region Barrier
  26. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  27. {
  28. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region When Digivolving
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("DP -6000, then use 1 [Plug - In] Option", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[When Digivolving] 1 of your opponent's Digimon gets -6000 DP for the turn. Then, you may use 1 Option card with [Plug-In] in its name or 1 yellow Option card with a cost of 5 or less from your hand without paying the cost.";
  41. }
  42. bool OptionCondition(CardSource cardSource)
  43. {
  44. if (cardSource.IsOption)
  45. {
  46. if (cardSource.ContainsCardName("Plug-In") || cardSource.HasCardColor(CardColor.Yellow))
  47. {
  48. if (cardSource.GetCostItself <= 5)
  49. {
  50. return true;
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanSelectCardCondition(CardSource cardSource)
  57. {
  58. if (OptionCondition(cardSource))
  59. {
  60. if (!cardSource.CanNotPlayThisOption)
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. bool CanSelectPermanentCondition(Permanent permanent)
  68. {
  69. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  74. }
  75. bool CanActivateCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  80. {
  81. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  82. {
  83. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  84. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectPermanentCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: false,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: SelectPermanentCoroutine,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.Custom,
  96. cardEffect: activateClass);
  97. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -6000.", "The opponent is selecting 1 Digimon that will get DP -6000.");
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -6000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  102. }
  103. }
  104. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  105. {
  106. List<CardSource> selectedCards = new List<CardSource>();
  107. int maxCount = 1;
  108. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  109. selectHandEffect.SetUp(
  110. selectPlayer: card.Owner,
  111. canTargetCondition: CanSelectCardCondition,
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. maxCount: maxCount,
  115. canNoSelect: true,
  116. canEndNotMax: false,
  117. isShowOpponent: true,
  118. selectCardCoroutine: SelectCardCoroutine,
  119. afterSelectCardCoroutine: null,
  120. mode: SelectHandEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectHandEffect.SetUpCustomMessage(
  123. "Select 1 option card to use.",
  124. "The opponent is selecting 1 option card to use.");
  125. selectHandEffect.SetUpCustomMessage_ShowCard("Used Card");
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. IEnumerator SelectCardCoroutine(CardSource cardSource)
  128. {
  129. selectedCards.Add(cardSource);
  130. yield return null;
  131. }
  132. yield return ContinuousController.instance.StartCoroutine(
  133. CardEffectCommons.PlayOptionCards(
  134. cardSources: selectedCards,
  135. activateClass: activateClass,
  136. payCost: false,
  137. root: SelectCardEffect.Root.Hand
  138. )
  139. );
  140. }
  141. }
  142. }
  143. #endregion
  144. #region Your Turn
  145. if (timing == EffectTiming.OnUseOption)
  146. {
  147. ActivateClass activateClass = new ActivateClass();
  148. activateClass.SetUpICardEffect("When you use an option, this Digimon can't be returned to hand or deck by effect.", CanUseCondition1, card);
  149. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  150. activateClass.SetHashString("AllTurns_Bt17_038");
  151. cardEffects.Add(activateClass);
  152. string EffectDiscription()
  153. {
  154. return "[Your Turn][Once Per Turn] When you use an Option card with a cost of 2 or more, this Digimon can't be returned to hand or deck by your opponent's effects until the end of their turn.";
  155. }
  156. bool CanUseCondition1(Hashtable hashtable)
  157. {
  158. if (CardEffectCommons.IsExistOnBattleArea(card))
  159. {
  160. if (CardEffectCommons.IsOwnerTurn(card))
  161. {
  162. if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, (cost) => cost >= 2, card))
  163. {
  164. return true;
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. bool CardEffectCondition(ICardEffect cardEffect)
  171. {
  172. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  173. }
  174. bool CanActivateCondition(Hashtable hashtable)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleArea(card))
  177. {
  178. return true;
  179. }
  180. return false;
  181. }
  182. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  183. {
  184. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHand(
  185. targetPermanent: card.PermanentOfThisCard(),
  186. cardEffectCondition: CardEffectCondition,
  187. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  188. activateClass: activateClass,
  189. effectName: "Can't return to hand by opponent's effects"));
  190. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeck(
  191. targetPermanent: card.PermanentOfThisCard(),
  192. cardEffectCondition: CardEffectCondition,
  193. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  194. activateClass: activateClass,
  195. effectName: "Can't return to deck by opponent's effects"));
  196. }
  197. }
  198. #endregion
  199. return cardEffects;
  200. }
  201. }
  202. }