EX3_015.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX3
  6. {
  7. public class EX3_015 : 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.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Your 1 Digimon gets Jamming and a digivolution card", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] 1 of your blue Digimon gains <Jamming> for the turn. (This Digimon can't be deleted in battles against Security Digimon.) When played from digivolution cards, you may place 1 blue level 5 or lower Digimon card from your hand under that Digimon as its bottom digivolution card.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. if (cardSource.HasCardColor(CardColor.Blue))
  36. {
  37. if (cardSource.Level <= 5)
  38. {
  39. if (cardSource.HasLevel)
  40. {
  41. if (cardSource.IsDigimon)
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  68. {
  69. Permanent selectedPermanent = null;
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Jamming.", "The opponent is selecting 1 Digimon that will gain Jamming.");
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  87. {
  88. selectedPermanent = permanent;
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainJamming(
  90. targetPermanent: permanent,
  91. effectDuration: EffectDuration.UntilEachTurnEnd,
  92. activateClass: activateClass));
  93. }
  94. if (CardEffectCommons.CanTriggerOnPlay(_hashtable, card, root => root == SelectCardEffect.Root.DigivolutionCards))
  95. {
  96. if (CardEffectCommons.IsFromDigimonDigivolutionCards(_hashtable))
  97. {
  98. if (selectedPermanent != null)
  99. {
  100. if (!selectedPermanent.IsToken)
  101. {
  102. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  103. {
  104. List<CardSource> selectedCards = new List<CardSource>();
  105. maxCount = 1;
  106. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  107. selectHandEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: CanSelectCardCondition,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: maxCount,
  113. canNoSelect: true,
  114. canEndNotMax: false,
  115. isShowOpponent: true,
  116. selectCardCoroutine: SelectCardCoroutine,
  117. afterSelectCardCoroutine: null,
  118. mode: SelectHandEffect.Mode.Custom,
  119. cardEffect: activateClass);
  120. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  121. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  122. yield return StartCoroutine(selectHandEffect.Activate());
  123. IEnumerator SelectCardCoroutine(CardSource cardSource)
  124. {
  125. selectedCards.Add(cardSource);
  126. yield return null;
  127. }
  128. if (selectedCards.Count >= 1)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards,
  131. activateClass));
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. return cardEffects;
  142. }
  143. }
  144. }