EX2_046.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_046 : 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. ChangeCostClass changeCostClass = new ChangeCostClass();
  14. changeCostClass.SetUpICardEffect($"Play Cost -2", CanUseCondition, card);
  15. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  16. cardEffects.Add(changeCostClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. if (card.Owner.HandCards.Contains(card))
  20. {
  21. if (card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent != card.PermanentOfThisCard() && permanent.TopCard.CardNames.Contains("ADR-02Searcher")) == 0)
  22. {
  23. if (card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent != card.PermanentOfThisCard() && permanent.TopCard.CardNames.Contains("ADR-02 Searcher")) == 0)
  24. {
  25. return true;
  26. }
  27. }
  28. }
  29. return false;
  30. }
  31. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  32. {
  33. if (CardSourceCondition(cardSource))
  34. {
  35. if (RootCondition(root))
  36. {
  37. if (PermanentsCondition(targetPermanents))
  38. {
  39. Cost -= 2;
  40. }
  41. }
  42. }
  43. return Cost;
  44. }
  45. bool PermanentsCondition(List<Permanent> targetPermanents)
  46. {
  47. if (targetPermanents == null)
  48. {
  49. return true;
  50. }
  51. else
  52. {
  53. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. bool CardSourceCondition(CardSource cardSource)
  61. {
  62. return cardSource == card;
  63. }
  64. bool RootCondition(SelectCardEffect.Root root)
  65. {
  66. if (root == SelectCardEffect.Root.Hand)
  67. {
  68. return true;
  69. }
  70. return false;
  71. }
  72. bool isUpDown()
  73. {
  74. return true;
  75. }
  76. }
  77. if (timing == EffectTiming.None)
  78. {
  79. bool DefenderCondition(Permanent permanent)
  80. {
  81. return permanent == null;
  82. }
  83. bool Condition()
  84. {
  85. return CardEffectCommons.IsOwnerTurn(card);
  86. }
  87. cardEffects.Add(CardEffectFactory.CanNotAttackSelfStaticEffect(defenderCondition: DefenderCondition, isInheritedEffect: false, card: card, condition: Condition, effectName: "Can't Attack to player"));
  88. }
  89. if (timing == EffectTiming.OnEnterFieldAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[On Play] Trigger <Draw 1>. (Draw 1 card from your deck.)";
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  102. }
  103. bool CanActivateCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (card.Owner.LibraryCards.Count >= 1)
  108. {
  109. return true;
  110. }
  111. }
  112. return false;
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  117. }
  118. }
  119. /*if (timing == EffectTiming.None)
  120. {
  121. bool Condition()
  122. {
  123. if (CardEffectCommons.IsExistOnBattleArea(card))
  124. {
  125. if (CardEffectCommons.IsOwnerTurn(card))
  126. {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. bool PermanentCondition(Permanent permanent)
  133. {
  134. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  135. {
  136. if (permanent.TopCard.CardTraits.Contains("D-Reaper"))
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  144. permanentCondition: PermanentCondition,
  145. changeValue: 1000,
  146. isInheritedEffect: true,
  147. card: card,
  148. condition: Condition,
  149. effectName: () => "Your Digimon with [D-Reaper] in their traits gain DP +1000"));
  150. }*/
  151. #region All Turns - ESS
  152. if (timing != EffectTiming.None)
  153. {
  154. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  155. {
  156. Permanent thisPermanent = card.PermanentOfThisCard();
  157. if (Condition())
  158. {
  159. foreach(Permanent permanent in card.Owner.GetBattleAreaPermanents().Filter(PermanentCondition))
  160. permanent.AddBoost(new Permanent.DPBoost($"EX2_046_{card.GetInstanceID()}", 1000, Condition));
  161. }
  162. else
  163. {
  164. foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents().Filter(PermanentCondition))
  165. permanent.RemoveBoost($"EX2_046_{card.GetInstanceID()}");
  166. }
  167. }
  168. bool PermanentCondition(Permanent permanent)
  169. {
  170. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  171. {
  172. if (permanent.TopCard.CardTraits.Contains("D-Reaper"))
  173. {
  174. return true;
  175. }
  176. }
  177. return false;
  178. }
  179. bool Condition()
  180. {
  181. return CardEffectCommons.IsExistOnBattleArea(card) &&
  182. CardEffectCommons.IsOwnerTurn(card) &&
  183. card.PermanentOfThisCard().DigivolutionCards.Contains(card);
  184. }
  185. }
  186. #endregion
  187. return cardEffects;
  188. }
  189. }
  190. }