BT21_086.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_086 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Security
  12. if (timing == EffectTiming.SecuritySkill)
  13. {
  14. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  15. }
  16. #endregion
  17. #region Start of Your Main Phase
  18. if (timing == EffectTiming.OnStartMainPhase)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleArea(card))
  31. {
  32. if (CardEffectCommons.IsOwnerTurn(card))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  44. {
  45. if (card.Owner.CanAddMemory(activateClass))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  56. }
  57. }
  58. #endregion
  59. #region On Play
  60. if (timing == EffectTiming.OnEnterFieldAnyone)
  61. {
  62. ActivateClass activateClass = new ActivateClass();
  63. activateClass.SetUpICardEffect("Suspend this Tamer", CanUseCondition, card);
  64. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  65. cardEffects.Add(activateClass);
  66. string EffectDiscription()
  67. {
  68. return "[On Play] 1 of your [Marcus Damon] may suspend.";
  69. }
  70. bool CanSelectMarcus(Permanent permanent)
  71. {
  72. return CardEffectCommons.IsOwnerPermanent(permanent, card) &&
  73. permanent.TopCard.EqualsCardName("Marcus Damon");
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleArea(card);
  82. }
  83. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  84. {
  85. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectMarcus))
  86. {
  87. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  88. selectPermanentEffect.SetUp(
  89. selectPlayer: card.Owner,
  90. canTargetCondition: CanSelectMarcus,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. maxCount: 1,
  94. canNoSelect: true,
  95. canEndNotMax: false,
  96. selectPermanentCoroutine: null,
  97. afterSelectPermanentCoroutine: null,
  98. mode: SelectPermanentEffect.Mode.Tap,
  99. cardEffect: activateClass);
  100. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  101. }
  102. }
  103. }
  104. #endregion
  105. #region All Turns
  106. if (timing == EffectTiming.OnTappedAnyone)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("1 of you Digimon gains <Piercing> and -3000 DP to an opponent Digimon", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  111. activateClass.SetHashString("PiercingAndDPMinus_BT21_086");
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[All Turns][Once Per Turn] When this Tamer suspends, 1 of your Digimon gains <Piercing> and +3000 DP for the turn. Then, 1 of your opponent's Digimon gets -3000 DP for the turn.";
  116. }
  117. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  120. }
  121. bool CanSelectOwnPermanentCondition(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. if (CardEffectCommons.IsExistOnBattleArea(card))
  128. {
  129. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. if (CardEffectCommons.IsExistOnBattleArea(card))
  139. {
  140. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition) ||
  141. CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnPermanentCondition))
  142. {
  143. return true;
  144. }
  145. }
  146. return false;
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  149. {
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnPermanentCondition))
  151. {
  152. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOwnPermanentCondition));
  153. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: CanSelectOwnPermanentCondition,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount,
  160. canNoSelect: false,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: SelectPermanentCoroutine,
  163. afterSelectPermanentCoroutine: null,
  164. mode: SelectPermanentEffect.Mode.Custom,
  165. cardEffect: activateClass);
  166. selectPermanentEffect.SetUpCustomMessage(
  167. "Select 1 Digimon that will gain <Piercing> and +3000 DP for the turn.",
  168. "The opponent is selecting 1 Digimon.");
  169. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  170. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  171. {
  172. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  173. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  174. }
  175. }
  176. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  177. {
  178. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  179. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  180. selectPermanentEffect.SetUp(
  181. selectPlayer: card.Owner,
  182. canTargetCondition: CanSelectOpponentPermanentCondition,
  183. canTargetCondition_ByPreSelecetedList: null,
  184. canEndSelectCondition: null,
  185. maxCount: maxCount,
  186. canNoSelect: false,
  187. canEndNotMax: false,
  188. selectPermanentCoroutine: SelectPermanentCoroutine,
  189. afterSelectPermanentCoroutine: null,
  190. mode: SelectPermanentEffect.Mode.Custom,
  191. cardEffect: activateClass);
  192. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get -3000 DP.", "The opponent is selecting 1 Digimon that will get -3000 DP.");
  193. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  194. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  195. {
  196. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  197. }
  198. }
  199. }
  200. }
  201. #endregion
  202. return cardEffects;
  203. }
  204. }
  205. }