BT12_025.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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_025 : 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("Lanamon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, 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: 3, ignoreDigivolutionRequirement: false, card: card, condition: Condition));
  31. }
  32. if (timing == EffectTiming.OnAllyAttack)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("Play 1 digivolution card", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[When Attacking] You may play 1 blue level 3 Digimon card from one of your blue Digimon's digivolution cards without paying its cost. ";
  41. }
  42. bool CanSelectPermanentCondition(Permanent permanent)
  43. {
  44. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  45. {
  46. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  47. {
  48. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  49. {
  50. return true;
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanSelectCardCondition(CardSource cardSource)
  57. {
  58. if (cardSource != null)
  59. {
  60. if (cardSource.IsDigimon)
  61. {
  62. if (cardSource.Owner == card.Owner)
  63. {
  64. if (cardSource.HasCardColor(CardColor.Blue))
  65. {
  66. if (cardSource.Level == 3)
  67. {
  68. if (cardSource.HasLevel)
  69. {
  70. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  71. {
  72. return true;
  73. }
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. return false;
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.IsExistOnBattleArea(card))
  89. {
  90. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  91. {
  92. return true;
  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. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  104. {
  105. Permanent selectedPermanent = null;
  106. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  107. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  108. selectPermanentEffect.SetUp(
  109. selectPlayer: card.Owner,
  110. canTargetCondition: CanSelectPermanentCondition,
  111. canTargetCondition_ByPreSelecetedList: null,
  112. canEndSelectCondition: null,
  113. maxCount: maxCount,
  114. canNoSelect: true,
  115. canEndNotMax: false,
  116. selectPermanentCoroutine: SelectPermanentCoroutine,
  117. afterSelectPermanentCoroutine: null,
  118. mode: SelectPermanentEffect.Mode.Custom,
  119. cardEffect: activateClass);
  120. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon which has digivolution cards.", "The opponent is selecting 1 Digimon which has digivolution cards.");
  121. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  122. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  123. {
  124. selectedPermanent = permanent;
  125. yield return null;
  126. }
  127. if (selectedPermanent != null)
  128. {
  129. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  130. {
  131. maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  132. List<CardSource> selectedCards = new List<CardSource>();
  133. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  134. selectCardEffect.SetUp(
  135. canTargetCondition: CanSelectCardCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. canNoSelect: () => true,
  139. selectCardCoroutine: SelectCardCoroutine,
  140. afterSelectCardCoroutine: null,
  141. message: "Select 1 digivolution card to play.",
  142. maxCount: maxCount,
  143. canEndNotMax: false,
  144. isShowOpponent: true,
  145. mode: SelectCardEffect.Mode.Custom,
  146. root: SelectCardEffect.Root.Custom,
  147. customRootCardList: selectedPermanent.DigivolutionCards,
  148. canLookReverseCard: true,
  149. selectPlayer: card.Owner,
  150. cardEffect: activateClass);
  151. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  152. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  153. yield return StartCoroutine(selectCardEffect.Activate());
  154. IEnumerator SelectCardCoroutine(CardSource cardSource)
  155. {
  156. selectedCards.Add(cardSource);
  157. yield return null;
  158. }
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  160. cardSources: selectedCards,
  161. activateClass: activateClass,
  162. payCost: false,
  163. isTapped: false,
  164. root: SelectCardEffect.Root.DigivolutionCards,
  165. activateETB: true));
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. }
  173. return cardEffects;
  174. }
  175. }
  176. }