BT18_014.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Gigasmon
  5. namespace DCGO.CardEffects.BT18
  6. {
  7. public class BT18_014 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Conditions
  13. // Grumblemon
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Grumblemon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. // Any red tamer
  23. if (timing == EffectTiming.None)
  24. {
  25. bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.IsTamer && targetPermanent.TopCard.CardColors.Contains(CardColor.Red);
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  30. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  31. card: card, condition: null));
  32. }
  33. #endregion
  34. #region On Play
  35. if (timing == EffectTiming.OnEnterFieldAnyone)
  36. {
  37. ActivateClass activateClass = new ActivateClass();
  38. activateClass.SetUpICardEffect("Give a Digimon rush.", CanUseCondition, card);
  39. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  40. cardEffects.Add(activateClass);
  41. string EffectDiscription()
  42. {
  43. return "[On Play] 1 of your Digimon gains <Rush> for the turn.";
  44. }
  45. bool PermanentCondition(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. return false;
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.IsExistOnBattleArea(card);
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  62. {
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: PermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: 1,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Rush.", "The opponent is selecting 1 Digimon that will get Rush.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  81. targetPermanent: selectedPermanent,
  82. effectDuration: EffectDuration.UntilEachTurnEnd,
  83. activateClass: activateClass));
  84. }
  85. }
  86. }
  87. }
  88. #endregion
  89. #region When Digivolving
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Give a Digimon rush.", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[When Digivolving] 1 of your Digimon gains <Rush> for the turn.";
  99. }
  100. bool PermanentCondition(Permanent permanent)
  101. {
  102. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  107. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  108. return false;
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleArea(card);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  117. {
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: PermanentCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: 1,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: SelectPermanentCoroutine,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Custom,
  130. cardEffect: activateClass);
  131. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Rush.", "The opponent is selecting 1 Digimon that will get Rush.");
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  136. targetPermanent: selectedPermanent,
  137. effectDuration: EffectDuration.UntilEachTurnEnd,
  138. activateClass: activateClass));
  139. }
  140. }
  141. }
  142. }
  143. #endregion
  144. #region ESS - When Attacking
  145. if (timing == EffectTiming.OnAllyAttack)
  146. {
  147. ActivateClass activateClass = new ActivateClass();
  148. activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon with 3000 DP or less", CanUseCondition, card);
  149. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  150. activateClass.SetIsInheritedEffect(true);
  151. activateClass.SetHashString("Delete_BT18_012");
  152. cardEffects.Add(activateClass);
  153. string EffectDiscription()
  154. {
  155. return "[When Attacking] [Once Per Turn] Delete 1 of your opponent's Digimon with 3000 DP or less.";
  156. }
  157. bool CanSelectPermanentCondition(Permanent permanent)
  158. {
  159. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  160. {
  161. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  162. {
  163. return true;
  164. }
  165. }
  166. return false;
  167. }
  168. bool CanUseCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  171. }
  172. bool CanActivateCondition(Hashtable hashtable)
  173. {
  174. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  175. }
  176. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  177. {
  178. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  179. {
  180. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  181. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  182. selectPermanentEffect.SetUp(
  183. selectPlayer: card.Owner,
  184. canTargetCondition: CanSelectPermanentCondition,
  185. canTargetCondition_ByPreSelecetedList: null,
  186. canEndSelectCondition: null,
  187. maxCount: maxCount,
  188. canNoSelect: false,
  189. canEndNotMax: false,
  190. selectPermanentCoroutine: null,
  191. afterSelectPermanentCoroutine: null,
  192. mode: SelectPermanentEffect.Mode.Destroy,
  193. cardEffect: activateClass);
  194. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  195. }
  196. }
  197. }
  198. #endregion
  199. return cardEffects;
  200. }
  201. }
  202. }