BT18_039.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_039 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Barrier
  12. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  13. {
  14. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: false, card: card, condition: null));
  15. }
  16. #endregion
  17. #region On Play
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Trash your top security to change one Digimon to 6000DP", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[On Play] By trashing the top card of your security stack, change the original DP of 1 Digimon to 6000 until the end of your opponent's turn.";
  27. }
  28. bool CanSelectPermanentCondition(Permanent permanent)
  29. {
  30. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) || CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  31. {
  32. return true;
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  43. {
  44. if (card.Owner.SecurityCards.Count >= 1)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  54. player: card.Owner,
  55. destroySecurityCount: 1,
  56. cardEffect: activateClass,
  57. fromTop: true).DestroySecurity());
  58. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  59. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectPermanentCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: maxCount,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: SelectPermanentCoroutine,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeOriginDP(changeValue: 6000, maxCount: maxCount));
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  74. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeBaseDigimonDP(targetPermanent: permanent, changeValue: 6000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  77. }
  78. }
  79. }
  80. #endregion
  81. #region When Digivolving
  82. if (timing == EffectTiming.OnEnterFieldAnyone)
  83. {
  84. ActivateClass activateClass = new ActivateClass();
  85. activateClass.SetUpICardEffect("Trash your top security to change one Digimon to 6000DP", CanUseCondition, card);
  86. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  87. cardEffects.Add(activateClass);
  88. string EffectDiscription()
  89. {
  90. return "[When Digivolving] By trashing the top card of your security stack, change the original DP of 1 Digimon to 6000 until the end of your opponent's turn.";
  91. }
  92. bool CanSelectPermanentCondition(Permanent permanent)
  93. {
  94. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) || CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  95. {
  96. return true;
  97. }
  98. return false;
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  103. {
  104. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  114. {
  115. if (card.Owner.SecurityCards.Count >= 1)
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  125. player: card.Owner,
  126. destroySecurityCount: 1,
  127. cardEffect: activateClass,
  128. fromTop: true).DestroySecurity());
  129. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  130. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  131. selectPermanentEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectPermanentCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. selectPermanentCoroutine: SelectPermanentCoroutine,
  140. afterSelectPermanentCoroutine: null,
  141. mode: SelectPermanentEffect.Mode.Custom,
  142. cardEffect: activateClass);
  143. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeOriginDP(changeValue: 6000, maxCount: maxCount));
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  146. {
  147. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeBaseDigimonDP(targetPermanent: permanent, changeValue: 6000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  148. }
  149. }
  150. }
  151. #endregion
  152. #region Inherit
  153. if (timing == EffectTiming.OnLoseSecurity)
  154. {
  155. ActivateClass activateClass = new ActivateClass();
  156. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  157. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  158. activateClass.SetIsInheritedEffect(true);
  159. activateClass.SetHashString("Unsuspend_BT18_039");
  160. cardEffects.Add(activateClass);
  161. string EffectDiscription()
  162. {
  163. return "[All Turns] [Once Per Turn] When your security stack is removed from, this Digimon may unsuspend.";
  164. }
  165. bool CanUseCondition(Hashtable hashtable)
  166. {
  167. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  168. {
  169. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  170. {
  171. return true;
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  179. {
  180. return true;
  181. }
  182. return false;
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  185. {
  186. Permanent selectedPermanent = card.PermanentOfThisCard();
  187. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  188. new List<Permanent>() { selectedPermanent },
  189. activateClass).Unsuspend());
  190. }
  191. }
  192. #endregion
  193. return cardEffects;
  194. }
  195. }
  196. }