BT6_091.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 BT6_091 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Turn] If your opponent doesn't have a level 4 or lower Digimon in play, gain 2 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (CardEffectCommons.IsOwnerTurn(card))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (isExistOnField(card))
  37. {
  38. if (card.Owner.Enemy.GetBattleAreaDigimons().Count((permanent) => permanent.Level <= 4 && permanent.TopCard.HasLevel) == 0)
  39. {
  40. if (card.Owner.CanAddMemory(activateClass))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. if (isExistOnField(card))
  51. {
  52. if (card.Owner.CanAddMemory(activateClass))
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  55. }
  56. }
  57. }
  58. }
  59. if (timing == EffectTiming.OnAllyAttack)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  63. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[Your Turn] When one of your purple Digimon attacks, you may suspend this Tamer to trigger <Draw 1>. (Draw 1 card from your deck.) Then, trash 1 card in your hand.";
  68. }
  69. bool CanUseCondition(Hashtable hashtable)
  70. {
  71. if (isExistOnField(card))
  72. {
  73. if (CardEffectCommons.IsOwnerTurn(card))
  74. {
  75. if (GManager.instance.attackProcess.AttackingPermanent != null)
  76. {
  77. if (GManager.instance.attackProcess.AttackingPermanent.TopCard != null)
  78. {
  79. if (GManager.instance.attackProcess.AttackingPermanent.TopCard.Owner == card.Owner)
  80. {
  81. if (GManager.instance.attackProcess.AttackingPermanent.TopCard.CardColors.Contains(CardColor.Purple))
  82. {
  83. if (GManager.instance.attackProcess.AttackingPermanent.IsDigimon)
  84. {
  85. return true;
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. }
  93. return false;
  94. }
  95. bool CanActivateCondition(Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.IsExistOnBattleArea(card))
  98. {
  99. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  100. {
  101. return true;
  102. }
  103. }
  104. return false;
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  107. {
  108. if (isExistOnField(card))
  109. {
  110. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  113. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  114. if (card.Owner.HandCards.Count >= 1)
  115. {
  116. int discardCount = 1;
  117. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  118. selectHandEffect.SetUp(
  119. selectPlayer: card.Owner,
  120. canTargetCondition: (cardSource) => true,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. maxCount: discardCount,
  124. canNoSelect: false,
  125. canEndNotMax: false,
  126. isShowOpponent: true,
  127. selectCardCoroutine: null,
  128. afterSelectCardCoroutine: null,
  129. mode: SelectHandEffect.Mode.Discard,
  130. cardEffect: activateClass);
  131. yield return StartCoroutine(selectHandEffect.Activate());
  132. }
  133. }
  134. }
  135. }
  136. }
  137. if (timing == EffectTiming.SecuritySkill)
  138. {
  139. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  140. }
  141. return cardEffects;
  142. }
  143. }