EX11_059.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. //Reina Oumi
  8. public class EX11_059 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Shared Card Condition
  14. bool IsNSo(CardSource cardSource)
  15. {
  16. return cardSource.EqualsTraits("NSo");
  17. }
  18. #endregion
  19. #region Shared SOYMP / OP
  20. string SharedEffectName = "Trash 1 [NSo] card from hand to Draw 1 and gain Memory +1";
  21. string SharedEffectDescription(string tag)=> $"[{tag}] By trashing 1 [NSo] trait card from your hand, <Draw 1> and gain 1 memory.";
  22. bool SharedCanActivateCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsExistOnBattleArea(card)
  25. && card.Owner.HandCards.Count(IsNSo) >= 1;
  26. }
  27. IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  28. {
  29. bool discarded = false;
  30. int discardCount = 1;
  31. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  32. selectHandEffect.SetUp(
  33. selectPlayer: card.Owner,
  34. canTargetCondition: IsNSo,
  35. canTargetCondition_ByPreSelecetedList: null,
  36. canEndSelectCondition: null,
  37. maxCount: discardCount,
  38. canNoSelect: true,
  39. canEndNotMax: false,
  40. isShowOpponent: true,
  41. selectCardCoroutine: null,
  42. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  43. mode: SelectHandEffect.Mode.Discard,
  44. cardEffect: activateClass);
  45. yield return StartCoroutine(selectHandEffect.Activate());
  46. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  47. {
  48. if (cardSources.Count >= 1)
  49. {
  50. discarded = true;
  51. yield return null;
  52. }
  53. }
  54. if (discarded)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  57. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  58. }
  59. }
  60. #endregion
  61. #region Start of Your Main Phase
  62. if (timing == EffectTiming.OnStartMainPhase)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  66. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("Start of Your Turn"));
  67. cardEffects.Add(activateClass);
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.IsExistOnBattleArea(card)
  71. && CardEffectCommons.IsOwnerTurn(card);
  72. }
  73. }
  74. #endregion
  75. #region On Play
  76. if (timing == EffectTiming.OnEnterFieldAnyone)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  80. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  81. cardEffects.Add(activateClass);
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.IsExistOnBattleArea(card)
  85. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  86. }
  87. }
  88. #endregion
  89. #region All Turns
  90. if (timing == EffectTiming.OnDestroyedAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("DNA into [NSo] Digimon", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  95. cardEffects.Add(activateClass);
  96. string EffectDescription()
  97. {
  98. return "[All Turns] When any of your [NSo] trait Digimon are deleted, by suspending this Tamer, 1 of your [NSo] trait Digimon and 1 [NSo] trait Digimon card in the trash may DNA digivolve into a Digimon card with the [NSo] trait in the hand.";
  99. }
  100. bool IsNSoPermanent(Permanent permanent)
  101. {
  102. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  103. && IsNSo(permanent.TopCard);
  104. }
  105. bool IsNSoDigimonCard(CardSource source)
  106. {
  107. return source.IsDigimon
  108. && IsNSo(source);
  109. }
  110. bool HasNSoJogress(CardSource source)
  111. {
  112. return CardEffectCommons.CanJogressWithHandOrTrash(
  113. source: source,
  114. owner: card.Owner,
  115. isWithHandCard: false,
  116. isIntoHandCard: true,
  117. targetCardCondition: IsNSoDigimonCard,
  118. permanentCondition: IsNSoPermanent,
  119. digivolutionCardCondition: IsNSoDigimonCard
  120. );
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, IsNSoPermanent);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleArea(card)
  129. && CardEffectCommons.CanActivateSuspendCostEffect(card)
  130. && CardEffectCommons.HasMatchConditionOwnersHand(card, HasNSoJogress);
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable hashtable)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(
  135. new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() },
  136. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  137. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DNADigivolveWithHandOrTrashCardIntoHandOrTrash(
  138. targetCardCondition: IsNSoDigimonCard,
  139. permanentCondition: IsNSoPermanent,
  140. digivolutionCardCondition: IsNSoDigimonCard,
  141. payCost: true,
  142. isWithHandCard: false,
  143. isIntoHandCard: true,
  144. activateClass: activateClass,
  145. successProcess: null,
  146. failedProcess: null,
  147. isOptional: true));
  148. }
  149. }
  150. #endregion
  151. #region Security
  152. if (timing == EffectTiming.SecuritySkill)
  153. {
  154. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  155. }
  156. #endregion
  157. return cardEffects;
  158. }
  159. }
  160. }