BT16_064.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_064 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution - [DoruGreymon] in name or Lv.5 w/[SoC] trait: Cost 3
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.ContainsCardName("DoruGreymon"))
  17. {
  18. return true;
  19. }
  20. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5)
  21. {
  22. if (targetPermanent.TopCard.HasSocTraits)
  23. {
  24. return true;
  25. }
  26. }
  27. return false;
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  30. permanentCondition: PermanentCondition,
  31. digivolutionCost: 3,
  32. ignoreDigivolutionRequirement: false,
  33. card: card,
  34. condition: null));
  35. }
  36. #endregion
  37. #region Collision
  38. if (timing == EffectTiming.OnCounterTiming)
  39. {
  40. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(false, card, null));
  41. }
  42. #endregion
  43. #region When Digivolving
  44. if (timing == EffectTiming.OnEnterFieldAnyone)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("Delete Unsuspended Digimon or Tamer", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[When Digivolving] If this Digimon has a Tamer card with the [SoC] trait in its digivolution cards, delete 1 of your opponent's unsuspended Digimon or Tamers.";
  53. }
  54. bool HasTamerWithTrait(CardSource cardSource)
  55. {
  56. return cardSource.HasSocTraits && cardSource.IsTamer;
  57. }
  58. bool CanSelectPermanentCondition(Permanent permanent)
  59. {
  60. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  61. {
  62. if (permanent.IsDigimon || permanent.IsTamer)
  63. {
  64. if (!permanent.IsSuspended)
  65. {
  66. return true;
  67. }
  68. }
  69. }
  70. return false;
  71. }
  72. bool CanUseCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable hashtable)
  81. {
  82. if (card.PermanentOfThisCard().DigivolutionCards.Count(HasTamerWithTrait) >= 1)
  83. {
  84. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  85. {
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectPermanentCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: 1,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: null,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Destroy,
  98. cardEffect: activateClass);
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. }
  101. }
  102. yield return null;
  103. }
  104. }
  105. #endregion
  106. #region All Turns - Unsuspend
  107. if (timing == EffectTiming.OnDestroyedAnyone)
  108. {
  109. ActivateClass activateClass = new ActivateClass();
  110. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  111. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  112. activateClass.SetHashString("BT16_064_Unsuspend");
  113. cardEffects.Add(activateClass);
  114. string EffectDiscription()
  115. {
  116. return "[All Turns] (Once Per Turn) When another Digimon is deleted, you may unsuspend this Digimon.";
  117. }
  118. bool PermanentCondition(Permanent permanent)
  119. {
  120. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  121. {
  122. if (permanent.IsDigimon)
  123. {
  124. if (permanent != card.PermanentOfThisCard())
  125. {
  126. return true;
  127. }
  128. }
  129. }
  130. return false;
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.IsExistOnBattleArea(card))
  135. {
  136. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. bool CanActivateCondition(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.IsExistOnBattleArea(card))
  146. {
  147. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  148. {
  149. List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
  150. if (hashtables != null)
  151. {
  152. if (hashtables.Count >= 1)
  153. {
  154. return true;
  155. }
  156. }
  157. }
  158. }
  159. return false;
  160. }
  161. IEnumerator ActivateCoroutine(Hashtable hashtable)
  162. {
  163. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  164. }
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }