BT11_015.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_015 : 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. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Shoutmon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.None)
  21. {
  22. ChangeCardNamesForDigiXrosClass changeCardNamesForDigiXrosClass = new ChangeCardNamesForDigiXrosClass();
  23. changeCardNamesForDigiXrosClass.SetUpICardEffect("Also treated as [Shoutmon] when DigiXros", CanUseCondition, card);
  24. changeCardNamesForDigiXrosClass.SetUpChangeCardNamesForDigiXrosClass(changeCardNames: changeCardNames);
  25. cardEffects.Add(changeCardNamesForDigiXrosClass);
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return true;
  29. }
  30. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  31. {
  32. if (cardSource == card)
  33. {
  34. CardNames.Add("Shoutmon");
  35. }
  36. return CardNames;
  37. }
  38. }
  39. if (timing == EffectTiming.OnEnterFieldAnyone)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Delete Digimon with 4000 DP or less", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  44. cardEffects.Add(activateClass);
  45. string EffectDiscription()
  46. {
  47. return "[When Digivolving] Delete 1 of your opponent's Digimon with 4000 DP or less. If [Shoutmon] is in this Digimon's digivolution cards, delete 2 of your opponent's Digimon with 4000 DP or less instead.";
  48. }
  49. bool CanSelectPermanentCondition(Permanent permanent)
  50. {
  51. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  52. {
  53. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  78. {
  79. int maxCount = Math.Min(card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Shoutmon")) >= 1 ? 2 : 1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  80. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  81. selectPermanentEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectPermanentCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: maxCount,
  87. canNoSelect: false,
  88. canEndNotMax: false,
  89. selectPermanentCoroutine: null,
  90. afterSelectPermanentCoroutine: null,
  91. mode: SelectPermanentEffect.Mode.Destroy,
  92. cardEffect: activateClass);
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. }
  95. }
  96. }
  97. if (timing == EffectTiming.OnDestroyedAnyone)
  98. {
  99. cardEffects.Add(CardEffectFactory.SaveEffect(card: card));
  100. }
  101. if (timing == EffectTiming.None)
  102. {
  103. bool Condition()
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (CardEffectCommons.IsOwnerTurn(card))
  108. {
  109. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Shoutmon"))
  110. {
  111. return true;
  112. }
  113. }
  114. }
  115. return false;
  116. }
  117. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  118. }
  119. return cardEffects;
  120. }
  121. }
  122. }