BT17_064.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_064 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Patamon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
  20. card: card, condition: null));
  21. }
  22. #endregion
  23. #region Armor Purge
  24. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  25. {
  26. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  27. }
  28. #endregion
  29. #region When Digivolving
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Trash 2 bottom digivolution cards", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  35. cardEffects.Add(activateClass);
  36. string EffectDescription()
  37. {
  38. return "[When Digivolving] Trash 2 digivolution card from the bottom of 1 of your opponent's Digimon.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  43. }
  44. bool CanSelectPermanentCondition(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectPermanentCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectPermanentCoroutine,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.",
  71. "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. yield return ContinuousController.instance.StartCoroutine(
  76. CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  77. targetPermanent: permanent,
  78. trashCount: 2,
  79. isFromTop: false,
  80. activateClass: activateClass));
  81. }
  82. }
  83. }
  84. }
  85. #endregion
  86. #region Your Turn
  87. if (timing == EffectTiming.OnAllyAttack)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Delete Digimon with no digivolution cards", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  92. cardEffects.Add(activateClass);
  93. string EffectDescription()
  94. {
  95. return "[Your Turn] When this Digimon attacks an opponent's Digimon with no digivolution cards, delete that Digimon.";
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) &&
  100. CardEffectCommons.IsOwnerTurn(card) &&
  101. CardEffectCommons.IsPermanentExistsOnBattleArea(GManager.instance.attackProcess.DefendingPermanent) &&
  102. GManager.instance.attackProcess.DefendingPermanent.HasNoDigivolutionCards;
  103. }
  104. bool CanActivateCondition(Hashtable hashtable)
  105. {
  106. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  107. CardEffectCommons.IsPermanentExistsOnBattleArea(GManager.instance.attackProcess.DefendingPermanent) &&
  108. GManager.instance.attackProcess.DefendingPermanent.HasNoDigivolutionCards &&
  109. GManager.instance.attackProcess.DefendingPermanent.CanBeDestroyedBySkill(activateClass) &&
  110. !GManager.instance.attackProcess.DefendingPermanent.TopCard.CanNotBeAffected(activateClass);
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable hashtable)
  113. {
  114. Permanent permanent = GManager.instance.attackProcess.DefendingPermanent;
  115. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  116. new List<Permanent>() { permanent },
  117. CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  118. }
  119. }
  120. #endregion
  121. return cardEffects;
  122. }
  123. }
  124. }