BT22_065.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // PlatinumNumemon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_065 : 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.IsLevel5
  18. && targetPermanent.TopCard.HasCSTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region OP/WD Shared
  30. bool SharedOpponentDigimon(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  33. }
  34. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  35. {
  36. Permanent selectedPermanent = null;
  37. #region Select Permanent
  38. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedOpponentDigimon));
  39. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  40. selectPermanentEffect.SetUp(
  41. selectPlayer: card.Owner,
  42. canTargetCondition: SharedOpponentDigimon,
  43. canTargetCondition_ByPreSelecetedList: null,
  44. canEndSelectCondition: null,
  45. maxCount: maxCount,
  46. canNoSelect: false,
  47. canEndNotMax: false,
  48. selectPermanentCoroutine: SelectPermanentCoroutine,
  49. afterSelectPermanentCoroutine: null,
  50. mode: SelectPermanentEffect.Mode.Custom,
  51. cardEffect: activateClass);
  52. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  53. {
  54. selectedPermanent = permanent;
  55. yield return null;
  56. }
  57. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to -8K DP", "The opponent is selecting 1 Digimon to -8K DP");
  58. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  59. #endregion
  60. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(
  61. CardEffectCommons.ChangeDigimonDP(selectedPermanent, -8000, EffectDuration.UntilEachTurnEnd, activateClass));
  62. }
  63. #endregion
  64. #region On Play
  65. if (timing == EffectTiming.OnEnterFieldAnyone)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("-8K DP", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[On Play] 1 of your opponent's Digimon gets -8000 DP for the turn.";
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  82. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedOpponentDigimon);
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable hashtable)
  85. {
  86. yield return SharedActivateCoroutine(hashtable, activateClass);
  87. }
  88. }
  89. #endregion
  90. #region When Digivolving
  91. if (timing == EffectTiming.OnEnterFieldAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("-8K DP", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[When Digivolving] 1 of your opponent's Digimon gets -8000 DP for the turn.";
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  108. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedOpponentDigimon);
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable hashtable)
  111. {
  112. yield return SharedActivateCoroutine(hashtable, activateClass);
  113. }
  114. }
  115. #endregion
  116. #region Your Turn
  117. if (timing == EffectTiming.OnDestroyedAnyone)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("Digivolve 1 [CS] digimon", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  122. activateClass.SetHashString("BT22_065_Digivolve");
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[Your Turn] [Once Per Turn] When any of your opponent's Digimon are deleted, 1 of your other Digimon with the [CS] trait may digivolve into a Digimon card with the [CS] trait in the hand without paying the cost.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, IsOpponentDigimon, activateClass);
  131. }
  132. bool CanActivateCondition(Hashtable hashtable)
  133. {
  134. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  135. && CardEffectCommons.IsOwnerTurn(card)
  136. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsCSOnBoard);
  137. }
  138. bool IsOpponentDigimon(Permanent targetPermanent)
  139. {
  140. return targetPermanent.TopCard.Owner != card.Owner;
  141. }
  142. bool IsCSOnBoard(Permanent permanent)
  143. {
  144. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  145. permanent != card.PermanentOfThisCard() &&
  146. permanent.TopCard.HasCSTraits;
  147. }
  148. bool IsCSOnHand(CardSource cardSource, Permanent selectedPermanent)
  149. {
  150. return CardEffectCommons.IsExistOnHand(cardSource)
  151. && cardSource.HasCSTraits
  152. && cardSource.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, false, activateClass);
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable hashtable)
  155. {
  156. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsCSOnBoard))
  157. {
  158. Permanent selectedPermanent = null;
  159. #region Select Permanent
  160. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, IsCSOnBoard));
  161. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  162. selectPermanentEffect.SetUp(
  163. selectPlayer: card.Owner,
  164. canTargetCondition: IsCSOnBoard,
  165. canTargetCondition_ByPreSelecetedList: null,
  166. canEndSelectCondition: null,
  167. maxCount: maxCount,
  168. canNoSelect: true,
  169. canEndNotMax: false,
  170. selectPermanentCoroutine: SelectPermanentCoroutine,
  171. afterSelectPermanentCoroutine: null,
  172. mode: SelectPermanentEffect.Mode.Custom,
  173. cardEffect: activateClass);
  174. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  175. {
  176. selectedPermanent = permanent;
  177. yield return null;
  178. }
  179. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to digivolve", "The opponent is selecting 1 Digimon to digivolve");
  180. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  181. #endregion
  182. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(
  183. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  184. targetPermanent: selectedPermanent,
  185. cardCondition: card => IsCSOnHand(card, selectedPermanent),
  186. payCost: false,
  187. reduceCostTuple: null,
  188. fixedCostTuple: null,
  189. ignoreDigivolutionRequirementFixedCost: -1,
  190. isHand: true,
  191. activateClass: activateClass,
  192. successProcess: null));
  193. }
  194. }
  195. }
  196. #endregion
  197. return cardEffects;
  198. }
  199. }
  200. }