BT13_010.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_010 : 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.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Return 1 [Kristy Damon] to hand and this Digimon digivolves to [Garudamon]", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] If played by an effect, by returning 1 of your [Kristy Damon]s to the hand, this Digimon may digivolve into [Garudamon] in the hand, ignoring its digivolution requirements and without paying the cost.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  25. {
  26. if (permanent.TopCard.CardNames.Contains("Kristy Damon"))
  27. {
  28. return true;
  29. }
  30. if (permanent.TopCard.CardNames.Contains("KristyDamon"))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectCardCondition(CardSource cardSource)
  38. {
  39. return cardSource.CardNames.Contains("Garudamon");
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card) && CardEffectCommons.IsByEffect(hashtable, null);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  50. {
  51. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  52. {
  53. return true;
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (CardEffectCommons.IsExistOnBattleArea(card))
  62. {
  63. Permanent thisCardPermanent = card.PermanentOfThisCard();
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. Permanent bounceTargetPermanent = null;
  67. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  68. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  69. selectPermanentEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: CanSelectPermanentCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: maxCount,
  75. canNoSelect: true,
  76. canEndNotMax: false,
  77. selectPermanentCoroutine: SelectPermanentCoroutine,
  78. afterSelectPermanentCoroutine: null,
  79. mode: SelectPermanentEffect.Mode.Custom,
  80. cardEffect: activateClass);
  81. selectPermanentEffect.SetUpCustomMessage("Select 1 [Kristy Damon] to return to hand.", "The opponent is selecting 1 [Kristy Damon] to return to hand.");
  82. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  83. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  84. {
  85. bounceTargetPermanent = permanent;
  86. yield return null;
  87. }
  88. if (bounceTargetPermanent != null)
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  91. targetPermanents: new List<Permanent>() { bounceTargetPermanent },
  92. activateClass: activateClass,
  93. successProcess: SuccessProcess(),
  94. failureProcess: null));
  95. IEnumerator SuccessProcess()
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  98. targetPermanent: thisCardPermanent,
  99. cardCondition: CanSelectCardCondition,
  100. payCost: false,
  101. reduceCostTuple: null,
  102. fixedCostTuple: null,
  103. ignoreDigivolutionRequirementFixedCost: 0,
  104. isHand: true,
  105. activateClass: activateClass,
  106. successProcess: null));
  107. }
  108. }
  109. }
  110. }
  111. }
  112. }
  113. if (timing == EffectTiming.OnDestroyedAnyone)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  118. activateClass.SetIsInheritedEffect(true);
  119. cardEffects.Add(activateClass);
  120. string EffectDiscription()
  121. {
  122. return "[On Deletion] <Draw 1> (Draw 1 card from your deck.)";
  123. }
  124. bool CanUseCondition(Hashtable hashtable)
  125. {
  126. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  131. {
  132. if (card.Owner.LibraryCards.Count >= 1)
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  140. {
  141. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  142. }
  143. }
  144. return cardEffects;
  145. }
  146. }
  147. }