BT22_029.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Shoemon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_029 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region OP/OD Shared
  13. bool SharedPuppetDigimon(Permanent permanent)
  14. {
  15. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  16. && permanent.TopCard.HasPuppetTraits;
  17. }
  18. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  19. {
  20. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, SharedPuppetDigimon))
  21. {
  22. Permanent selectedPermament = null;
  23. #region Select Permanent
  24. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, SharedPuppetDigimon));
  25. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  26. selectPermanentEffect.SetUp(
  27. selectPlayer: card.Owner,
  28. canTargetCondition: SharedPuppetDigimon,
  29. canTargetCondition_ByPreSelecetedList: null,
  30. canEndSelectCondition: null,
  31. maxCount: maxCount,
  32. canNoSelect: false,
  33. canEndNotMax: false,
  34. selectPermanentCoroutine: SelectPermanentCoroutine,
  35. afterSelectPermanentCoroutine: null,
  36. mode: SelectPermanentEffect.Mode.Custom,
  37. cardEffect: activateClass);
  38. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  39. {
  40. selectedPermament = permanent;
  41. yield return null;
  42. }
  43. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain Blocker", "The opponent is selecting 1 Digimon to gain Blocker");
  44. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  45. #endregion
  46. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(
  47. CardEffectCommons.GainBlocker(selectedPermament, EffectDuration.UntilOpponentTurnEnd, activateClass));
  48. }
  49. }
  50. #endregion
  51. #region On Play
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("1 [Puppet] digimon gain <Blocker>", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  57. cardEffects.Add(activateClass);
  58. string EffectDiscription()
  59. {
  60. return "[On Play] 1 of your Digimon with the [Puppet] trait gains <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  65. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  70. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, SharedPuppetDigimon);
  71. }
  72. IEnumerator ActivateCoroutine(Hashtable hashtable)
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  75. }
  76. }
  77. #endregion
  78. #region On Deletion
  79. if (timing == EffectTiming.OnDestroyedAnyone)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("1 [Puppet] digimon gain <Blocker>", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  84. cardEffects.Add(activateClass);
  85. string EffectDiscription()
  86. {
  87. return "[On Deletion] 1 of your Digimon with the [Puppet] trait gains <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  88. }
  89. bool CanUseCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanActivateOnDeletion(card, activateClass)
  96. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, SharedPuppetDigimon);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  101. }
  102. }
  103. #endregion
  104. #region ESS
  105. if (timing == EffectTiming.OnAllyAttack)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("-2K DP", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  110. activateClass.SetHashString("BT22_029_WA");
  111. activateClass.SetIsInheritedEffect(true);
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  116. }
  117. bool CanUseCondition(Hashtable hashtable)
  118. {
  119. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  120. }
  121. bool CanActivateCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  124. }
  125. bool IsOpponentDigimon(Permanent permanent)
  126. {
  127. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon))
  132. {
  133. Permanent selectedPermament = null;
  134. #region Select Permanent
  135. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentDigimon));
  136. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: IsOpponentDigimon,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: maxCount,
  143. canNoSelect: false,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: SelectPermanentCoroutine,
  146. afterSelectPermanentCoroutine: null,
  147. mode: SelectPermanentEffect.Mode.Custom,
  148. cardEffect: activateClass);
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. selectedPermament = permanent;
  152. yield return null;
  153. }
  154. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -2K DP", "The opponent is selecting 1 Digimon to -2K DP");
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. #endregion
  157. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  158. targetPermanent: selectedPermament,
  159. changeValue: -2000,
  160. effectDuration: EffectDuration.UntilEachTurnEnd,
  161. activateClass: activateClass
  162. ));
  163. }
  164. }
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }