BT11_074.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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_074 : 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("BlackWarGreymon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.None)
  21. {
  22. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  23. }
  24. if (timing == EffectTiming.OnAllyAttack)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Switch attack target to this Digimon", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  29. activateClass.SetHashString("Switch_BT11_074");
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[Opponent's Turn][Once Per Turn] When your opponent's Digimon with the highest DP attacks, you may switch the target of attack to this Digimon.";
  34. }
  35. bool PermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsOpponentPermanent(permanent, card);
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (CardEffectCommons.IsOpponentTurn(card))
  44. {
  45. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  46. {
  47. if (CardEffectCommons.IsMaxDP(GManager.instance.attackProcess.AttackingPermanent, card.Owner.Enemy, null))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (GManager.instance.attackProcess.IsAttacking)
  61. {
  62. if (GManager.instance.attackProcess.AttackingPermanent.CanSwitchAttackTarget)
  63. {
  64. return true;
  65. }
  66. }
  67. }
  68. return false;
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
  73. activateClass,
  74. false,
  75. card.PermanentOfThisCard()));
  76. }
  77. }
  78. if (timing == EffectTiming.OnUnTappedAnyone)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("Delete 1 Digimon with the lowest play cost", CanUseCondition, card);
  82. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  83. activateClass.SetHashString("Delete_BT11_074");
  84. cardEffects.Add(activateClass);
  85. string EffectDiscription()
  86. {
  87. return "[Opponent's Turn][Once Per Turn] When a Digimon becomes unsuspended, if this Digimon has [BlackWarGreymon] or [X Antibody] in its digivolution cards, you may delete 1 of your opponent's Digimon with the lowest play cost.";
  88. }
  89. bool CanSelectPermanentCondition(Permanent permanent)
  90. {
  91. return CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true);
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. if (CardEffectCommons.IsOpponentTurn(card))
  98. {
  99. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, permanent => permanent.IsDigimon))
  100. {
  101. return true;
  102. }
  103. }
  104. }
  105. return false;
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. {
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  112. {
  113. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("BlackWarGreymon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  114. {
  115. return true;
  116. }
  117. }
  118. }
  119. return false;
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  122. {
  123. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  124. {
  125. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  126. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  127. selectPermanentEffect.SetUp(
  128. selectPlayer: card.Owner,
  129. canTargetCondition: CanSelectPermanentCondition,
  130. canTargetCondition_ByPreSelecetedList: null,
  131. canEndSelectCondition: null,
  132. maxCount: maxCount,
  133. canNoSelect: false,
  134. canEndNotMax: false,
  135. selectPermanentCoroutine: null,
  136. afterSelectPermanentCoroutine: null,
  137. mode: SelectPermanentEffect.Mode.Destroy,
  138. cardEffect: activateClass);
  139. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  140. }
  141. }
  142. }
  143. return cardEffects;
  144. }
  145. }
  146. }