EX11_026.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. // Pteromon
  8. public class EX11_026 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Shared WM / OP
  14. string SharedEffectName = "Suspend 1 Digimon. If yours, give 1 of yours +3k";
  15. string SharedEffectDescription(string tag) => $"[{tag}] You may suspend 1 Digimon. If this effect suspended your Digimon, 1 of your Digimon with [Avian] or [Bird] in any of its traits or the [Vortex Warriors] trait gets +3000 DP until your opponent's turn ends.";
  16. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  17. bool CanSelectSuspendPermanentCondition(Permanent permanent)
  18. {
  19. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  20. }
  21. bool CanGiveBoostCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  24. && (permanent.TopCard.ContainsTraits("Avian")
  25. || permanent.TopCard.ContainsTraits("Bird")
  26. || permanent.TopCard.EqualsTraits("Vortex Warriors"));
  27. }
  28. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  29. {
  30. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendPermanentCondition))
  31. {
  32. Permanent selectedPermanent = null;
  33. bool ownDigimon = false;
  34. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  35. selectPermanentEffect.SetUp(
  36. selectPlayer: card.Owner,
  37. canTargetCondition: CanSelectSuspendPermanentCondition,
  38. canTargetCondition_ByPreSelecetedList: null,
  39. canEndSelectCondition: null,
  40. maxCount: 1,
  41. canNoSelect: true,
  42. canEndNotMax: false,
  43. selectPermanentCoroutine: SelectPermanentCoroutine,
  44. afterSelectPermanentCoroutine: null,
  45. mode: SelectPermanentEffect.Mode.Custom,
  46. cardEffect: activateClass);
  47. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  48. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  49. {
  50. selectedPermanent = permanent;
  51. yield return null;
  52. }
  53. if (selectedPermanent != null &&
  54. selectedPermanent.TopCard &&
  55. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  56. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(
  59. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  60. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  61. ownDigimon = selectedPermanent.IsSuspended &&
  62. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  63. }
  64. if (ownDigimon)
  65. {
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanGiveBoostCondition));
  67. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect1.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanGiveBoostCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: SelectPermanentCoroutine1,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. selectPermanentEffect1.SetUpCustomMessage(
  81. "Select 1 Digimon that will gain 3k DP.",
  82. "The opponent is selecting 1 Digimon that will gain 3k DP.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  84. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  87. targetPermanent: permanent,
  88. changeValue: 3000,
  89. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  90. activateClass: activateClass));
  91. }
  92. }
  93. }
  94. }
  95. #endregion
  96. #region When Moving
  97. if (timing == EffectTiming.OnMove)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  101. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDescription("When Moving"));
  102. cardEffects.Add(activateClass);
  103. bool PermanentCondition(Permanent permanent)
  104. {
  105. return permanent == card.PermanentOfThisCard();
  106. }
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  110. CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition);
  111. }
  112. }
  113. #endregion
  114. #region On Play
  115. if (timing == EffectTiming.OnEnterFieldAnyone)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  119. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  120. cardEffects.Add(activateClass);
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  124. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  125. }
  126. }
  127. #endregion
  128. #region ESS - Win Battle
  129. if (timing == EffectTiming.OnEndBattle)
  130. {
  131. ActivateClass activateClass = new ActivateClass();
  132. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  133. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  134. activateClass.SetIsInheritedEffect(true);
  135. activateClass.SetHashString("EX11_026_ESS_Gain_Mem");
  136. cardEffects.Add(activateClass);
  137. string EffectDiscription()
  138. {
  139. return "[Your Turn] [Once Per Turn] When this Digimon wins a battle, gain 1 memory.";
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  144. {
  145. if (CardEffectCommons.IsOwnerTurn(card))
  146. {
  147. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  148. if (CardEffectCommons.CanTriggerWhenWinBattle(
  149. hashtable: hashtable,
  150. winnerCondition: WinnerCondition))
  151. {
  152. return true;
  153. }
  154. }
  155. }
  156. return false;
  157. }
  158. bool CanActivateCondition(Hashtable hashtable)
  159. {
  160. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  161. }
  162. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  163. {
  164. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  165. }
  166. }
  167. #endregion
  168. return cardEffects;
  169. }
  170. }
  171. }