BT23_085.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. //Ryuji Mishima
  6. namespace DCGO.CardEffects.BT23
  7. {
  8. public class BT23_085 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Main Phase
  14. if (timing == EffectTiming.OnStartMainPhase)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Gain 1 memory", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Start of Your Main Phase] If you have a Digimon with the [CS] trait, gain 1 memory.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleArea(card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card)
  31. && CardEffectCommons.IsOwnerTurn(card)
  32. && CardEffectCommons.HasMatchConditionPermanent(PermamentCondition)
  33. && card.Owner.CanAddMemory(activateClass);
  34. }
  35. bool PermamentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  38. && permanent.TopCard.HasCSTraits;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable hashtable)
  41. {
  42. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  43. }
  44. }
  45. #endregion
  46. #region On Play
  47. if (timing == EffectTiming.OnEnterFieldAnyone)
  48. {
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect("Opponent's effects can't reduce DP, and gain <Reboot> and <Blocker>", CanUseCondition, card);
  51. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  52. cardEffects.Add(activateClass);
  53. string EffectDescription()
  54. {
  55. return "[On Play] Until your opponent's turn ends, their effects can't reduce the DP of 1 of your [Hudie] trait Digimon, and it gains <Reboot> and <Blocker>.";
  56. }
  57. bool CanSelectPermanentCondition(Permanent permanent)
  58. {
  59. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  60. {
  61. if (permanent.TopCard.HasHudieTraits)
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. if (CardEffectCommons.IsExistOnBattleArea(card))
  75. {
  76. return CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  77. }
  78. return false;
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable hashtable)
  81. {
  82. Permanent selectedPermanent = null;
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: 1,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain effects.", "The opponent is selecting 1 Digimon that will gain effects.");
  97. yield return StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. selectedPermanent = permanent;
  101. yield return null;
  102. }
  103. if (selectedPermanent != null)
  104. {
  105. // DP reduction protection
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainImmuneFromDPMinus(
  107. targetPermanent: selectedPermanent,
  108. cardEffectCondition: CardEffectCondition,
  109. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  110. activateClass: activateClass,
  111. effectName: "Can't have DP reduced by opponent's effects"));
  112. bool CardEffectCondition(ICardEffect cardEffect)
  113. {
  114. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  115. }
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  117. targetPermanent: selectedPermanent,
  118. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  119. activateClass: activateClass));
  120. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  121. targetPermanent: selectedPermanent,
  122. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  123. activateClass: activateClass));
  124. }
  125. }
  126. }
  127. #endregion
  128. #region All Turns
  129. if (timing == EffectTiming.OnTappedAnyone)
  130. {
  131. ActivateClass activateClass = new ActivateClass();
  132. activateClass.SetUpICardEffect("By suspending this tamer, use 1 option card", CanUseCondition, card);
  133. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  134. cardEffects.Add(activateClass);
  135. string EffectDiscription()
  136. {
  137. return "[All Turns] When any of your [Hudie] trait Digimon suspend, by suspending this Tamer, you may use 1 single-color [CS] trait Option card from your hand without paying the cost.";
  138. }
  139. bool CanUseCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.IsExistOnBattleArea(card)
  142. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition);
  143. }
  144. bool CanActivateCondition(Hashtable hashtable)
  145. {
  146. return CardEffectCommons.IsExistOnBattleArea(card)
  147. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  148. }
  149. bool PermanentCondition(Permanent permanent)
  150. {
  151. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  152. && permanent.TopCard.EqualsTraits("Hudie");
  153. }
  154. bool CanSelectOptionCard(CardSource cardSource)
  155. {
  156. return cardSource.HasCSTraits
  157. && cardSource.OptionCardColors.Count == 1
  158. && !cardSource.CanNotPlayThisOption;
  159. }
  160. IEnumerator ActivateCoroutine(Hashtable hashtable)
  161. {
  162. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  163. permanents: new List<Permanent>() { card.PermanentOfThisCard() },
  164. hashtable: hashtable).Tap()
  165. );
  166. if (card.Owner.HandCards.Count(CanSelectOptionCard) >= 1)
  167. {
  168. List<CardSource> selectedCards = new List<CardSource>();
  169. int maxCount = 1;
  170. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  171. selectHandEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectOptionCard,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: maxCount,
  177. canNoSelect: true,
  178. canEndNotMax: false,
  179. isShowOpponent: true,
  180. selectCardCoroutine: SelectCardCoroutine,
  181. afterSelectCardCoroutine: null,
  182. mode: SelectHandEffect.Mode.Custom,
  183. cardEffect: activateClass);
  184. selectHandEffect.SetUpCustomMessage("Select 1 option card to use.", "The opponent is selecting 1 option card to use.");
  185. selectHandEffect.SetUpCustomMessage_ShowCard("Used Card");
  186. yield return StartCoroutine(selectHandEffect.Activate());
  187. IEnumerator SelectCardCoroutine(CardSource cardSource)
  188. {
  189. selectedCards.Add(cardSource);
  190. yield return null;
  191. }
  192. yield return ContinuousController.instance.StartCoroutine(
  193. CardEffectCommons.PlayOptionCards(
  194. cardSources: selectedCards,
  195. activateClass: activateClass,
  196. payCost: false,
  197. root: SelectCardEffect.Root.Hand));
  198. }
  199. }
  200. }
  201. #endregion
  202. #region Security
  203. if (timing == EffectTiming.SecuritySkill)
  204. {
  205. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  206. }
  207. #endregion
  208. return cardEffects;
  209. }
  210. }
  211. }