BT23_004.cs 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // DemiMeramon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_004 : 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.OnDestroyedAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("1 [Ghost] trait digimon gains <Blocker> and <Retaliation>", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. activateClass.SetIsInheritedEffect(true);
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Deletion] 1 of your Digimon with the [Ghost] trait gains <Blocker> and <Retaliation> until your opponent's turn ends.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  30. }
  31. bool CanSelectPermanentCondition(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  34. && permanent.TopCard.EqualsTraits("Ghost");
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  39. {
  40. Permanent selectedPermanent = null;
  41. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  42. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  43. selectPermanentEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: CanSelectPermanentCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: maxCount,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. selectPermanentCoroutine: SelectPermanentCoroutine,
  52. afterSelectPermanentCoroutine: null,
  53. mode: SelectPermanentEffect.Mode.Custom,
  54. cardEffect: activateClass);
  55. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  56. {
  57. selectedPermanent = permanent;
  58. yield return null;
  59. }
  60. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Blocker and Retaliation", "The opponent is selecting 1 Digimon that will gain Blocker and Retaliation");
  61. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  62. if (selectedPermanent != null)
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  65. targetPermanent: selectedPermanent,
  66. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  67. activateClass: activateClass));
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRetaliation(
  69. targetPermanent: selectedPermanent,
  70. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  71. activateClass: activateClass));
  72. }
  73. }
  74. }
  75. }
  76. return cardEffects;
  77. }
  78. }
  79. }