BT24_036.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Medicmon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_036 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasStandardAppTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null));
  21. }
  22. #endregion
  23. #region Link Condition
  24. if (timing == EffectTiming.None)
  25. {
  26. static bool PermanentCondition(Permanent targetPermanent)
  27. {
  28. return targetPermanent.TopCard.HasAppmonTraits;
  29. }
  30. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  31. }
  32. #endregion
  33. #region Security
  34. if (timing == EffectTiming.SecuritySkill)
  35. {
  36. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  37. }
  38. #endregion
  39. #region Shared OP / OD
  40. string SharedEffectName() => "DP -3000";
  41. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  42. bool SharedCanSelectPermanentCondition(Permanent permanent)
  43. {
  44. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  45. }
  46. IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectPermanentCondition))
  49. {
  50. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(SharedCanSelectPermanentCondition));
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: SharedCanSelectPermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: maxCount,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: SelectPermanentCoroutine,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  69. targetPermanent: permanent,
  70. changeValue: -3000,
  71. effectDuration: EffectDuration.UntilEachTurnEnd,
  72. activateClass: activateClass));
  73. }
  74. }
  75. }
  76. #endregion
  77. #region On Play
  78. if (timing == EffectTiming.OnEnterFieldAnyone)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  82. activateClass.SetUpActivateClass(CanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("On Play"));
  83. cardEffects.Add(activateClass);
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  87. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  88. }
  89. bool CanActivateCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  92. CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectPermanentCondition);
  93. }
  94. }
  95. #endregion
  96. #region On Deletion
  97. if (timing == EffectTiming.OnDestroyedAnyone)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("On Deletion"));
  102. cardEffects.Add(activateClass);
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  110. }
  111. }
  112. #endregion
  113. #region Link
  114. if (timing == EffectTiming.OnDeclaration)
  115. {
  116. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  117. }
  118. #endregion
  119. #region On Deletion - Link Effect
  120. if (timing == EffectTiming.OnDestroyedAnyone)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect("DP -5000", CanUseCondition, card);
  124. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  125. activateClass.SetIsLinkedEffect(true);
  126. cardEffects.Add(activateClass);
  127. string EffectDescription()
  128. {
  129. return "[On Deletion] 1 of your opponent's Digimon gets -5000 DP for the turn.";
  130. }
  131. bool CanSelectPermanentCondition(Permanent permanent)
  132. {
  133. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  134. }
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  142. }
  143. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  144. {
  145. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  146. {
  147. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  148. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  149. selectPermanentEffect.SetUp(
  150. selectPlayer: card.Owner,
  151. canTargetCondition: CanSelectPermanentCondition,
  152. canTargetCondition_ByPreSelecetedList: null,
  153. canEndSelectCondition: null,
  154. maxCount: maxCount,
  155. canNoSelect: false,
  156. canEndNotMax: false,
  157. selectPermanentCoroutine: SelectPermanentCoroutine,
  158. afterSelectPermanentCoroutine: null,
  159. mode: SelectPermanentEffect.Mode.Custom,
  160. cardEffect: activateClass);
  161. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -5000.", "The opponent is selecting 1 Digimon that will get DP -5000.");
  162. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  163. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  164. {
  165. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  166. targetPermanent: permanent,
  167. changeValue: -5000,
  168. effectDuration: EffectDuration.UntilEachTurnEnd,
  169. activateClass: activateClass));
  170. }
  171. }
  172. }
  173. }
  174. #endregion
  175. return cardEffects;
  176. }
  177. }
  178. }