BT23_051.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Golemon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_051 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasCSTraits
  18. && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel3;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 2,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Alliance
  30. if (timing == EffectTiming.OnAllyAttack)
  31. {
  32. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  33. }
  34. #endregion
  35. #region Blocker
  36. if (timing == EffectTiming.None)
  37. {
  38. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  39. }
  40. #endregion
  41. #region Your Turn - Cant Attack Digimon
  42. if (timing == EffectTiming.None)
  43. {
  44. bool DefenderCondition(Permanent defender)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(defender, card);
  47. }
  48. bool Condition()
  49. {
  50. return CardEffectCommons.IsOwnerTurn(card);
  51. }
  52. cardEffects.Add(CardEffectFactory.CanNotAttackSelfStaticEffect(defenderCondition: DefenderCondition, isInheritedEffect: false, card: card, condition: Condition, effectName: "Can't Attack to Digimon"));
  53. }
  54. #endregion
  55. #region All Turns - OPT
  56. if (timing == EffectTiming.OnTappedAnyone)
  57. {
  58. ActivateClass activateClass = new ActivateClass();
  59. activateClass.SetUpICardEffect("Delete 1 4K DP or less digimon", CanUseCondition, card);
  60. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  61. activateClass.SetHashString("BT23_051_AT");
  62. cardEffects.Add(activateClass);
  63. string EffectDiscription()
  64. {
  65. return "[All Turns] [Once Per Turn] When this Digimon suspends, delete 1 of your opponent's Digimon with 4000 DP or less.";
  66. }
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  70. && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  75. }
  76. bool CanSelectPermamentCondition(Permanent permanent)
  77. {
  78. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  79. && permanent.HasDP
  80. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass);
  81. }
  82. IEnumerator ActivateCoroutine(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermamentCondition))
  85. {
  86. #region Select Permanent & Destroy
  87. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  88. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermamentCondition));
  89. selectPermanentEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition: CanSelectPermamentCondition,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. maxCount: maxCount,
  95. canNoSelect: false,
  96. canEndNotMax: false,
  97. selectPermanentCoroutine: null,
  98. afterSelectPermanentCoroutine: null,
  99. mode: SelectPermanentEffect.Mode.Destroy,
  100. cardEffect: activateClass);
  101. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to destroy", "The opponent is selecting 1 digimon to destroy");
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. #endregion
  104. }
  105. }
  106. }
  107. #endregion
  108. return cardEffects;
  109. }
  110. }
  111. }