BT20_088.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_088 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Turn
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. if (CardEffectCommons.IsExistOnBattleArea(card))
  25. {
  26. if (CardEffectCommons.IsOwnerTurn(card))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  38. {
  39. if (card.Owner.CanAddMemory(activateClass))
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  50. }
  51. }
  52. #endregion
  53. #region Your Turn
  54. if (timing == EffectTiming.OnDestroyedAnyone)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("Your Digimon digivolves", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  59. cardEffects.Add(activateClass);
  60. string EffectDescription()
  61. {
  62. return
  63. "[Your Turn] When any of your [Ghost] trait Digimon are deleted, by suspending this Tamer, 1 of your Digimon may digivolve into a Digimon card with the [Ghost] trait in the hand with the digivolution cost reduced by 2.";
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.IsExistOnBattleArea(card) &&
  68. CardEffectCommons.IsOwnerTurn(card) &&
  69. CardEffectCommons.CanActivateSuspendCostEffect(card);
  70. }
  71. bool PermanentCondition(Permanent permanent)
  72. {
  73. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  74. {
  75. if (permanent.TopCard.EqualsTraits("Ghost"))
  76. {
  77. return true;
  78. }
  79. }
  80. return false;
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleArea(card))
  85. {
  86. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  87. {
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanSelectPermanentCondition(Permanent permanent)
  94. {
  95. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  96. {
  97. foreach (CardSource cardSource in card.Owner.HandCards)
  98. {
  99. if (CanSelectCardCondition(cardSource))
  100. {
  101. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. }
  108. return false;
  109. }
  110. bool CanSelectCardCondition(CardSource cardSource)
  111. {
  112. return cardSource.IsDigimon && cardSource.EqualsTraits("Ghost");
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable hashtable)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  117. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  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.",
  136. "The opponent is selecting 1 Digimon that will digivolve.");
  137. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  138. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  139. {
  140. selectedPermanent = permanent;
  141. yield return null;
  142. }
  143. if (selectedPermanent != null)
  144. {
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  146. targetPermanent: selectedPermanent,
  147. cardCondition: CanSelectCardCondition,
  148. payCost: true,
  149. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  150. fixedCostTuple: null,
  151. ignoreDigivolutionRequirementFixedCost: -1,
  152. isHand: true,
  153. activateClass: activateClass,
  154. successProcess: null));
  155. }
  156. }
  157. }
  158. }
  159. #endregion
  160. #region Security Effect
  161. if (timing == EffectTiming.SecuritySkill)
  162. {
  163. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  164. }
  165. #endregion
  166. return cardEffects;
  167. }
  168. }
  169. }