BT12_028.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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_028 : 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. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  15. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  16. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  17. addJogressConditionClass.SetNotShowUI(true);
  18. cardEffects.Add(addJogressConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. JogressCondition GetJogress(CardSource cardSource)
  24. {
  25. if (cardSource == card)
  26. {
  27. bool PermanentCondition1(Permanent permanent) => permanent.TopCard.CardColors.Contains(CardColor.Blue) && permanent.Levels_ForJogress(card).Contains(4);
  28. bool PermanentCondition2(Permanent permanent) => permanent.TopCard.CardColors.Contains(CardColor.Green) && permanent.Levels_ForJogress(card).Contains(4);
  29. JogressConditionElement[] elements = new JogressConditionElement[]
  30. {
  31. new JogressConditionElement(PermanentCondition1, "a level 4 blue Digimon"),
  32. new JogressConditionElement(PermanentCondition2, "a level 4 green Digimon"),
  33. };
  34. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  35. return jogressCondition;
  36. }
  37. return null;
  38. }
  39. }
  40. if (timing == EffectTiming.OnEnterFieldAnyone)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Trash digivolution cards and opponent's Digimon can't attack", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[When Digivolving] Trash the top 3 digivolution cards of all of your opponent's Digimon. Then, when DNA digivolving, 2 of your opponent's Digimon with no digivolution cards in play can't attack until the end of your opponent's turn.";
  49. }
  50. bool CanSelectPermanentCondition(Permanent permanent)
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent.DigivolutionCards.Count((cardSource) => !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1)
  55. {
  56. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanSelectPermanentCondition1(Permanent permanent)
  65. {
  66. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  67. {
  68. if (permanent.HasNoDigivolutionCards)
  69. {
  70. if (permanent.CanSelectBySkill(activateClass))
  71. {
  72. return true;
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  81. }
  82. bool CanActivateCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleArea(card))
  85. {
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  87. {
  88. return true;
  89. }
  90. if (CardEffectCommons.IsJogress(hashtable))
  91. {
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. foreach (Permanent selectedPermanent in card.Owner.Enemy.GetBattleAreaDigimons())
  103. {
  104. if (CanSelectPermanentCondition(selectedPermanent))
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 3, isFromTop: true, activateClass: activateClass));
  107. }
  108. }
  109. if (CardEffectCommons.IsJogress(_hashtable))
  110. {
  111. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  112. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  113. selectPermanentEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: CanSelectPermanentCondition1,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: maxCount,
  119. canNoSelect: false,
  120. canEndNotMax: false,
  121. selectPermanentCoroutine: SelectPermanentCoroutine,
  122. afterSelectPermanentCoroutine: null,
  123. mode: SelectPermanentEffect.Mode.Custom,
  124. cardEffect: activateClass);
  125. selectPermanentEffect.SetUpCustomMessage("Select Digimon that will get effects.", "The opponent is selecting Digimon that will get effects.");
  126. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  127. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  128. {
  129. Permanent selectedPermanent = permanent;
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: selectedPermanent, defenderCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  131. }
  132. }
  133. }
  134. }
  135. if (timing == EffectTiming.OnEndAttack)
  136. {
  137. ActivateClass activateClass = new ActivateClass();
  138. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  139. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  140. activateClass.SetIsInheritedEffect(true);
  141. cardEffects.Add(activateClass);
  142. string EffectDiscription()
  143. {
  144. return "[End of Attack] If this Digimon has [Imperialdramon] in its name or a [Free] trait, gain 1 memory.";
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  149. }
  150. bool CanActivateCondition(Hashtable hashtable)
  151. {
  152. if (CardEffectCommons.IsExistOnBattleArea(card))
  153. {
  154. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Imperialdramon"))
  155. {
  156. return true;
  157. }
  158. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Free"))
  159. {
  160. return true;
  161. }
  162. }
  163. return false;
  164. }
  165. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  166. {
  167. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  168. }
  169. }
  170. return cardEffects;
  171. }
  172. }
  173. }