BT12_024.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_024 : 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. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Calmaramon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.None)
  21. {
  22. bool Condition()
  23. {
  24. return card.Owner.HandCards.Contains(card);
  25. }
  26. bool PermanentCondition(Permanent targetPermanent)
  27. {
  28. return targetPermanent.TopCard.CardColors.Contains(CardColor.Blue) && targetPermanent.IsTamer;
  29. }
  30. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: Condition));
  31. }
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to gain Jamming", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[When Digivolving] By placing a blue level 3 Digimon card from your hand under 1 of your blue Digimon as its bottom digivolution card, this Digimon gains <Jamming> for the turn. (This Digimon can't be deleted in battles against Security Digimon.)";
  41. }
  42. bool CanSelectCardCondition(CardSource cardSource)
  43. {
  44. if (cardSource != null)
  45. {
  46. if (cardSource.IsDigimon)
  47. {
  48. if (cardSource.Owner == card.Owner)
  49. {
  50. if (cardSource.HasCardColor(CardColor.Blue))
  51. {
  52. if (cardSource.Level == 3)
  53. {
  54. if (cardSource.HasLevel)
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. }
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanSelectPermanentCondition(Permanent permanent)
  66. {
  67. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  68. {
  69. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  70. {
  71. if (!permanent.IsToken)
  72. {
  73. return true;
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  82. }
  83. bool CanActivateCondition(Hashtable hashtable)
  84. {
  85. if (CardEffectCommons.IsExistOnBattleArea(card))
  86. {
  87. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  88. {
  89. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  90. {
  91. return true;
  92. }
  93. }
  94. }
  95. return false;
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  98. {
  99. if (isExistOnField(card))
  100. {
  101. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  102. {
  103. bool added = false;
  104. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  105. {
  106. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  107. {
  108. CardSource selectedCard = null;
  109. int maxCount = 1;
  110. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  111. selectHandEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition: CanSelectCardCondition,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: maxCount,
  117. canNoSelect: true,
  118. canEndNotMax: false,
  119. isShowOpponent: true,
  120. selectCardCoroutine: SelectCardCoroutine,
  121. afterSelectCardCoroutine: null,
  122. mode: SelectHandEffect.Mode.Custom,
  123. cardEffect: activateClass);
  124. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  125. yield return StartCoroutine(selectHandEffect.Activate());
  126. IEnumerator SelectCardCoroutine(CardSource cardSource)
  127. {
  128. selectedCard = cardSource;
  129. yield return null;
  130. }
  131. if (selectedCard != null)
  132. {
  133. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  134. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: CanSelectPermanentCondition,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: maxCount,
  141. canNoSelect: true,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: SelectPermanentCoroutine,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. Permanent selectedPermanent = permanent;
  152. if (selectedPermanent != null)
  153. {
  154. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  155. added = true;
  156. }
  157. }
  158. }
  159. }
  160. }
  161. if (added)
  162. {
  163. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainJamming(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  164. }
  165. }
  166. }
  167. }
  168. }
  169. return cardEffects;
  170. }
  171. }
  172. }