EX7_023.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_023 : 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. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  15. cardEffects.Add(CardEffectFactory.IcecladSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  16. }
  17. #region When Digivolving
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Trash 4 then return Tamer to bottom of deck", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[When Digivolving] Trash any 4 digivolution cards of your opponent's Digimon. Then, if your opponent has no Digimon with digivolution cards, return 1 of your opponent's Tamers to the bottom of the deck.";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  31. {
  32. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  33. }
  34. return false;
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  43. }
  44. bool CanSelectCardCondition(CardSource cardSource)
  45. {
  46. return true;
  47. }
  48. bool CanSelectTamerCondition(Permanent permanent)
  49. {
  50. if(!CardEffectCommons.IsOwnerPermanent(permanent, card))
  51. return permanent.IsTamer;
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  59. permanentCondition: CanSelectPermanentCondition,
  60. cardCondition: CanSelectCardCondition,
  61. maxCount: 4,
  62. canNoTrash: false,
  63. isFromOnly1Permanent: false,
  64. activateClass: activateClass
  65. ));
  66. }
  67. if (!CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && !permanent.HasNoDigivolutionCards))
  68. {
  69. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerCondition))
  70. {
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTamerCondition));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectTamerCondition,
  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.PutLibraryBottom,
  84. cardEffect: activateClass);
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. }
  87. }
  88. }
  89. }
  90. #endregion
  91. #region Opponent's Turn Effect
  92. if (timing == EffectTiming.None)
  93. {
  94. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  95. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition, card);
  96. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: CantSuspendCondition);
  97. cardEffects.Add(canNotSuspendClass);
  98. bool CantSuspendCondition(Permanent permanent)
  99. {
  100. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  101. {
  102. if (permanent.IsDigimon)
  103. {
  104. if(permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count)
  105. {
  106. if (!permanent.TopCard.CanNotBeAffected(canNotSuspendClass))
  107. return true;
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  116. {
  117. return CardEffectCommons.IsOpponentTurn(card);
  118. }
  119. return false;
  120. }
  121. }
  122. #endregion
  123. return cardEffects;
  124. }
  125. }
  126. }