EX7_021.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_021 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.None)
  11. {
  12. cardEffects.Add(CardEffectFactory.IcecladSelfStaticEffect(isInheritedEffect: false, card: card,
  13. condition: null));
  14. }
  15. #region When Digivolving
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Trash 2 then unsuspend", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[When Digivolving] Trash any 2 digivolution cards of your opponent's Digimon. Then, if your opponent has no Digimon with digivolution cards, unsuspend this Digimon.";
  25. }
  26. bool CanSelectOpponentsDigimon(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  37. {
  38. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  39. }
  40. return false;
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  45. }
  46. bool CheckOpponentDigivolutionSources()
  47. {
  48. return !CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && !permanent.HasNoDigivolutionCards);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  53. permanentCondition: CanSelectOpponentsDigimon,
  54. cardCondition: CanSelectCardCondition,
  55. maxCount: 2,
  56. canNoTrash: false,
  57. isFromOnly1Permanent: false,
  58. activateClass: activateClass
  59. ));
  60. //unsuspend
  61. if (CheckOpponentDigivolutionSources())
  62. {
  63. Permanent selectedPermanent = card.PermanentOfThisCard();
  64. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  65. }
  66. }
  67. }
  68. #endregion
  69. #region Inherited Effect
  70. if (timing == EffectTiming.None)
  71. {
  72. bool Condition()
  73. {
  74. if (CardEffectCommons.IsExistOnBattleArea(card))
  75. {
  76. if (CardEffectCommons.IsOwnerTurn(card))
  77. {
  78. if (!CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && !permanent.HasNoDigivolutionCards))
  79. {
  80. if(card.PermanentOfThisCard().TopCard.EqualsTraits("Ice-Snow"))
  81. return true;
  82. }
  83. }
  84. }
  85. return false;
  86. }
  87. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  88. }
  89. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  90. {
  91. bool Condition()
  92. {
  93. if (CardEffectCommons.IsExistOnBattleArea(card))
  94. {
  95. if (CardEffectCommons.IsOwnerTurn(card))
  96. {
  97. if (!CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && !permanent.HasNoDigivolutionCards))
  98. {
  99. if (card.PermanentOfThisCard().TopCard.EqualsTraits("Ice-Snow"))
  100. return true;
  101. }
  102. }
  103. }
  104. return false;
  105. }
  106. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: true, card: card, condition: Condition));
  107. }
  108. #endregion
  109. return cardEffects;
  110. }
  111. }
  112. }