BT12_041.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_041 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasSaveText && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Digivolving] For every 2 cards in this Digimon's digivolution cards, activate the following effect: - 1 of your opponent's Digimon gets -3000 DP for the turn.";
  28. }
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. int count = card.PermanentOfThisCard().DigivolutionCards.Count / 2;
  42. if (count >= 1)
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. int count = card.PermanentOfThisCard().DigivolutionCards.Count / 2;
  57. if (count >= 1)
  58. {
  59. for (int i = 0; i < count; i++)
  60. {
  61. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  62. {
  63. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: CanSelectPermanentCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: SelectPermanentCoroutine,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.Custom,
  76. cardEffect: activateClass);
  77. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  78. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  79. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  82. }
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. if (timing == EffectTiming.OnDestroyedAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[Your Turn] If an opponent's Digimon is deleted by dropping to 0 DP, <Draw 1>. (Draw 1 card from your deck.)";
  98. }
  99. bool PermanentCondition(Permanent permanent)
  100. {
  101. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (CardEffectCommons.IsOwnerTurn(card))
  108. {
  109. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  110. {
  111. if (CardEffectCommons.IsDPZeroDelete(hashtable))
  112. {
  113. return true;
  114. }
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. if (CardEffectCommons.IsExistOnBattleArea(card))
  123. {
  124. if (card.Owner.LibraryCards.Count >= 1)
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  134. }
  135. }
  136. if (timing == EffectTiming.OnAllyAttack)
  137. {
  138. ActivateClass activateClass = new ActivateClass();
  139. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  140. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  141. activateClass.SetIsInheritedEffect(true);
  142. activateClass.SetHashString("DP-2000_BT12_041");
  143. cardEffects.Add(activateClass);
  144. string EffectDiscription()
  145. {
  146. return "[When Attacking][Once Per Turn] If this Digimon has <Save> in its text, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  147. }
  148. bool CanSelectPermanentCondition(Permanent permanent)
  149. {
  150. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  151. }
  152. bool CanUseCondition(Hashtable hashtable)
  153. {
  154. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  155. }
  156. bool CanActivateCondition(Hashtable hashtable)
  157. {
  158. if (CardEffectCommons.IsExistOnBattleArea(card))
  159. {
  160. if (card.PermanentOfThisCard().TopCard.HasSaveText)
  161. {
  162. return true;
  163. }
  164. }
  165. return false;
  166. }
  167. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  168. {
  169. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  170. {
  171. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  172. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  173. selectPermanentEffect.SetUp(
  174. selectPlayer: card.Owner,
  175. canTargetCondition: CanSelectPermanentCondition,
  176. canTargetCondition_ByPreSelecetedList: null,
  177. canEndSelectCondition: null,
  178. maxCount: maxCount,
  179. canNoSelect: false,
  180. canEndNotMax: false,
  181. selectPermanentCoroutine: SelectPermanentCoroutine,
  182. afterSelectPermanentCoroutine: null,
  183. mode: SelectPermanentEffect.Mode.Custom,
  184. cardEffect: activateClass);
  185. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  186. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  187. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  188. {
  189. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  190. }
  191. }
  192. }
  193. }
  194. return cardEffects;
  195. }
  196. }
  197. }