BT22_032.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // ShoeShoemon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_032 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Deletion
  13. if (timing == EffectTiming.OnDestroyedAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Play 1 level 3 [Puppet] digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Deletion] You may play 1 level 3 Digimon card with the [Puppet] trait from your hand without paying the cost.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanActivateOnDeletion(card, activateClass)
  30. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsPuppetLevel3Card);
  31. }
  32. bool IsPuppetLevel3Card(CardSource cardSource)
  33. {
  34. return CardEffectCommons.IsExistOnHand(cardSource)
  35. && cardSource.IsDigimon
  36. && cardSource.HasLevel && cardSource.IsLevel3
  37. && cardSource.HasPuppetTraits;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsPuppetLevel3Card))
  42. {
  43. CardSource selectedCard = null;
  44. #region Select Puppet in Hand
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsPuppetLevel3Card));
  46. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  47. selectHandEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: IsPuppetLevel3Card,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: true,
  54. canEndNotMax: false,
  55. isShowOpponent: true,
  56. selectCardCoroutine: SelectCardCoroutine,
  57. afterSelectCardCoroutine: null,
  58. mode: SelectHandEffect.Mode.Custom,
  59. cardEffect: activateClass);
  60. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  61. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  62. yield return StartCoroutine(selectHandEffect.Activate());
  63. IEnumerator SelectCardCoroutine(CardSource cardSource)
  64. {
  65. selectedCard = cardSource;
  66. yield return null;
  67. }
  68. #endregion
  69. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  70. }
  71. }
  72. }
  73. #endregion
  74. #region ESS
  75. if (timing == EffectTiming.OnAllyAttack)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("-2K DP", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  80. activateClass.SetHashString("BT22_032_WA");
  81. activateClass.SetIsInheritedEffect(true);
  82. cardEffects.Add(activateClass);
  83. string EffectDiscription()
  84. {
  85. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  86. }
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  90. }
  91. bool CanActivateCondition(Hashtable hashtable)
  92. {
  93. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  94. }
  95. bool IsOpponentDigimon(Permanent permanent)
  96. {
  97. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  98. }
  99. IEnumerator ActivateCoroutine(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon))
  102. {
  103. Permanent selectedPermament = null;
  104. #region Select Permanent
  105. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentDigimon));
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. selectPermanentEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: IsOpponentDigimon,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: maxCount,
  113. canNoSelect: false,
  114. canEndNotMax: false,
  115. selectPermanentCoroutine: SelectPermanentCoroutine,
  116. afterSelectPermanentCoroutine: null,
  117. mode: SelectPermanentEffect.Mode.Custom,
  118. cardEffect: activateClass);
  119. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  120. {
  121. selectedPermament = permanent;
  122. yield return null;
  123. }
  124. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -2K DP", "The opponent is selecting 1 Digimon to -2K DP");
  125. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  126. #endregion
  127. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  128. targetPermanent: selectedPermament,
  129. changeValue: -2000,
  130. effectDuration: EffectDuration.UntilEachTurnEnd,
  131. activateClass: activateClass
  132. ));
  133. }
  134. }
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }
  140. }