BT24_017.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Medusamon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_017: CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Raid
  14. if(timing == EffectTiming.OnAllyAttack)
  15. {
  16. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  17. }
  18. #endregion
  19. #region Progress
  20. if (timing == EffectTiming.None)
  21. {
  22. cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, null));
  23. }
  24. #endregion
  25. #region Piercing
  26. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  27. {
  28. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region When Digivolving
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("Delete lowest DP Digimon, Return 2 cards from their trash to deck to play 2 Tokens and gain 2k DP per opponent's Digimon.", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  37. cardEffects.Add(activateClass);
  38. string EffectDescription()
  39. => "[When Digivolving] Delete 1 of your opponent's lowest DP Digimon. Then, by returning 2 cards from their trash to the bottom of the deck, they play 2 [Petrification] Tokens. (Digimon/White/3000 DP/ [Your Turn] This Digimon can't suspend. [On Deletion] Trash your top security card.) After, this Digimon gets +2000 DP for each of your opponent's Digimon until their turn ends.";
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleArea(card);
  47. }
  48. bool CanDeleteCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. #region Delete 1 lowest DP
  55. if (CardEffectCommons.HasMatchConditionPermanent(CanDeleteCondition))
  56. {
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanDeleteCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: 1,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: null,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Destroy,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select a digimon to delete.", "Opponent is selecting a Digimon to delete.");
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. }
  73. #endregion
  74. #region Conditional Effects
  75. if (card.Owner.Enemy.TrashCards.Count >= 2)
  76. {
  77. List<CardSource> selectedCards = new List<CardSource>();
  78. #region Bottom Deck 2 from trash
  79. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  80. selectCardEffect.SetUp(
  81. canTargetCondition: (card) => true,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. canNoSelect: () => true,
  85. selectCardCoroutine: SelectCardCoroutine,
  86. afterSelectCardCoroutine: null,
  87. message: "Select 2 cards to bottom deck",
  88. maxCount: 2,
  89. canEndNotMax: false,
  90. isShowOpponent: true,
  91. mode: SelectCardEffect.Mode.Custom,
  92. root: SelectCardEffect.Root.Custom,
  93. customRootCardList: card.Owner.Enemy.TrashCards,
  94. canLookReverseCard: true,
  95. selectPlayer: card.Owner,
  96. cardEffect: activateClass);
  97. IEnumerator SelectCardCoroutine(CardSource cardSource)
  98. {
  99. selectedCards.Add(cardSource);
  100. yield return null;
  101. }
  102. selectCardEffect.SetUpCustomMessage("Select 2 cards to bottom deck", "Your opponent is selecting 2 cards to bottom deck");
  103. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Cards");
  104. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  105. #endregion
  106. if (selectedCards.Count == 2)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ReturnRevealedCardsToLibraryBottom(
  109. remainingCards: selectedCards,
  110. activateClass: activateClass));
  111. #region Play 2 Tokens
  112. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPetrificationToken(activateClass, 2));
  113. #endregion
  114. #region Gain DP per enemy digimon
  115. int count = card.Owner.Enemy.GetBattleAreaDigimons().Count();
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  117. targetPermanent: card.PermanentOfThisCard(),
  118. changeValue: 2000 * count,
  119. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  120. activateClass: activateClass));
  121. #endregion
  122. }
  123. }
  124. #endregion
  125. }
  126. }
  127. #endregion
  128. return cardEffects;
  129. }
  130. }
  131. }