EX8_035.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX8
  5. {
  6. public class EX8_035 : 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 Conditions
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5)
  17. return targetPermanent.TopCard.EqualsTraits("DS");
  18. return false;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Security Effect
  30. if (timing == EffectTiming.SecuritySkill)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("2 Opponent's Digimon gain Security Attack -1 and add this card to hand", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. activateClass.SetIsSecurityEffect(true);
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[Security] At the end of the battle, give 2 of your opponent's Digimon <Security A. -1> for the turn. Then, add this card to the hand.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnExecutingArea(card))
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. bool CanSelectPermanentCondition(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  58. {
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectPermanentCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: maxCount,
  69. canNoSelect: false,
  70. canEndNotMax: false,
  71. selectPermanentCoroutine: SelectPermanentCoroutine,
  72. afterSelectPermanentCoroutine: null,
  73. mode: SelectPermanentEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon that will get Security Attack -1.", "The opponent is selecting 2 Digimon that will get Security Attack -1.");
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  77. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  80. yield return null;
  81. }
  82. }
  83. if (card.Owner.ExecutingCards.Contains(card))
  84. {
  85. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  86. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { card }, false, activateClass));
  87. }
  88. }
  89. }
  90. #endregion
  91. #region All Turns
  92. if (timing == EffectTiming.None)
  93. {
  94. DisableEffectClass invalidationClass = new DisableEffectClass();
  95. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] effects of opponent's Digimon while memory is 1 or more", CanUseCondition, card);
  96. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  97. cardEffects.Add(invalidationClass);
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return true;
  101. }
  102. bool InvalidateCondition(ICardEffect cardEffect)
  103. {
  104. if (CardEffectCommons.IsExistOnBattleArea(card))
  105. {
  106. if (card.Owner.MemoryForPlayer >= 1)
  107. {
  108. if (cardEffect != null)
  109. {
  110. if (cardEffect is ActivateICardEffect)
  111. {
  112. if (cardEffect.EffectSourceCard != null)
  113. {
  114. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(cardEffect.EffectSourceCard.PermanentOfThisCard(), card))
  115. {
  116. if (!cardEffect.EffectSourceCard.PermanentOfThisCard().TopCard.CanNotBeAffected(invalidationClass))
  117. {
  118. if (cardEffect.IsWhenDigivolving)
  119. {
  120. return true;
  121. }
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129. return false;
  130. }
  131. }
  132. #endregion
  133. return cardEffects;
  134. }
  135. }
  136. }