BT12_038.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_038 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Agumon") && targetPermanent.TopCard.CardTraits.Contains("Dinosaur") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Play 1 [Marcus Damon] from hand", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[When Digivolving] If you don't have a [Marcus Damon] in play, you may play 1 [Marcus Damon] from your hand without paying its cost.";
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. if (cardSource != null)
  33. {
  34. if (cardSource.CardNames.Contains("Marcus Damon") || cardSource.CardNames.Contains("MarcusDamon"))
  35. {
  36. if (cardSource.Owner == card.Owner)
  37. {
  38. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  39. {
  40. return true;
  41. }
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (card.Owner.HandCards.Count >= 1)
  56. {
  57. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardNames.Contains("Marcus Damon") || permanent.TopCard.CardNames.Contains("MarcusDamon")) == 0)
  58. {
  59. return true;
  60. }
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. List<CardSource> selectedCards = new List<CardSource>();
  68. int maxCount = 1;
  69. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  70. selectHandEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CanSelectCardCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount,
  76. canNoSelect: true,
  77. canEndNotMax: false,
  78. isShowOpponent: true,
  79. selectCardCoroutine: SelectCardCoroutine,
  80. afterSelectCardCoroutine: null,
  81. mode: SelectHandEffect.Mode.Custom,
  82. cardEffect: activateClass);
  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 StartCoroutine(selectHandEffect.Activate());
  86. IEnumerator SelectCardCoroutine(CardSource cardSource)
  87. {
  88. selectedCards.Add(cardSource);
  89. yield return null;
  90. }
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  92. }
  93. }
  94. if (timing == EffectTiming.OnTappedAnyone)
  95. {
  96. ActivateClass activateClass = new ActivateClass();
  97. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  98. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  99. activateClass.SetIsInheritedEffect(true);
  100. activateClass.SetHashString("DP-2000_BT12_038");
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[Your Turn][Once Per Turn] If one of your yellow or red Tamers becomes suspended, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  105. }
  106. bool PermanentCondition(Permanent permanent)
  107. {
  108. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  109. {
  110. if (permanent.IsTamer)
  111. {
  112. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  113. {
  114. return true;
  115. }
  116. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  117. {
  118. return true;
  119. }
  120. }
  121. }
  122. return false;
  123. }
  124. bool CanSelectPermanentCondition(Permanent permanent)
  125. {
  126. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleArea(card))
  131. {
  132. if (CardEffectCommons.IsOwnerTurn(card))
  133. {
  134. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  135. {
  136. return true;
  137. }
  138. }
  139. }
  140. return false;
  141. }
  142. bool CanActivateCondition(Hashtable hashtable)
  143. {
  144. if (CardEffectCommons.IsExistOnBattleArea(card))
  145. {
  146. return true;
  147. }
  148. return false;
  149. }
  150. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  151. {
  152. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  153. {
  154. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  155. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  156. selectPermanentEffect.SetUp(
  157. selectPlayer: card.Owner,
  158. canTargetCondition: CanSelectPermanentCondition,
  159. canTargetCondition_ByPreSelecetedList: null,
  160. canEndSelectCondition: null,
  161. maxCount: maxCount,
  162. canNoSelect: false,
  163. canEndNotMax: false,
  164. selectPermanentCoroutine: SelectPermanentCoroutine,
  165. afterSelectPermanentCoroutine: null,
  166. mode: SelectPermanentEffect.Mode.Custom,
  167. cardEffect: activateClass);
  168. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  169. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  170. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  171. {
  172. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  173. }
  174. }
  175. }
  176. }
  177. return cardEffects;
  178. }
  179. }
  180. }