EX9_015.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Gizamon
  5. namespace DCGO.CardEffects.EX9
  6. {
  7. public class EX9_015 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.IsLevel2)
  18. {
  19. if (targetPermanent.TopCard.EqualsTraits("DM"))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  27. permanentCondition: PermanentCondition,
  28. digivolutionCost: 0,
  29. ignoreDigivolutionRequirement: false,
  30. card: card,
  31. condition: null)
  32. );
  33. }
  34. #endregion
  35. #region Training
  36. if (timing == EffectTiming.OnDeclaration)
  37. {
  38. cardEffects.Add(CardEffectFactory.TrainingEffect(card: card));
  39. }
  40. #endregion
  41. #region Inherit
  42. if (timing == EffectTiming.OnAllyAttack)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Trash 1 digivolution card", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  47. activateClass.SetHashString("TrashDigivolutionCard_EX9_015");
  48. activateClass.SetIsInheritedEffect(true);
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[When Attacking][Once Per Turn] Trash the bottom digivolution card of 1 of your opponent's Digimon.";
  53. }
  54. bool CanSelectPermanentCondition(Permanent permanent)
  55. {
  56. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  57. {
  58. return true;
  59. }
  60. return false;
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  65. }
  66. bool CanActivateCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  73. {
  74. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: false,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: SelectPermanentCoroutine,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  89. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  90. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  91. {
  92. Permanent selectedPermanent = permanent;
  93. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 1, isFromTop: false, activateClass: activateClass));
  94. }
  95. }
  96. }
  97. }
  98. #endregion
  99. return cardEffects;
  100. }
  101. }
  102. }