BT6_088.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT6_088 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnMove)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1 and Draw 1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] When one of your Digimon with [Gabumon] or [Garurumon] in its name moves from the breeding area to the battle area, gain 1 memory and trigger <Draw 1>. (Draw 1 card from your deck.)";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.TopCard.ContainsCardName("Gabumon"))
  28. {
  29. return true;
  30. }
  31. if (permanent.TopCard.HasGarurumonName)
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (CardEffectCommons.IsOwnerTurn(card))
  43. {
  44. if (CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (card.Owner.CanAddMemory(activateClass))
  57. {
  58. return true;
  59. }
  60. if (card.Owner.LibraryCards.Count >= 1)
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  70. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  71. }
  72. }
  73. if (timing == EffectTiming.OnDeclaration)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Digivolve your [Gabumon] into [Gabumon - Bond of Friendship]", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDiscription());
  78. activateClass.SetHashString("Digivolution_BT6_087");
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[Main][Once Per Turn] Digivolve your [Gabumon] into 1 [Gabumon - Bond of Friendship] in your hand for its digivolution cost, ignoring its level. If you do, trash the top 2 cards of your security stack. Then, if you have 1 or more security cards, delete that Digimon at the end of the turn.";
  83. }
  84. bool CanSelectPermanentCondition(Permanent permanent)
  85. {
  86. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  87. {
  88. if (permanent.TopCard.CardNames.Contains("Gabumon"))
  89. {
  90. foreach (CardSource cardSource in card.Owner.HandCards)
  91. {
  92. if (CanSelectCardCondition(cardSource))
  93. {
  94. if (!cardSource.CanNotEvolve(permanent))
  95. {
  96. if (card.Owner.MaxMemoryCost >= cardSource.PayingCost(SelectCardEffect.Root.Hand, new List<Permanent>() { permanent }, checkAvailability: true, ignoreLevel: true))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. }
  103. }
  104. }
  105. return false;
  106. }
  107. bool CanSelectCardCondition(CardSource cardSource)
  108. {
  109. return cardSource.EqualsCardName("Gabumon - Bond of Friendship");
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleArea(card))
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  123. {
  124. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  125. {
  126. Permanent selectedPermanent = null;
  127. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  128. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  129. selectPermanentEffect.SetUp(
  130. selectPlayer: card.Owner,
  131. canTargetCondition: CanSelectPermanentCondition,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. maxCount: maxCount,
  135. canNoSelect: true,
  136. canEndNotMax: false,
  137. selectPermanentCoroutine: SelectPermanentCoroutine,
  138. afterSelectPermanentCoroutine: null,
  139. mode: SelectPermanentEffect.Mode.Custom,
  140. cardEffect: activateClass);
  141. selectPermanentEffect.SetUpCustomMessage("Select 1 [Gabumon] that will digivolve.", "The opponent is selecting 1 [Gabumon] that will digivolve.");
  142. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  143. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  144. {
  145. selectedPermanent = permanent;
  146. yield return null;
  147. }
  148. if (selectedPermanent != null)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  151. targetPermanent: selectedPermanent,
  152. cardCondition: CanSelectCardCondition,
  153. payCost: true,
  154. reduceCostTuple: null,
  155. fixedCostTuple: null,
  156. ignoreDigivolutionRequirementFixedCost: -1,
  157. isHand: true,
  158. activateClass: activateClass,
  159. successProcess: SuccessProcess(),
  160. ignoreRequirements: CardEffectCommons.IgnoreRequirement.Level));
  161. IEnumerator SuccessProcess()
  162. {
  163. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  164. player: card.Owner,
  165. destroySecurityCount: 2,
  166. cardEffect: activateClass,
  167. fromTop: true).DestroySecurity());
  168. if (card.Owner.SecurityCards.Count >= 1)
  169. {
  170. ActivateClass activateClass1 = new ActivateClass();
  171. activateClass1.SetUpICardEffect("Delete the Digimon", CanUseCondition1, card);
  172. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
  173. activateClass1.SetEffectSourcePermanent(card.PermanentOfThisCard());
  174. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnEndTurn);
  175. bool CanUseCondition1(Hashtable hashtable)
  176. {
  177. return true;
  178. }
  179. bool CanActivateCondition1(Hashtable hashtable)
  180. {
  181. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  182. {
  183. if (selectedPermanent.CanBeDestroyedBySkill(activateClass1))
  184. {
  185. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass1))
  186. {
  187. return true;
  188. }
  189. }
  190. }
  191. return false;
  192. }
  193. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  194. {
  195. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { selectedPermanent }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  196. }
  197. }
  198. }
  199. }
  200. }
  201. }
  202. }
  203. if (timing == EffectTiming.SecuritySkill)
  204. {
  205. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  206. }
  207. return cardEffects;
  208. }
  209. }