BT18_050.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Petaldramon
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_050 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Arbormon");
  17. }
  18. static bool TamerCondition(Permanent targetPermanent)
  19. {
  20. return targetPermanent.TopCard.CardColors.Contains(CardColor.Green) &&
  21. targetPermanent.IsTamer;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: true, card: card, condition: null));
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: TamerCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: true, card: card, condition: null));
  25. }
  26. #endregion
  27. #region On Play/When Digivolving Shared
  28. bool YourDigimon(Permanent permanent)
  29. {
  30. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  31. return permanent.TopCard.Level <= 4 && permanent.TopCard.HasLevel &&
  32. permanent.TopCard.HasPlantTraits;
  33. return false;
  34. }
  35. #endregion
  36. #region On Play
  37. if (timing == EffectTiming.OnEnterFieldAnyone)
  38. {
  39. ActivateClass activateClass = new ActivateClass();
  40. activateClass.SetUpICardEffect("Unsuspend 1 of your digimon", CanUseCondition, card);
  41. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[On Play] You may unsuspend 1 of your level 4 or lower Digimon with [Vegetation] or [Plant] in one of its traits.";
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  50. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  51. return false;
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  56. return CardEffectCommons.HasMatchConditionPermanent(YourDigimon);
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: YourDigimon,
  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. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. }
  77. }
  78. #endregion
  79. #region When Digivolving
  80. if (timing == EffectTiming.OnEnterFieldAnyone)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("Unsuspend 1 of your digimon", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription()
  87. {
  88. return "[When Digivolving] You may unsuspend 1 of your level 4 or lower Digimon with [Vegetation] or [Plant] in one of its traits.";
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  93. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  99. return CardEffectCommons.HasMatchConditionPermanent(YourDigimon);
  100. return false;
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable hashtable)
  103. {
  104. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  105. selectPermanentEffect.SetUp(
  106. selectPlayer: card.Owner,
  107. canTargetCondition: YourDigimon,
  108. canTargetCondition_ByPreSelecetedList: null,
  109. canEndSelectCondition: null,
  110. maxCount: 1,
  111. canNoSelect: false,
  112. canEndNotMax: false,
  113. selectPermanentCoroutine: null,
  114. afterSelectPermanentCoroutine: null,
  115. mode: SelectPermanentEffect.Mode.UnTap,
  116. cardEffect: activateClass);
  117. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  118. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  119. }
  120. }
  121. #endregion
  122. #region When Attacking - ESS
  123. if (timing == EffectTiming.OnAllyAttack)
  124. {
  125. ActivateClass activateClass = new ActivateClass();
  126. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon", CanUseCondition, card);
  127. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  128. activateClass.SetHashString("Suspend_BT18_050");
  129. activateClass.SetIsInheritedEffect(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[When Attacking] [Once Per Turn] Suspend 1 of your opponent's Digimon.";
  134. }
  135. bool IsOpponentDigimon(Permanent permanent)
  136. {
  137. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  138. }
  139. bool CanUseCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  142. }
  143. bool CanActivateCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  146. }
  147. IEnumerator ActivateCoroutine(Hashtable hashtable)
  148. {
  149. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon))
  150. {
  151. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  152. selectPermanentEffect.SetUp(
  153. selectPlayer: card.Owner,
  154. canTargetCondition: IsOpponentDigimon,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. maxCount: 1,
  158. canNoSelect: false,
  159. canEndNotMax: false,
  160. selectPermanentCoroutine: null,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Tap,
  163. cardEffect: activateClass);
  164. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. }
  167. }
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }