Angemon_BT16_019.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.BT16
  6. {
  7. public class Angemon_BT16_019 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. var cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement, Blocker
  13. if(timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Patamon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  27. }
  28. #endregion
  29. #region On Play/When Digivolving
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Unsuspend 1 level 4 or lower Digimon", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] [When Digivolving] Unsuspend 1 of your level 4 or lower Digimon.";
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  43. {
  44. if (permanent.Level <= 4)
  45. {
  46. if (permanent.TopCard.HasLevel)
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOnPlay(hashtable, card) || CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: null,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.UnTap,
  84. cardEffect: activateClass);
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. }
  87. }
  88. #endregion
  89. #region Inherited Effect
  90. if (timing == EffectTiming.OnAllyAttack)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Trash 1 digivolution card", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  95. EffectDiscription());
  96. activateClass.SetIsInheritedEffect(true);
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. {
  100. return "[When Attacking] Trash the top digivolution card of 1 of your opponent's Digimon.";
  101. }
  102. bool CanSelectPermanentCondition(Permanent permanent)
  103. {
  104. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  105. && permanent.DigivolutionCards.Count(cardSource =>
  106. !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1;
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  111. }
  112. bool CanActivateCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.IsExistOnBattleArea(card) &&
  115. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable hashtable)
  118. {
  119. var maxCount = Math.Min(1,
  120. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  121. var selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  122. selectPermanentEffect.SetUp(
  123. selectPlayer: card.Owner,
  124. canTargetCondition: CanSelectPermanentCondition,
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. maxCount: maxCount,
  128. canNoSelect: false,
  129. canEndNotMax: false,
  130. selectPermanentCoroutine: SelectPermanentCoroutine,
  131. afterSelectPermanentCoroutine: null,
  132. mode: SelectPermanentEffect.Mode.Custom,
  133. cardEffect: activateClass);
  134. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.",
  135. "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. yield break;
  138. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  139. {
  140. yield return ContinuousController.instance.StartCoroutine(
  141. CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanent,
  142. trashCount: 1, isFromTop: true, activateClass: activateClass));
  143. }
  144. }
  145. }
  146. #endregion
  147. return cardEffects;
  148. }
  149. }
  150. }