EX1_020.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX1
  4. {
  5. public class EX1_020 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Draw 2", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  15. activateClass.SetHashString("Draw2_EX1_020");
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Your Turn][Once Per Turn] When one of your opponent's digivolution cards is trashed, <Draw 2>. (Draw 2 cards from your deck.)";
  20. }
  21. bool PermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.IsExistOnBattleArea(card))
  28. {
  29. if (CardEffectCommons.IsOwnerTurn(card))
  30. {
  31. if (CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, PermanentCondition, cardEffect => true, cardSource => true))
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. return true;
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  50. }
  51. }
  52. if (timing == EffectTiming.None)
  53. {
  54. CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass();
  55. canAttackTargetDefendingPermanentClass.SetUpICardEffect($"Can attack to unsuspended Digimon with no digivolution cards", CanUseCondition, card);
  56. canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass(
  57. attackerCondition: AttackerCondition,
  58. defenderCondition: DefenderCondition,
  59. cardEffectCondition: CardEffectCondition);
  60. cardEffects.Add(canAttackTargetDefendingPermanentClass);
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.IsExistOnBattleArea(card))
  64. {
  65. if (CardEffectCommons.IsOwnerTurn(card))
  66. {
  67. return true;
  68. }
  69. }
  70. return false;
  71. }
  72. bool AttackerCondition(Permanent permanent)
  73. {
  74. return permanent == card.PermanentOfThisCard();
  75. }
  76. bool DefenderCondition(Permanent permanent)
  77. {
  78. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  79. {
  80. if (!permanent.IsSuspended)
  81. {
  82. if (permanent.HasNoDigivolutionCards)
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. return false;
  89. }
  90. bool CardEffectCondition(ICardEffect cardEffect)
  91. {
  92. return true;
  93. }
  94. }
  95. return cardEffects;
  96. }
  97. }
  98. }