BT16_022.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class BT16_022 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. var cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Patamon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 2,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region Armor Purge
  27. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  28. {
  29. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  30. }
  31. #endregion
  32. #region When Attacking
  33. if (timing == EffectTiming.OnAllyAttack)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Trash digivolution cards & Security Attack -1", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return
  42. "[When Attacking] Trash any 1 digivolution card of 1 of your opponent's Digimon. Then, 1 of their Digimon with no " +
  43. "digivolution cards gains <Security Attack -1> until the end of their turn.";
  44. }
  45. bool CanSelectPermanentTrashCondition(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  48. }
  49. bool CanSelectPermanentDebuffCondition(Permanent permanent)
  50. {
  51. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  52. permanent.DigivolutionCards.Count == 0;
  53. }
  54. bool CanSelectCardCondition(CardSource cardSource)
  55. {
  56. return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentTrashCondition))
  67. {
  68. return true;
  69. }
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentDebuffCondition))
  71. {
  72. return true;
  73. }
  74. }
  75. return false;
  76. }
  77. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  80. permanentCondition: CanSelectPermanentTrashCondition,
  81. cardCondition: CanSelectCardCondition,
  82. maxCount: 1,
  83. canNoTrash: false,
  84. isFromOnly1Permanent: true,
  85. activateClass: activateClass
  86. ));
  87. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentDebuffCondition))
  88. {
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectPermanentDebuffCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: 1,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(
  106. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  107. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  108. }
  109. }
  110. }
  111. }
  112. #endregion
  113. return cardEffects;
  114. }
  115. }
  116. }