EX3_014.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX3
  6. {
  7. public class EX3_014 : 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. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  15. }
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. int maxDP()
  19. {
  20. int maxDP = 3000;
  21. if (CardEffectCommons.IsExistOnBattleArea(card))
  22. {
  23. maxDP += 2000 * card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasDragonTraits);
  24. }
  25. return maxDP;
  26. }
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[On Play] Delete 1 of your opponent's Digimon with 3000 or less. For each card with [Dragon], [saur] or [Ceratopsian] in one of its traits in this Digimon's digivolution cards, add 2000 DP to the maximum DP you can choose with this effect.";
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  38. {
  39. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(maxDP(), activateClass))
  40. {
  41. return true;
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  64. {
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: null,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Destroy,
  78. cardEffect: activateClass);
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. }
  81. }
  82. }
  83. if (timing == EffectTiming.None)
  84. {
  85. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  86. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  87. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  88. addDigiXrosConditionClass.SetNotShowUI(true);
  89. cardEffects.Add(addDigiXrosConditionClass);
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return true;
  93. }
  94. DigiXrosCondition GetDigiXros(CardSource cardSource)
  95. {
  96. if (cardSource == card)
  97. {
  98. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "1 Digimon card with [Dragon], [saur] or [Ceratopsian] in one of its traits");
  99. bool CanSelectCardCondition(CardSource cardSource)
  100. {
  101. if (cardSource != null)
  102. {
  103. if (cardSource.Owner == card.Owner)
  104. {
  105. if (cardSource.IsDigimon)
  106. {
  107. if (cardSource.HasDragonTraits)
  108. {
  109. return true;
  110. }
  111. }
  112. }
  113. }
  114. return false;
  115. }
  116. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>();
  117. for (int i = 0; i < 5; i++)
  118. {
  119. elements.Add(element);
  120. }
  121. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  122. {
  123. List<string> cardNames = new List<string>();
  124. foreach (CardSource cardSource1 in cardSources)
  125. {
  126. foreach (string cardName in cardSource1.CardNames)
  127. {
  128. if (!cardNames.Contains(cardName))
  129. {
  130. cardNames.Add(cardName);
  131. }
  132. }
  133. }
  134. if (cardSource.CardNames.Count((cardName) => cardNames.Contains(cardName)) >= 1)
  135. {
  136. return false;
  137. }
  138. return true;
  139. }
  140. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, CanTargetCondition_ByPreSelecetedList, 2);
  141. return digiXrosCondition;
  142. }
  143. return null;
  144. }
  145. }
  146. return cardEffects;
  147. }
  148. }
  149. }