EX8_070.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. // Zofr Kabus
  6. namespace DCGO.CardEffects.EX8
  7. {
  8. public class EX8_070 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Main
  14. if (timing == EffectTiming.OptionSkill)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("By trashing 1 source, gain collision, piercing, reboot, +3000 DP, and can't be returned to hand or deck by opponent", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Main] By trashing any 1 digivolution card of 1 of your [Mineral] or [Rock] trait Digimon, until the end of your opponent's turn, it gains <Collision>, <Piercing> and <Reboot>, gets +3000 DP, and can't be returned to the hand or deck by your opponent's effects.";
  23. }
  24. bool HasProperTrait(CardSource source)
  25. {
  26. return source.EqualsTraits("Mineral") || source.EqualsTraits("Rock");
  27. }
  28. bool DigimonWithProperSource(Permanent permanent)
  29. {
  30. return CardEffectCommons.IsOwnerPermanent(permanent, card) &&
  31. permanent.IsDigimon &&
  32. HasProperTrait(permanent.TopCard) &&
  33. permanent.DigivolutionCards.Count() > 0;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card) &&
  38. CardEffectCommons.HasMatchConditionPermanent(DigimonWithProperSource);
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable hashtable)
  41. {
  42. bool cardsTrashed = false;
  43. Permanent selectedPermanent = null;
  44. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  45. permanentCondition: DigimonWithProperSource,
  46. cardCondition: null,
  47. maxCount: 1,
  48. canNoTrash: true,
  49. isFromOnly1Permanent: true,
  50. activateClass: activateClass,
  51. afterSelectionCoroutine: AfterTrashedCards
  52. ));
  53. IEnumerator AfterTrashedCards(Permanent permanent, List<CardSource> cards)
  54. {
  55. if (cards.Count == 1)
  56. cardsTrashed = true;
  57. selectedPermanent = permanent;
  58. yield return null;
  59. }
  60. if (cardsTrashed)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCollision(selectedPermanent, EffectDuration.UntilOpponentTurnEnd, activateClass));
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(selectedPermanent, EffectDuration.UntilOpponentTurnEnd, activateClass));
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(selectedPermanent, EffectDuration.UntilOpponentTurnEnd, activateClass));
  65. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(selectedPermanent, 3000, EffectDuration.UntilOpponentTurnEnd, activateClass));
  66. bool CardEffectCondition(ICardEffect cardEffect)
  67. {
  68. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  69. }
  70. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHand(
  71. targetPermanent: selectedPermanent,
  72. cardEffectCondition: CardEffectCondition,
  73. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  74. activateClass: activateClass,
  75. effectName: "Can't return to hand by opponent's effects"));
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeck(
  77. targetPermanent: selectedPermanent,
  78. cardEffectCondition: CardEffectCondition,
  79. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  80. activateClass: activateClass,
  81. effectName: "Can't return to deck by opponent's effects"));
  82. }
  83. }
  84. }
  85. #endregion
  86. #region Security Effect
  87. if (timing == EffectTiming.SecuritySkill)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect($"Delete 1 Digimon", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  92. activateClass.SetIsSecurityEffect(true);
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[Security] Delete 1 of your opponent's Digimon with the lowest play cost.";
  97. }
  98. bool CanSelectPermanentCondition(Permanent permanent)
  99. {
  100. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  101. {
  102. if (CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true))
  103. {
  104. return true;
  105. }
  106. }
  107. return false;
  108. }
  109. bool CanUseCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  116. {
  117. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectPermanentCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: null,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Destroy,
  130. cardEffect: activateClass);
  131. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  132. }
  133. }
  134. }
  135. #endregion
  136. return cardEffects;
  137. }
  138. }
  139. }