BT12_092.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_092 : 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.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("This Tamer becomes Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Start of Your Main Phase] If you have a Digimon with [Agumon] or [Greymon] in its name in play, by paying 1 memory, for the turn, treat this Tamer as a 3000 DP Digimon that can't digivolve.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. if (CardEffectCommons.IsExistOnBattleArea(card))
  24. {
  25. if (CardEffectCommons.IsOwnerTurn(card))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Agumon") || permanent.TopCard.HasGreymonName))
  37. {
  38. if (card.Owner.MaxMemoryCost >= 1)
  39. {
  40. return true;
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  47. {
  48. if (card.Owner.MaxMemoryCost >= 1)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(-1, activateClass));
  51. Permanent selectedPermanent = card.PermanentOfThisCard();
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BecomeDigimonThatCantDigivolve(
  53. targetPermanent: selectedPermanent,
  54. DP: 3000,
  55. effectDuration: EffectDuration.UntilEachTurnEnd,
  56. activateClass: activateClass));
  57. }
  58. }
  59. }
  60. if (timing == EffectTiming.OnTappedAnyone)
  61. {
  62. ActivateClass activateClass = new ActivateClass();
  63. activateClass.SetUpICardEffect("Digivolve your 1 Digimon into 1 yellow card with [Greymon] in its name", CanUseCondition, card);
  64. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  65. cardEffects.Add(activateClass);
  66. string EffectDiscription()
  67. {
  68. return "[Your Turn] If this Tamer becomes suspended, you may digivolve 1 of your Digimon into a yellow card with [Greymon] in its name in your hand without paying its cost.";
  69. }
  70. bool CanSelectPermanentCondition(Permanent permanent)
  71. {
  72. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  73. {
  74. foreach (CardSource cardSource in card.Owner.HandCards)
  75. {
  76. if (CanSelectCardCondition(cardSource))
  77. {
  78. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  79. {
  80. return true;
  81. }
  82. }
  83. }
  84. }
  85. return false;
  86. }
  87. bool CanSelectCardCondition(CardSource cardSource)
  88. {
  89. return cardSource.HasGreymonName && cardSource.HasCardColor(CardColor.Yellow);
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. if (CardEffectCommons.IsExistOnBattleArea(card))
  94. {
  95. if (CardEffectCommons.IsOwnerTurn(card))
  96. {
  97. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  98. {
  99. return true;
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  117. {
  118. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  119. {
  120. Permanent selectedPermanent = null;
  121. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  122. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  123. selectPermanentEffect.SetUp(
  124. selectPlayer: card.Owner,
  125. canTargetCondition: CanSelectPermanentCondition,
  126. canTargetCondition_ByPreSelecetedList: null,
  127. canEndSelectCondition: null,
  128. maxCount: maxCount,
  129. canNoSelect: true,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: SelectPermanentCoroutine,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.Custom,
  134. cardEffect: activateClass);
  135. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  138. {
  139. selectedPermanent = permanent;
  140. yield return null;
  141. }
  142. if (selectedPermanent != null)
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  145. targetPermanent: selectedPermanent,
  146. cardCondition: CanSelectCardCondition,
  147. payCost: false,
  148. reduceCostTuple: null,
  149. fixedCostTuple: null,
  150. ignoreDigivolutionRequirementFixedCost: -1,
  151. isHand: true,
  152. activateClass: activateClass,
  153. successProcess: null));
  154. }
  155. }
  156. }
  157. }
  158. if (timing == EffectTiming.SecuritySkill)
  159. {
  160. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  161. }
  162. return cardEffects;
  163. }
  164. }
  165. }