EX3_014.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Dorbickmon
  6. namespace DCGO.CardEffects.EX3
  7. {
  8. public class EX3_014 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Rush
  14. if (timing == EffectTiming.None)
  15. {
  16. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  17. }
  18. #endregion
  19. #region OP
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. int maxDP()
  23. {
  24. int maxDP = 3000;
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. maxDP += 2000 * card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasDragonTraits);
  28. }
  29. return maxDP;
  30. }
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. 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.";
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  42. {
  43. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(maxDP(), activateClass))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  53. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  62. {
  63. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: CanSelectPermanentCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: null,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.Destroy,
  76. cardEffect: activateClass);
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. }
  80. }
  81. #endregion
  82. #region DigiXros
  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. return cardSource != null
  102. && cardSource.Owner == card.Owner
  103. && cardSource.IsDigimon
  104. && cardSource.HasDragonTraits;
  105. }
  106. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>();
  107. for (int i = 0; i < 5; i++)
  108. {
  109. elements.Add(element);
  110. }
  111. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  112. {
  113. List<string> cardNames = new List<string>();
  114. foreach (CardSource cardSource1 in cardSources)
  115. {
  116. foreach (string cardName in cardSource1.CardNames)
  117. {
  118. if (!cardNames.Contains(cardName))
  119. {
  120. cardNames.Add(cardName);
  121. }
  122. }
  123. }
  124. if (cardSource.CardNames.Count((cardName) => cardNames.Contains(cardName)) >= 1)
  125. {
  126. return false;
  127. }
  128. return true;
  129. }
  130. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, CanTargetCondition_ByPreSelecetedList, 2);
  131. return digiXrosCondition;
  132. }
  133. return null;
  134. }
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }
  140. }