BT24_092.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Shock Plasma
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_092 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Ignore Color Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  17. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  18. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  19. cardEffects.Add(ignoreColorConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. => CardEffectCommons.HasMatchConditionPermanent((permanent) => permanent.TopCard.Owner == card.Owner && (permanent.IsTamer || permanent.IsDigimon) && permanent.TopCard.HasTSTraits, true);
  22. bool CardCondition(CardSource cardSource)
  23. => cardSource == card;
  24. }
  25. #endregion
  26. #region Link Condition
  27. if (timing == EffectTiming.None)
  28. {
  29. static bool PermanentCondition(Permanent targetPermanent)
  30. {
  31. return targetPermanent.IsDigimon && targetPermanent.TopCard.HasTSTraits;
  32. }
  33. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 3, card: card));
  34. }
  35. #endregion
  36. #region Link
  37. if (timing == EffectTiming.OnDeclaration)
  38. {
  39. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  40. }
  41. #endregion
  42. #endregion
  43. #region Security Effect
  44. if (timing == EffectTiming.SecuritySkill)
  45. {
  46. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  47. card: card,
  48. cardEffects: ref cardEffects,
  49. effectName: "1 opponent's Digimon gets -6K DP for the turn. Then, you may link this card.");
  50. }
  51. #endregion
  52. #region Shared DP Reduction
  53. bool SharedIsOpponentDigimon(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  56. }
  57. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  58. {
  59. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedIsOpponentDigimon))
  60. {
  61. Permanent selectedPermament = null;
  62. #region Select Permanent
  63. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedIsOpponentDigimon));
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: SharedIsOpponentDigimon,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: SelectPermanentCoroutine,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.Custom,
  76. cardEffect: activateClass);
  77. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  78. {
  79. selectedPermament = permanent;
  80. yield return null;
  81. }
  82. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -6K DP", "The opponent is selecting 1 Digimon to -6K DP");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. #endregion
  85. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(
  86. CardEffectCommons.ChangeDigimonDP(selectedPermament, -6000, EffectDuration.UntilEachTurnEnd, activateClass));
  87. }
  88. }
  89. #endregion
  90. #region Main
  91. if (timing == EffectTiming.OptionSkill)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("1 opponent's Digimon gets -6K DP for the turn. Then, you may link this card.", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  96. cardEffects.Add(activateClass);
  97. string EffectDescription()
  98. => "[Main] 1 of your opponent's Digimon gets -6000 DP for the turn. Then, you may link this card to 1 of your Digimon on the field without paying the cost.";
  99. bool CanUseCondition(Hashtable hashtable)
  100. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  101. bool CanSelectPermanentCondition(Permanent permanent)
  102. {
  103. return permanent.IsDigimon
  104. && CardEffectCommons.IsOwnerPermanent(permanent, card)
  105. && card.CanLinkToTargetPermanent(permanent, false, true);
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable hashtable)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  110. #region Select Digimon To Link
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition, true))
  112. {
  113. Permanent selectedPermanent = null;
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: 1,
  121. canNoSelect: true,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: SelectPermanentCoroutine,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Custom,
  126. cardEffect: activateClass);
  127. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  130. {
  131. selectedPermanent = permanent;
  132. yield return null;
  133. }
  134. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(card, activateClass));
  135. }
  136. #endregion
  137. }
  138. }
  139. #endregion
  140. #region Link ESS
  141. if (timing == EffectTiming.OnAllyAttack)
  142. {
  143. ActivateClass activateClass = new ActivateClass();
  144. activateClass.SetUpICardEffect("1 Opponent's digimon gets -6K DP for the turn.", CanUseCondition, card);
  145. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  146. activateClass.SetIsLinkedEffect(true);
  147. activateClass.SetHashString("WA_BT24-092");
  148. cardEffects.Add(activateClass);
  149. string EffectDescription()
  150. {
  151. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -6000 DP for the turn.";
  152. }
  153. bool CanUseCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  160. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedIsOpponentDigimon);
  161. }
  162. IEnumerator ActivateCoroutine(Hashtable hashtable)
  163. {
  164. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  165. }
  166. }
  167. #endregion
  168. return cardEffects;
  169. }
  170. }
  171. }