Bakemon_BT15_073.cs 5.0 KB

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