ST16_03.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ST16_03 : CEntity_Effect
  5. {
  6. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  7. {
  8. List<ICardEffect> cardEffects = new List<ICardEffect>();
  9. if (timing == EffectTiming.None)
  10. {
  11. bool PermanentCondition(Permanent targetPermanent)
  12. {
  13. return targetPermanent.TopCard.CardNames.Contains("Tsunomon");
  14. }
  15. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  16. }
  17. if (timing == EffectTiming.OnStartMainPhase)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (CardEffectCommons.IsOwnerTurn(card))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  43. {
  44. if (card.Owner.CanAddMemory(activateClass))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  55. }
  56. }
  57. if (timing == EffectTiming.OnAllyAttack)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  61. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  62. activateClass.SetIsInheritedEffect(true);
  63. activateClass.SetHashString("Draw_ST16_03");
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[When Attacking][Once Per Turn] <Draw 1>. (Draw 1 card from your deck.) Then, trash 1 card in your hand.";
  68. }
  69. bool CanUseCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  72. }
  73. bool CanActivateCondition(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.IsExistOnBattleArea(card))
  76. {
  77. return true;
  78. }
  79. return false;
  80. }
  81. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  82. {
  83. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  84. if (card.Owner.HandCards.Count >= 1)
  85. {
  86. int discardCount = 1;
  87. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  88. selectHandEffect.SetUp(
  89. selectPlayer: card.Owner,
  90. canTargetCondition: (cardSource) => true,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. maxCount: discardCount,
  94. canNoSelect: false,
  95. canEndNotMax: false,
  96. isShowOpponent: true,
  97. selectCardCoroutine: null,
  98. afterSelectCardCoroutine: null,
  99. mode: SelectHandEffect.Mode.Discard,
  100. cardEffect: activateClass);
  101. yield return StartCoroutine(selectHandEffect.Activate());
  102. }
  103. }
  104. }
  105. return cardEffects;
  106. }
  107. }