BT12_041.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. yield return GManager.instance.photonWaitController.StartWait("Cho-Hakkaimon");
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  65. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  66. selectPermanentEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: CanSelectPermanentCondition,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: maxCount,
  72. canNoSelect: false,
  73. canEndNotMax: false,
  74. selectPermanentCoroutine: SelectPermanentCoroutine,
  75. afterSelectPermanentCoroutine: null,
  76. mode: SelectPermanentEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. if (timing == EffectTiming.OnDestroyedAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[Your Turn] If an opponent's Digimon is deleted by dropping to 0 DP, <Draw 1>. (Draw 1 card from your deck.)";
  99. }
  100. bool PermanentCondition(Permanent permanent)
  101. {
  102. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. if (CardEffectCommons.IsOwnerTurn(card))
  109. {
  110. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  111. {
  112. if (CardEffectCommons.IsDPZeroDelete(hashtable))
  113. {
  114. return true;
  115. }
  116. }
  117. }
  118. }
  119. return false;
  120. }
  121. bool CanActivateCondition(Hashtable hashtable)
  122. {
  123. if (CardEffectCommons.IsExistOnBattleArea(card))
  124. {
  125. if (card.Owner.LibraryCards.Count >= 1)
  126. {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  135. }
  136. }
  137. if (timing == EffectTiming.OnAllyAttack)
  138. {
  139. ActivateClass activateClass = new ActivateClass();
  140. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  141. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  142. activateClass.SetIsInheritedEffect(true);
  143. activateClass.SetHashString("DP-2000_BT12_041");
  144. cardEffects.Add(activateClass);
  145. string EffectDiscription()
  146. {
  147. 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.";
  148. }
  149. bool CanSelectPermanentCondition(Permanent permanent)
  150. {
  151. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  152. }
  153. bool CanUseCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.IsExistOnBattleArea(card))
  160. {
  161. if (card.PermanentOfThisCard().TopCard.HasSaveText)
  162. {
  163. return true;
  164. }
  165. }
  166. return false;
  167. }
  168. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  169. {
  170. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  171. {
  172. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  173. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: CanSelectPermanentCondition,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: maxCount,
  180. canNoSelect: false,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: SelectPermanentCoroutine,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Custom,
  185. cardEffect: activateClass);
  186. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  187. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  188. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  189. {
  190. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  191. }
  192. }
  193. }
  194. }
  195. return cardEffects;
  196. }
  197. }
  198. }