BT13_044.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_044 : 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. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  15. }
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Trash your 1 security and DP -6000", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[When Digivolving] By trashing the top card of your security stack, 1 of your opponent's Digimon gets -6000 DP until the end of your opponent's turn.";
  25. }
  26. bool CanSelectPermanentCondition(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.SecurityCards.Count >= 1)
  39. {
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  48. player: card.Owner,
  49. destroySecurityCount: 1,
  50. cardEffect: activateClass,
  51. fromTop: true).DestroySecurity());
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  53. {
  54. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: maxCount,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage(
  69. "Select 1 Digimon that will get DP -6000.",
  70. "The opponent is selecting 1 Digimon that will get DP -6000.");
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -6000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  75. }
  76. }
  77. }
  78. }
  79. if (timing == EffectTiming.OnLoseSecurity)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("Play 1 yellow Tamer from hand", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  84. activateClass.SetHashString("Play_BT13_044");
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription()
  87. {
  88. return "[All Turns][Once Per Turn] When a card is removed from your security stack, you may play 1 yellow Tamer card from your hand without paying the cost.";
  89. }
  90. bool CanSelectCardCondition(CardSource cardSource)
  91. {
  92. if (cardSource.IsTamer)
  93. {
  94. if (cardSource.HasCardColor(CardColor.Yellow))
  95. {
  96. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanActivateCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.IsExistOnBattleArea(card))
  118. {
  119. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. List<CardSource> selectedCards = new List<CardSource>();
  129. int maxCount = 1;
  130. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  131. selectHandEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectCardCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: true,
  138. canEndNotMax: false,
  139. isShowOpponent: true,
  140. selectCardCoroutine: SelectCardCoroutine,
  141. afterSelectCardCoroutine: null,
  142. mode: SelectHandEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  145. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  146. yield return StartCoroutine(selectHandEffect.Activate());
  147. IEnumerator SelectCardCoroutine(CardSource cardSource)
  148. {
  149. selectedCards.Add(cardSource);
  150. yield return null;
  151. }
  152. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  153. cardSources: selectedCards,
  154. activateClass: activateClass,
  155. payCost: false,
  156. isTapped: false,
  157. root: SelectCardEffect.Root.Hand,
  158. activateETB: true));
  159. }
  160. }
  161. return cardEffects;
  162. }
  163. }
  164. }