Kyubimon_BT19_034.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT19
  6. {
  7. public class Kyubimon_BT19_034 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region When Digivolving
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Play 1 Tamer with [Rika Nonaka] in its name from hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 [Rika Nonaka] from your hand without paying the cost.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  26. {
  27. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool IsRikaCardCondition(CardSource cardSource)
  35. {
  36. return cardSource.IsTamer && (cardSource.ContainsCardName("Rika Nonaka") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass));
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersHand(card, IsRikaCardCondition) && card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsRikaCardCondition))
  45. {
  46. List<CardSource> selectedCards = new List<CardSource>();
  47. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  48. selectHandEffect.SetUp(
  49. selectPlayer: card.Owner,
  50. canTargetCondition: IsRikaCardCondition,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canEndSelectCondition: null,
  53. maxCount: 1,
  54. canNoSelect: true,
  55. canEndNotMax: false,
  56. isShowOpponent: true,
  57. selectCardCoroutine: SelectCardCoroutine,
  58. afterSelectCardCoroutine: null,
  59. mode: SelectHandEffect.Mode.Custom,
  60. cardEffect: activateClass);
  61. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  62. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  63. yield return StartCoroutine(selectHandEffect.Activate());
  64. IEnumerator SelectCardCoroutine(CardSource cardSource)
  65. {
  66. selectedCards.Add(cardSource);
  67. yield return null;
  68. }
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  70. }
  71. }
  72. }
  73. #endregion
  74. #region Inherit
  75. if (timing == EffectTiming.OnUseOption)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  80. activateClass.SetIsInheritedEffect(true);
  81. activateClass.SetHashString("DP-2000_BT19_030");
  82. cardEffects.Add(activateClass);
  83. string EffectDiscription()
  84. {
  85. return "[Your Turn][Once Per Turn] When you use an Option card with a cost of 2 or more, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  86. }
  87. bool CanSelectPermanentCondition(Permanent permanent)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  94. {
  95. if (CardEffectCommons.IsOwnerTurn(card))
  96. {
  97. if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, (cost) => cost >= 2, card))
  98. {
  99. return true;
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  108. {
  109. return true;
  110. }
  111. return false;
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  116. {
  117. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectPermanentCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: SelectPermanentCoroutine,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Custom,
  130. cardEffect: activateClass);
  131. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  136. }
  137. }
  138. }
  139. }
  140. #endregion
  141. return cardEffects;
  142. }
  143. }
  144. }