EX2_023.cs 7.9 KB

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