BT22_059.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Infermon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_059 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.HasCSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region On Play
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Delete a 5 or less play cost digimon, then if you have [Arata Sanada]/[Eater Adam], gain immunity to DP reduction and bounce", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[On Play] Delete 1 of your opponent's Digimon with a play cost of 5 or less. Then, if you have [Arata Sanada] or [Eater Adam], your opponent's effects can't reduce this Digimon's DP or return it to hands or decks until their turn ends.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  46. }
  47. bool OpponentDigimon(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  50. && permanent.TopCard.HasPlayCost && permanent.TopCard.BasePlayCostFromEntity <= 5;
  51. }
  52. bool IsArataOrAdam(Permanent permanent)
  53. {
  54. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  55. && (permanent.TopCard.EqualsCardName(name: "Arata Sanada") || permanent.TopCard.EqualsCardName(name: "Eater Adam"));
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentDigimon))
  60. {
  61. #region Delete Opponent's Digimon
  62. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentDigimon));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: OpponentDigimon,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Destroy,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. #endregion
  79. }
  80. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsArataOrAdam))
  81. {
  82. Permanent permanent = card.PermanentOfThisCard();
  83. #region Gain Immunity to DP Minus and Bounce
  84. yield return ContinuousController.instance.StartCoroutine(
  85. CardEffectCommons.GainImmuneFromDPMinus(permanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Immune from DP reduction"));
  86. yield return ContinuousController.instance.StartCoroutine(
  87. CardEffectCommons.GainCanNotReturnToDeck(permanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Immune from bounce to deck"));
  88. yield return ContinuousController.instance.StartCoroutine(
  89. CardEffectCommons.GainCanNotReturnToHand(permanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Immune from bounce to hand"));
  90. #endregion
  91. }
  92. }
  93. }
  94. #endregion
  95. #region When Digivolving
  96. if (timing == EffectTiming.OnEnterFieldAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Delete a 5 or less play cost digimon, then if you have [Arata Sanada]/[Eater Adam], gain immunity to DP reduction and bounce", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[When Digivolving] Delete 1 of your opponent's Digimon with a play cost of 5 or less. Then, if you have [Arata Sanada] or [Eater Adam], your opponent's effects can't reduce this Digimon's DP or return it to hands or decks until their turn ends.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  113. }
  114. bool OpponentDigimon(Permanent permanent)
  115. {
  116. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  117. && permanent.TopCard.HasPlayCost && permanent.TopCard.BasePlayCostFromEntity <= 5;
  118. }
  119. bool IsArataOrAdam(Permanent permanent)
  120. {
  121. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  122. && (permanent.TopCard.EqualsCardName(name: "Arata Sanada") || permanent.TopCard.EqualsCardName(name: "Eater Adam"));
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentDigimon))
  127. {
  128. #region Delete Opponent's Digimon
  129. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentDigimon));
  130. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  131. selectPermanentEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: OpponentDigimon,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. selectPermanentCoroutine: null,
  140. afterSelectPermanentCoroutine: null,
  141. mode: SelectPermanentEffect.Mode.Destroy,
  142. cardEffect: activateClass);
  143. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. #endregion
  146. }
  147. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsArataOrAdam))
  148. {
  149. Permanent permanent = card.PermanentOfThisCard();
  150. #region Gain Immunity to DP Minus and Bounce
  151. yield return ContinuousController.instance.StartCoroutine(
  152. CardEffectCommons.GainImmuneFromDPMinus(permanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Immune from DP reduction"));
  153. yield return ContinuousController.instance.StartCoroutine(
  154. CardEffectCommons.GainCanNotReturnToDeck(permanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Immune from bounce to deck"));
  155. yield return ContinuousController.instance.StartCoroutine(
  156. CardEffectCommons.GainCanNotReturnToHand(permanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Immune from bounce to hand"));
  157. #endregion
  158. }
  159. }
  160. }
  161. #endregion
  162. #region All Turns
  163. if (timing == EffectTiming.OnDestroyedAnyone)
  164. {
  165. ActivateClass activateClass = new ActivateClass();
  166. activateClass.SetUpICardEffect("Play 1 [Diaboromon] Token", CanUseCondition, card);
  167. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  168. activateClass.SetHashString("BT22_059_PlayDiaboromonToken");
  169. activateClass.SetIsInheritedEffect(true);
  170. cardEffects.Add(activateClass);
  171. string EffectDiscription()
  172. {
  173. return "[All Turns] [Once Per Turn] When any of your Digimon with the [Unidentified] trait are deleted, you may play 1 [Diaboromon] Token without paying the cost. (Digimon/Cost 14/Lv.6/White/Mega/Unknown/Unidentified/3000 DP)";
  174. }
  175. bool CanUseCondition(Hashtable hashtable)
  176. {
  177. return CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, IsUnidentified);
  178. }
  179. bool CanActivateCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  182. }
  183. bool IsUnidentified(Permanent permanent)
  184. {
  185. return permanent.TopCard.IsDigimon &&
  186. permanent.TopCard.HasUnidentifiedTraits &&
  187. CardEffectCommons.IsOwnerPermanent(permanent, card) &&
  188. permanent != card.PermanentOfThisCard();
  189. }
  190. IEnumerator ActivateCoroutine(Hashtable hashtable)
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayDiaboromonToken(activateClass));
  193. }
  194. }
  195. #endregion
  196. return cardEffects;
  197. }
  198. }
  199. }