EX2_045.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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_045 : 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.None)
  13. {
  14. ChangeCostClass changeCostClass = new ChangeCostClass();
  15. changeCostClass.SetUpICardEffect($"Play Cost -2", CanUseCondition, card);
  16. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  17. cardEffects.Add(changeCostClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. if (card.Owner.HandCards.Contains(card))
  21. {
  22. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardNames.Contains("Guilmon")))
  23. {
  24. return true;
  25. }
  26. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardNames.Contains("Terriermon")))
  27. {
  28. return true;
  29. }
  30. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardNames.Contains("Renamon")))
  31. {
  32. return true;
  33. }
  34. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardNames.Contains("Impmon")))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  42. {
  43. if (CardSourceCondition(cardSource))
  44. {
  45. if (RootCondition(root))
  46. {
  47. if (PermanentsCondition(targetPermanents))
  48. {
  49. Cost -= 2;
  50. }
  51. }
  52. }
  53. return Cost;
  54. }
  55. bool PermanentsCondition(List<Permanent> targetPermanents)
  56. {
  57. if (targetPermanents == null)
  58. {
  59. return true;
  60. }
  61. else
  62. {
  63. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  64. {
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. bool CardSourceCondition(CardSource cardSource)
  71. {
  72. return cardSource == card;
  73. }
  74. bool RootCondition(SelectCardEffect.Root root)
  75. {
  76. if (root == SelectCardEffect.Root.Hand)
  77. {
  78. return true;
  79. }
  80. return false;
  81. }
  82. bool isUpDown()
  83. {
  84. return true;
  85. }
  86. }
  87. if (timing == EffectTiming.None)
  88. {
  89. bool Condition()
  90. {
  91. return CardEffectCommons.IsOwnerTurn(card);
  92. }
  93. cardEffects.Add(CardEffectFactory.CanNotAttackSelfStaticEffect(defenderCondition: null, isInheritedEffect: false, card: card, condition: Condition, effectName: "Can't Attack"));
  94. }
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Memory +1, draw 1 and DP +3000", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  100. cardEffects.Add(activateClass);
  101. string EffectDiscription()
  102. {
  103. return "[Your Turn] This Digimon can't attack.[Your Turn] When one of your Digimon digivolves, you may suspend this Digimon to gain 1 memory, <Draw 1> (Draw 1 card from your deck), and have 1 of your Digimon get +3000 DP for the turn.";
  104. }
  105. bool CanSelectPermanentCondition(Permanent permanent)
  106. {
  107. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  108. }
  109. bool PermanentCondition(Permanent permanent)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card);
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleArea(card))
  116. {
  117. if (CardEffectCommons.IsOwnerTurn(card))
  118. {
  119. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  120. {
  121. return true;
  122. }
  123. }
  124. }
  125. return false;
  126. }
  127. bool CanActivateCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.CanActivateSuspendCostEffect(card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  134. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  135. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  136. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  137. {
  138. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  139. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  140. selectPermanentEffect.SetUp(
  141. selectPlayer: card.Owner,
  142. canTargetCondition: CanSelectPermanentCondition,
  143. canTargetCondition_ByPreSelecetedList: null,
  144. canEndSelectCondition: null,
  145. maxCount: maxCount,
  146. canNoSelect: false,
  147. canEndNotMax: false,
  148. selectPermanentCoroutine: SelectPermanentCoroutine,
  149. afterSelectPermanentCoroutine: null,
  150. mode: SelectPermanentEffect.Mode.Custom,
  151. cardEffect: activateClass);
  152. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP +3000.", "The opponent is selecting 1 Digimon that will get DP +3000.");
  153. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  154. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  157. }
  158. }
  159. }
  160. }
  161. return cardEffects;
  162. }
  163. }
  164. }