BT22_030.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Musimon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_030 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasAppmonTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Link Condition
  23. if (timing == EffectTiming.None)
  24. {
  25. static bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.TopCard.HasAppmonTraits;
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 1, card: card));
  30. }
  31. #endregion
  32. #region Link
  33. if (timing == EffectTiming.OnDeclaration)
  34. {
  35. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  36. }
  37. #endregion
  38. #region Your Turn
  39. if (timing == EffectTiming.WhenLinked)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Play 1 [Torajiro Asuka]", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  44. activateClass.SetHashString("BT22_030_WL");
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[Your Turn] [Once Per Turn] When this Digimon gets linked, if you have 1 or fewer Tamers, you may play 1 [Torajiro Asuka] from your hand without paying the cost.";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerWhenLinked(hashtable, IsMusimon, null);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  57. && CardEffectCommons.IsOwnerTurn(card)
  58. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsTorajiroAsuka)
  59. && CardEffectCommons.OwnerHas1OrLessTamers(card);
  60. }
  61. bool IsMusimon(Permanent permanent)
  62. {
  63. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  64. && permanent == card.PermanentOfThisCard();
  65. }
  66. bool IsTorajiroAsuka(CardSource cardSource)
  67. {
  68. return cardSource.EqualsCardName("Torajiro Asuka")
  69. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable hashtable)
  72. {
  73. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsTorajiroAsuka))
  74. {
  75. CardSource selectedCard = null;
  76. #region Select Torajiro Asuka
  77. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsTorajiroAsuka));
  78. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  79. selectHandEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: IsTorajiroAsuka,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: maxCount,
  85. canNoSelect: true,
  86. canEndNotMax: false,
  87. isShowOpponent: true,
  88. selectCardCoroutine: SelectCardCoroutine,
  89. afterSelectCardCoroutine: null,
  90. mode: SelectHandEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. IEnumerator SelectCardCoroutine(CardSource cardSource)
  93. {
  94. selectedCard = cardSource;
  95. yield return null;
  96. }
  97. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  98. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  99. yield return StartCoroutine(selectHandEffect.Activate());
  100. #endregion
  101. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  102. }
  103. }
  104. }
  105. #endregion
  106. #region Link Effect
  107. if (timing == EffectTiming.OnAllyAttack)
  108. {
  109. ActivateClass activateClass = new ActivateClass();
  110. activateClass.SetUpICardEffect("-2K DP", CanUseCondition, card);
  111. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  112. activateClass.SetHashString("BT22_030_WA");
  113. activateClass.SetIsLinkedEffect(true);
  114. cardEffects.Add(activateClass);
  115. string EffectDiscription()
  116. {
  117. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnField(card);
  126. }
  127. bool IsOpponentDigimon(Permanent permanent)
  128. {
  129. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon))
  134. {
  135. Permanent selectedPermament = null;
  136. #region Select Permanent
  137. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentDigimon));
  138. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  139. selectPermanentEffect.SetUp(
  140. selectPlayer: card.Owner,
  141. canTargetCondition: IsOpponentDigimon,
  142. canTargetCondition_ByPreSelecetedList: null,
  143. canEndSelectCondition: null,
  144. maxCount: maxCount,
  145. canNoSelect: false,
  146. canEndNotMax: false,
  147. selectPermanentCoroutine: SelectPermanentCoroutine,
  148. afterSelectPermanentCoroutine: null,
  149. mode: SelectPermanentEffect.Mode.Custom,
  150. cardEffect: activateClass);
  151. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  152. {
  153. selectedPermament = permanent;
  154. yield return null;
  155. }
  156. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -2K DP", "The opponent is selecting 1 Digimon to -2K DP");
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. #endregion
  159. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  160. targetPermanent: selectedPermament,
  161. changeValue: -2000,
  162. effectDuration: EffectDuration.UntilEachTurnEnd,
  163. activateClass: activateClass
  164. ));
  165. }
  166. }
  167. }
  168. #endregion
  169. return cardEffects;
  170. }
  171. }
  172. }