BT15_073.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT15
  4. {
  5. public class BT15_073 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region When Digivolving/On Deletion Shared
  11. string EffectDiscription()
  12. {
  13. return "[When Digivolving] [On Deletion] <Draw 1>. Then, trash 1 card in your hand.";
  14. }
  15. #endregion
  16. #region When Digivolving
  17. if (timing == EffectTiming.OnEnterFieldAnyone)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  32. return true;
  33. }
  34. return false;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  39. if (card.Owner.HandCards.Count >= 1)
  40. {
  41. int discardCount = 1;
  42. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  43. selectHandEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: (cardSource) => true,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: discardCount,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. isShowOpponent: true,
  52. selectCardCoroutine: null,
  53. afterSelectCardCoroutine: null,
  54. mode: SelectHandEffect.Mode.Discard,
  55. cardEffect: activateClass);
  56. yield return StartCoroutine(selectHandEffect.Activate());
  57. }
  58. }
  59. }
  60. #endregion
  61. #region On Deletion
  62. if (timing == EffectTiming.OnDestroyedAnyone)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  66. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  67. cardEffects.Add(activateClass);
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  75. {
  76. return true;
  77. }
  78. return false;
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  83. if (card.Owner.HandCards.Count >= 1)
  84. {
  85. int discardCount = 1;
  86. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  87. selectHandEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: (cardSource) => true,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: discardCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. isShowOpponent: true,
  96. selectCardCoroutine: null,
  97. afterSelectCardCoroutine: null,
  98. mode: SelectHandEffect.Mode.Discard,
  99. cardEffect: activateClass);
  100. yield return StartCoroutine(selectHandEffect.Activate());
  101. }
  102. }
  103. }
  104. #endregion
  105. if (timing == EffectTiming.OnDestroyedAnyone)
  106. {
  107. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  108. }
  109. return cardEffects;
  110. }
  111. }
  112. }