EX8_056.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_056 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.EqualsTraits("DS");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 0,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region On Deletion
  27. if (timing == EffectTiming.OnDestroyedAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return "[On Deletion] <Draw 1> and trash 1 card in your hand.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnDeletion(hashtable,card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return true;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. if (card.Owner.LibraryCards.Count >= 1)
  48. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  49. if (card.Owner.HandCards.Count >= 1)
  50. {
  51. int discardCount = 1;
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: (cardSource) => true,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: discardCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: null,
  64. mode: SelectHandEffect.Mode.Discard,
  65. cardEffect: activateClass);
  66. yield return StartCoroutine(selectHandEffect.Activate());
  67. }
  68. }
  69. }
  70. #endregion
  71. #region When Attacking - ESS
  72. if (timing == EffectTiming.OnAllyAttack)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("Delete opponents level 3 Digimon", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  77. activateClass.SetIsInheritedEffect(true);
  78. activateClass.SetHashString("WhenAttacking_EX8_056");
  79. cardEffects.Add(activateClass);
  80. string EffectDescription()
  81. {
  82. return "[When Attacking] [Once Per Turn] Delete 1 of your opponent's level 3 Digimon.";
  83. }
  84. bool SelectOpponentsLevel3Digimon(Permanent permanent)
  85. {
  86. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  87. {
  88. if(permanent.Level == 3)
  89. {
  90. return true;
  91. }
  92. }
  93. return false;
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  102. {
  103. return true;
  104. }
  105. return false;
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable hashtable)
  108. {
  109. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: SelectOpponentsLevel3Digimon,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: 1,
  116. canNoSelect: false,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: null,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.Destroy,
  121. cardEffect: activateClass);
  122. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  123. }
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }