P_109.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. public class P_109 : CEntity_Effect
  4. {
  5. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  6. {
  7. List<ICardEffect> cardEffects = new List<ICardEffect>();
  8. #region Alternative Digivolution Requirement
  9. if (timing == EffectTiming.None)
  10. {
  11. bool PermanentCondition(Permanent targetPermanent)
  12. {
  13. return targetPermanent.TopCard.CardNames.Contains("Paildramon")
  14. || targetPermanent.TopCard.CardNames.Contains("Dinobeemon");
  15. }
  16. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  17. }
  18. #endregion
  19. #region Blast Digivolve
  20. if (timing == EffectTiming.OnCounterTiming)
  21. {
  22. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  23. }
  24. #endregion
  25. #region Shared OP/WD
  26. string SharedEffectName = "Suspend 1 Digimon and unsuspend 1 Digimon";
  27. CardEffectFactory.ActivateClassesForSharedEffects
  28. (ref cardEffects, timing, card,
  29. SharedEffectName,
  30. SharedActivateCoroutine,
  31. SharedEffectDescription,
  32. optional: false,
  33. onPlay: true,
  34. whenDigivolving: true);
  35. string SharedEffectDescription(string tag) => $"[{tag}] Suspend 1 Digimon, then unsuspend 1 Digimon.";
  36. bool CanSelectPermanentCondition(Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  39. }
  40. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  45. selectPermanentEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: CanSelectPermanentCondition,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: 1,
  51. canNoSelect: false,
  52. canEndNotMax: false,
  53. selectPermanentCoroutine: null,
  54. afterSelectPermanentCoroutine: null,
  55. mode: SelectPermanentEffect.Mode.Tap,
  56. cardEffect: activateClass);
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. }
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: null,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.UnTap,
  73. cardEffect: activateClass);
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. }
  76. }
  77. #endregion
  78. #region All Turns
  79. if (timing == EffectTiming.OnTappedAnyone)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("Play 1 Tamer or Digimon from hand", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  84. activateClass.SetHashString("Unsuspen_EX3_074");
  85. cardEffects.Add(activateClass);
  86. string EffectDescription()
  87. {
  88. return "[All Turns] [Once Per Turn] When this Digimon becomes suspended, you may play a Tamer card or a Digimon card with 4000 DP or less from your hand without paying the cost.";
  89. }
  90. bool CanSelectCardCondition(CardSource cardSource)
  91. {
  92. return cardSource.IsTamer
  93. || (cardSource.IsDigimon
  94. && cardSource.CardDP <= 4000)
  95. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.IsExistOnBattleArea(card)
  100. && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleArea(card)
  105. && card.Owner.HandCards.Count >= 1;
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  108. {
  109. List<CardSource> selectedCards = new List<CardSource>();
  110. int maxCount = 1;
  111. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  112. selectHandEffect.SetUp(
  113. selectPlayer: card.Owner,
  114. canTargetCondition: CanSelectCardCondition,
  115. canTargetCondition_ByPreSelecetedList: null,
  116. canEndSelectCondition: null,
  117. maxCount: maxCount,
  118. canNoSelect: true,
  119. canEndNotMax: false,
  120. isShowOpponent: true,
  121. selectCardCoroutine: SelectCardCoroutine,
  122. afterSelectCardCoroutine: null,
  123. mode: SelectHandEffect.Mode.Custom,
  124. cardEffect: activateClass);
  125. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  126. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  127. yield return StartCoroutine(selectHandEffect.Activate());
  128. IEnumerator SelectCardCoroutine(CardSource cardSource)
  129. {
  130. selectedCards.Add(cardSource);
  131. yield return null;
  132. }
  133. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  134. }
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }