P_149.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.P
  4. {
  5. public class P_149 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region When Attacking - ESS
  11. if (timing == EffectTiming.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("By trashing 1 card in hand, Delete opponents level 3 Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("WhenAttacking_P_149");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Attacking] [Once Per Turn] If this Digimon is multicolored, by trashing 1 card in your hand, delete 1 of your opponent's level 3 Digimon.";
  22. }
  23. bool SelectOpponentsLevel3Digimon(Permanent permanent)
  24. {
  25. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if(permanent.Level == 3)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  41. {
  42. if(card.PermanentOfThisCard().TopCard.CardColors.Count > 1)
  43. {
  44. if(card.Owner.HandCards.Count > 0)
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. bool discarded = false;
  55. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  56. selectHandEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: (cardSource) => true,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: true,
  63. canEndNotMax: false,
  64. isShowOpponent: true,
  65. selectCardCoroutine: null,
  66. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  67. mode: SelectHandEffect.Mode.Discard,
  68. cardEffect: activateClass);
  69. yield return StartCoroutine(selectHandEffect.Activate());
  70. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCards)
  71. {
  72. if(selectedCards.Count > 0)
  73. discarded = true;
  74. yield return null;
  75. }
  76. if (discarded)
  77. {
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: SelectOpponentsLevel3Digimon,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: 1,
  85. canNoSelect: false,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: null,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Destroy,
  90. cardEffect: activateClass);
  91. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  92. }
  93. }
  94. }
  95. #endregion
  96. return cardEffects;
  97. }
  98. }
  99. }