BT24_010.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Greymon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_010 : 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.HasLevel && targetPermanent.TopCard.IsLevel3
  18. && (targetPermanent.TopCard.ContainsCardName("Agumon") || targetPermanent.TopCard.HasTSTraits);
  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 Blocker
  30. if (timing == EffectTiming.None)
  31. {
  32. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  33. isInheritedEffect: false,
  34. card: card,
  35. condition: null)
  36. );
  37. }
  38. #endregion
  39. #region On Deletion
  40. if (timing == EffectTiming.OnDestroyedAnyone)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("<De-Digivolve 1> 1 of your opponent's digimon", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  45. cardEffects.Add(activateClass);
  46. string EffectDescription()
  47. {
  48. return "[On Deletion] <De-Digivolve 1> 1 of your opponent's Digimon.";
  49. }
  50. bool SelectableOpponentsDigimon(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanActivateOnDeletion(card, activateClass)
  61. && CardEffectCommons.HasMatchConditionPermanent(SelectableOpponentsDigimon);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable hashtable)
  64. {
  65. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  66. selectPermanentEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: SelectableOpponentsDigimon,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: 1,
  72. canNoSelect: false,
  73. canEndNotMax: false,
  74. selectPermanentCoroutine: SelectPermanentCoroutine,
  75. afterSelectPermanentCoroutine: null,
  76. mode: SelectPermanentEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  83. }
  84. }
  85. }
  86. #endregion
  87. #region Raid - ESS
  88. if (timing == EffectTiming.OnAllyAttack)
  89. {
  90. cardEffects.Add(CardEffectFactory.RaidSelfEffect(
  91. isInheritedEffect: true,
  92. card: card,
  93. condition: null)
  94. );
  95. }
  96. #endregion
  97. return cardEffects;
  98. }
  99. }
  100. }