EX5_016.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX5
  6. {
  7. public class EX5_016 : 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. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 2)
  17. {
  18. if (targetPermanent.TopCard.CardTraits.Contains("Light Fang"))
  19. {
  20. return true;
  21. }
  22. if (targetPermanent.TopCard.CardTraits.Contains("LightFung"))
  23. {
  24. return true;
  25. }
  26. if (targetPermanent.TopCard.CardTraits.Contains("Night Claw"))
  27. {
  28. return true;
  29. }
  30. if (targetPermanent.TopCard.CardTraits.Contains("NightClaw"))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  38. }
  39. if (timing == EffectTiming.OnStartMainPhase)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Return your 1 Digimon to hand to gain Memory +2", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  44. cardEffects.Add(activateClass);
  45. string EffectDiscription()
  46. {
  47. return "[Start of Your Main Phase] By returning 1 of your Digimon to the hand, gain 2 memory.";
  48. }
  49. bool CanSelectPermanentCondition(Permanent permanent)
  50. {
  51. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. if (CardEffectCommons.IsOwnerTurn(card))
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  78. {
  79. Permanent bounceTargetPermanent = null;
  80. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectPermanentCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: maxCount,
  88. canNoSelect: true,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectPermanentCoroutine,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select 1 your Digimon to return to hand.", "The opponent is selecting 1 your Digimon to return to hand.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. bounceTargetPermanent = permanent;
  99. yield return null;
  100. }
  101. if (bounceTargetPermanent != null)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  104. targetPermanents: new List<Permanent>() { bounceTargetPermanent },
  105. activateClass: activateClass,
  106. successProcess: SuccessProcess(),
  107. failureProcess: null));
  108. IEnumerator SuccessProcess()
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  111. }
  112. }
  113. }
  114. }
  115. }
  116. if (timing == EffectTiming.OnDeclaration)
  117. {
  118. ActivateClass activateClass = new ActivateClass();
  119. activateClass.SetUpICardEffect("Place the top card of this Digimon at the bottom of digivolution cards to gain Memory +2 (Lunamon)", CanUseCondition, card);
  120. activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDiscription());
  121. activateClass.SetIsInheritedEffect(true);
  122. activateClass.SetHashString("ReturnDigivolutionCards_EX50_016");
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[Main] [Once Per Turn] By placing the top card of this Digimon with the [Night Claw] or [Light Fang] trait as this Digimon's bottom digivolution card, gain 2 memory.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleArea(card))
  131. {
  132. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  133. {
  134. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Light Fang"))
  135. {
  136. return true;
  137. }
  138. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("LightFung"))
  139. {
  140. return true;
  141. }
  142. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Night Claw"))
  143. {
  144. return true;
  145. }
  146. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("NightClaw"))
  147. {
  148. return true;
  149. }
  150. }
  151. }
  152. return false;
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  155. {
  156. if (CardEffectCommons.IsExistOnBattleArea(card))
  157. {
  158. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  159. {
  160. CardSource topCard = card.PermanentOfThisCard().TopCard;
  161. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  162. new List<CardSource>() { topCard },
  163. activateClass));
  164. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  165. }
  166. }
  167. }
  168. }
  169. return cardEffects;
  170. }
  171. }
  172. }