EX3_036.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX3
  5. {
  6. public class EX3_036 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Opponent's Digimon reduce Security Attack", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] All of your opponent's Digimon gain <Security Attack -1> until the end of your opponent's turn. (This Digimon checks 1 fewer security cards.) If this card was played by [Trial of the Four Great Dragons]'s effect, all of your opponent's Digimon gain <Security Attack -2> until the end of your opponent's turn instead.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.IsExistOnBattleArea(card))
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  34. {
  35. int minusPoint = 1;
  36. bool CardEffectCondition(ICardEffect cardEffect)
  37. {
  38. if (cardEffect != null)
  39. {
  40. if (cardEffect.EffectSourceCard != null)
  41. {
  42. if (cardEffect.EffectSourceCard.CardNames.Contains("Trial of the Four Great Dragons")
  43. || cardEffect.EffectSourceCard.CardNames.Contains("TrialoftheFourGreatDragons"))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. if (CardEffectCommons.IsByEffect(_hashtable, CardEffectCondition))
  52. {
  53. minusPoint = 2;
  54. }
  55. bool PermanentCondition(Permanent permanent)
  56. {
  57. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  58. {
  59. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttackPlayerEffect(
  67. permanentCondition: PermanentCondition,
  68. changeValue: -minusPoint,
  69. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  70. activateClass: activateClass));
  71. }
  72. }
  73. if (timing == EffectTiming.OnDestroyedAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Place 1 [Trial of the Four Great Dragons] in battle area", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. {
  81. return "[On Deletion] If you don't have a [Trial of the Four Great Dragons] in play, you may place 1 [Trial of the Four Great Dragons] from your hand in your battle area.";
  82. }
  83. bool CanSelectCardCondition(CardSource cardSource)
  84. {
  85. if (cardSource.CardNames.Contains("Trial of the Four Great Dragons") || cardSource.CardNames.Contains("TrialoftheFourGreatDragons"))
  86. {
  87. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, isPlayOption: true))
  88. {
  89. return true;
  90. }
  91. }
  92. return false;
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  97. }
  98. bool CanActivateCondition(Hashtable hashtable)
  99. {
  100. if (CardEffectCommons.IsExistOnTrash(card))
  101. {
  102. if (card.Owner.HandCards.Count >= 1)
  103. {
  104. if (card.Owner.GetBattleAreaPermanents().Count((permanent) =>
  105. permanent.TopCard.CardNames.Contains("Trial of the Four Great Dragons")
  106. || permanent.TopCard.CardNames.Contains("TrialoftheFourGreatDragons")) == 0)
  107. {
  108. return true;
  109. }
  110. }
  111. }
  112. return false;
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  117. {
  118. List<CardSource> selectedCards = new List<CardSource>();
  119. int maxCount = 1;
  120. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  121. selectHandEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectCardCondition,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: maxCount,
  127. canNoSelect: true,
  128. canEndNotMax: false,
  129. isShowOpponent: true,
  130. selectCardCoroutine: SelectCardCoroutine,
  131. afterSelectCardCoroutine: null,
  132. mode: SelectHandEffect.Mode.Custom,
  133. cardEffect: activateClass);
  134. selectHandEffect.SetUpCustomMessage("Select 1 card to place in battle area.", "The opponent is selecting 1 card to place in battle area.");
  135. yield return StartCoroutine(selectHandEffect.Activate());
  136. IEnumerator SelectCardCoroutine(CardSource cardSource)
  137. {
  138. selectedCards.Add(cardSource);
  139. yield return null;
  140. }
  141. if (selectedCards.Count >= 1)
  142. {
  143. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(
  144. card: selectedCards[0],
  145. cardEffect: activateClass,
  146. root: SelectCardEffect.Root.Hand));
  147. }
  148. }
  149. }
  150. }
  151. return cardEffects;
  152. }
  153. }
  154. }