EX8_015.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class EX8_015 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("WarGrowlmon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 1,
  22. ignoreDigivolutionRequirement: false,
  23. card: card, condition: null)
  24. );
  25. }
  26. #endregion
  27. #region When Digivolving
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Can't be returned to the hand or deck, +3000 DP, and delete 1 Digimon with 10000 DP or less.", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  33. cardEffects.Add(activateClass);
  34. string EffectDiscription()
  35. {
  36. return "[When Digivolving] Until the end of your opponent's turn, this Digimon can't be returned to the hand or deck and it gets +3000 DP. Then, if [WarGrowlmon]/[X Antibody] is in this Digimon's digivolution cards, delete 1 of your opponent's Digimon with 10000 DP or less.";
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  41. {
  42. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanSelectPermanentCondition(Permanent permanent)
  50. {
  51. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  52. {
  53. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(10000, activateClass))
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanActivateEffect(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => (cardSource.EqualsCardName("WarGrowlmon") || cardSource.EqualsCardName("X Antibody"))) >= 1)
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. bool CanActivateCondition(Hashtable hashtable)
  72. {
  73. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  74. {
  75. return true;
  76. }
  77. return false;
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable hashtable)
  80. {
  81. bool CardEffectCondition(ICardEffect cardEffect)
  82. {
  83. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  84. }
  85. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHand(
  86. targetPermanent: card.PermanentOfThisCard(),
  87. cardEffectCondition: CardEffectCondition,
  88. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  89. activateClass: activateClass,
  90. effectName: "Can't return to hand by opponent's effects"));
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeck(
  92. targetPermanent: card.PermanentOfThisCard(),
  93. cardEffectCondition: CardEffectCondition,
  94. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  95. activateClass: activateClass,
  96. effectName: "Can't return to deck by opponent's effects"));
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  98. targetPermanent: card.PermanentOfThisCard(),
  99. changeValue: 3000,
  100. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  101. activateClass: activateClass));
  102. if (CanActivateEffect(hashtable))
  103. {
  104. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectPermanentCondition,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. maxCount: maxCount,
  112. canNoSelect: false,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: null,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Destroy,
  117. cardEffect: activateClass);
  118. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  119. }
  120. }
  121. }
  122. #endregion
  123. #region Inherit
  124. if (timing == EffectTiming.None)
  125. {
  126. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: null));
  127. }
  128. #endregion
  129. return cardEffects;
  130. }
  131. }
  132. }