BT23_070.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Belphemon (X Antibody)
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_070 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Alt Digivolve Cost
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.IsLevel6
  19. && targetPermanent.TopCard.ContainsCardName("Belphemon")
  20. && !targetPermanent.TopCard.HasXAntibodyTraits;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 2,
  25. ignoreDigivolutionRequirement: false,
  26. card: card, condition: null)
  27. );
  28. }
  29. #endregion
  30. #region Rush
  31. if (timing == EffectTiming.None)
  32. {
  33. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. #endregion
  36. #region Piercing
  37. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  38. {
  39. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  40. }
  41. #endregion
  42. #endregion
  43. #region When Digivolving
  44. if (timing == EffectTiming.OnEnterFieldAnyone)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("Delete all highest level digimon, then if with [Belphemon] in name is in sources, attack without suspending", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[When Digivolving] Delete all of your opponent's Digimon with the highest level. Then, if a card with [Belphemon] in its name is in this Digimon's digivolution cards, this Digimon attacks without suspending.";
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  57. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  62. }
  63. bool HasBelphemonInName(CardSource cardSource)
  64. {
  65. return cardSource.ContainsCardName("Belphemon");
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable hashtable)
  68. {
  69. var digimonToDelete = card.Owner.Enemy.GetBattleAreaDigimons().Filter(x => CardEffectCommons.IsMaxLevel(x, card.Owner.Enemy));
  70. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  71. targetPermanents: digimonToDelete,
  72. activateClass: activateClass,
  73. successProcess: null,
  74. failureProcess: null));
  75. var thisPermament = card.PermanentOfThisCard();
  76. if (thisPermament.DigivolutionCards.Any(HasBelphemonInName) && thisPermament.CanAttack(activateClass, withoutTap: true))
  77. {
  78. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  79. selectAttackEffect.SetUp(
  80. attacker: thisPermament,
  81. canAttackPlayerCondition: () => true,
  82. defenderCondition: (permanent) => true,
  83. cardEffect: activateClass);
  84. selectAttackEffect.SetWithoutTap();
  85. selectAttackEffect.SetCanNotSelectNotAttack();
  86. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  87. }
  88. }
  89. }
  90. #endregion
  91. #region End of Attack
  92. if (timing == EffectTiming.OnEndAttack)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect("Digivolve into [Belphemon: Sleep Mode] in trash", CanUseCondition, card);
  96. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. {
  100. return "[End of Attack] This Digimon may digivolve into [Belphemon: Sleep Mode] in the trash, ignoring digivolution requirements and without paying the cost.";
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  105. && CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  110. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsSleepMode);
  111. }
  112. bool IsSleepMode(CardSource cardSource)
  113. {
  114. return cardSource.IsDigimon
  115. && cardSource.EqualsCardName("Belphemon: Sleep Mode");
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsSleepMode)) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  120. targetPermanent: card.PermanentOfThisCard(),
  121. cardCondition: IsSleepMode,
  122. payCost: false,
  123. reduceCostTuple: null,
  124. fixedCostTuple: null,
  125. ignoreDigivolutionRequirementFixedCost: 2,
  126. isHand: false,
  127. activateClass: activateClass,
  128. successProcess: null)
  129. );
  130. }
  131. }
  132. #endregion
  133. return cardEffects;
  134. }
  135. }
  136. }