BT19_095.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_095 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Ignore Color Requirements
  12. if (timing == EffectTiming.None)
  13. {
  14. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  15. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  16. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  17. cardEffects.Add(ignoreColorConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return !CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("Knight Device"));
  21. }
  22. bool CardCondition(CardSource cardSource)
  23. {
  24. return (cardSource == card);
  25. }
  26. }
  27. #endregion
  28. #region When Trashed from battle area
  29. if (timing == EffectTiming.OnDestroyedAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Gain Piercing, +4000 DP", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return "When this card is trashed in your battle area, 1 of your Digimon gains <Piercing> and gets +4000 DP for the turn.";
  38. }
  39. bool HasDigimon(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(HasDigimon))
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: HasDigimon,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine1,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Piercing, +4000 DP.", "The opponent is selecting 1 Digimon.");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  73. targetPermanent: permanent,
  74. effectDuration: EffectDuration.UntilEachTurnEnd,
  75. activateClass: activateClass));
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  77. targetPermanent: permanent,
  78. changeValue: 4000,
  79. effectDuration: EffectDuration.UntilEachTurnEnd,
  80. activateClass: activateClass));
  81. }
  82. }
  83. }
  84. }
  85. #endregion
  86. #region Main
  87. if (timing == EffectTiming.OptionSkill)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Gain Piercing, +4000 DP, then place in battle area", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  92. cardEffects.Add(activateClass);
  93. string EffectDescription()
  94. {
  95. return "[Main] 1 of your Digimon gains <Piercing> and gets +4000 DP for the turn. Then, place this card in the battle area.";
  96. }
  97. bool HasDigimon(Permanent permanent)
  98. {
  99. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  104. }
  105. IEnumerator ActivateCoroutine(Hashtable hashtable)
  106. {
  107. if(CardEffectCommons.HasMatchConditionPermanent(HasDigimon))
  108. {
  109. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: HasDigimon,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: 1,
  116. canNoSelect: false,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: SelectPermanentCoroutine1,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Piercing, +4000 DP.", "The opponent is selecting 1 Digimon.");
  123. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  124. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  127. targetPermanent: permanent,
  128. effectDuration: EffectDuration.UntilEachTurnEnd,
  129. activateClass: activateClass));
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  131. targetPermanent: permanent,
  132. changeValue: 4000,
  133. effectDuration: EffectDuration.UntilEachTurnEnd,
  134. activateClass: activateClass));
  135. }
  136. }
  137. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  138. }
  139. }
  140. #endregion
  141. #region Security Effect
  142. if (timing == EffectTiming.SecuritySkill)
  143. {
  144. ActivateClass activateClass = new ActivateClass();
  145. activateClass.SetUpICardEffect($"Suspend 2 Digimon or Tamers, then add to hand.", CanUseCondition, card);
  146. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  147. activateClass.SetIsSecurityEffect(true);
  148. cardEffects.Add(activateClass);
  149. string EffectDescription()
  150. {
  151. return "[Security] Suspend 2 of your opponent's Digimon or Tamers. Then, add this card to the hand.";
  152. }
  153. bool CanSelectPermanentCondition(Permanent permanent)
  154. {
  155. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  156. {
  157. if (permanent.CanSelectBySkill(activateClass))
  158. {
  159. if (permanent.IsDigimon || permanent.IsTamer)
  160. {
  161. return true;
  162. }
  163. }
  164. }
  165. return false;
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  170. }
  171. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  172. {
  173. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  174. {
  175. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  176. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  177. selectPermanentEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: CanSelectPermanentCondition,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: maxCount,
  183. canNoSelect: false,
  184. canEndNotMax: false,
  185. selectPermanentCoroutine: null,
  186. afterSelectPermanentCoroutine: null,
  187. mode: SelectPermanentEffect.Mode.Tap,
  188. cardEffect: activateClass);
  189. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  190. }
  191. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  192. }
  193. }
  194. #endregion
  195. return cardEffects;
  196. }
  197. }
  198. }