BT23_081.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Chitose Imai
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_081 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. bool PermamentCondition(Permanent permanent)
  16. {
  17. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  18. && permanent.TopCard.HasCSTraits;
  19. }
  20. bool Condition()
  21. {
  22. return CardEffectCommons.IsOwnerTurn(card);
  23. }
  24. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOwnerDigimonConditionalEffect(
  25. effectDescription: "[Start of Your Main Phase] If you have a Digimon with the [CS] trait, gain 1 memory.",
  26. permamentCondition: PermamentCondition,
  27. condition: Condition,
  28. card: card));
  29. }
  30. #endregion
  31. #region On Play
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("play 1 play cost 5- [Hudie] trait digimon from hand", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[On Play] You may play 1 play cost 5 or lower Digimon card with the [Hudie] trait from your hand without paying the cost.";
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleArea(card)
  45. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleArea(card);
  50. }
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. return cardSource.IsDigimon
  54. && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
  55. && cardSource.EqualsTraits("Hudie")
  56. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  61. {
  62. CardSource selectedCard = null;
  63. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  64. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  65. selectHandEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: CanSelectCardCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: true,
  72. canEndNotMax: false,
  73. isShowOpponent: true,
  74. selectCardCoroutine: SelectCardCoroutine,
  75. afterSelectCardCoroutine: null,
  76. mode: SelectHandEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. IEnumerator SelectCardCoroutine(CardSource cardSource)
  79. {
  80. selectedCard = cardSource;
  81. yield return null;
  82. }
  83. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  84. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  85. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  86. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  87. cardSources: new List<CardSource>() { selectedCard },
  88. activateClass: activateClass,
  89. payCost: false,
  90. isTapped: false,
  91. root: SelectCardEffect.Root.Hand,
  92. activateETB: true));
  93. }
  94. }
  95. }
  96. #endregion
  97. #region All Turns
  98. if (timing == EffectTiming.OnTappedAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect("By suspending this tamer, -3K DP 1 digimon", CanUseCondition, card);
  102. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  103. cardEffects.Add(activateClass);
  104. string EffectDiscription()
  105. {
  106. return "[All Turns] When any of your [Hudie] trait Digimon suspend, by suspending this Tamer, 1 of your opponent's Digimon gets -3000 DP for the turn.";
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.IsExistOnBattleArea(card)
  111. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition);
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsExistOnBattleArea(card)
  116. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  117. }
  118. bool PermanentCondition(Permanent permanent)
  119. {
  120. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  121. && permanent.TopCard.EqualsTraits("Hudie");
  122. }
  123. bool IsOpponentsDigimon(Permanent permanent)
  124. {
  125. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  130. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  131. {
  132. Permanent selectedPermanent = null;
  133. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  134. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: IsOpponentsDigimon,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: maxCount,
  141. canNoSelect: false,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: SelectedPermanent,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. IEnumerator SelectedPermanent(Permanent target)
  148. {
  149. selectedPermanent = target;
  150. yield return null;
  151. }
  152. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain -3K DP.", "The opponent is selecting 1 Digimon that will gain -3K DP..");
  153. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  154. if (selectedPermanent != null)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  157. targetPermanent: selectedPermanent,
  158. changeValue: -3000,
  159. effectDuration: EffectDuration.UntilEachTurnEnd,
  160. activateClass: activateClass));
  161. }
  162. }
  163. }
  164. }
  165. #endregion
  166. #region Security
  167. if (timing == EffectTiming.SecuritySkill)
  168. {
  169. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  170. }
  171. #endregion
  172. return cardEffects;
  173. }
  174. }
  175. }