BT6_089.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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_089 : 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 you have fewer security cards than your opponent, 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.SecurityCards.Count < card.Owner.Enemy.SecurityCards.Count)
  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("DP -1000", 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 yellow Digimon attacks, you may suspend this Tamer to have 1 of your opponent's Digimon get -1000 DP for the turn.";
  68. }
  69. bool CanSelectPermanentCondition(Permanent permanent)
  70. {
  71. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  72. }
  73. bool CanUseCondition(Hashtable hashtable)
  74. {
  75. if (isExistOnField(card))
  76. {
  77. if (CardEffectCommons.IsOwnerTurn(card))
  78. {
  79. if (GManager.instance.attackProcess.AttackingPermanent != null)
  80. {
  81. if (GManager.instance.attackProcess.AttackingPermanent.TopCard != null)
  82. {
  83. if (GManager.instance.attackProcess.AttackingPermanent.TopCard.Owner == card.Owner)
  84. {
  85. if (GManager.instance.attackProcess.AttackingPermanent.TopCard.CardColors.Contains(CardColor.Yellow))
  86. {
  87. if (GManager.instance.attackProcess.AttackingPermanent.IsDigimon)
  88. {
  89. return true;
  90. }
  91. }
  92. }
  93. }
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  111. {
  112. if (isExistOnField(card))
  113. {
  114. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  115. {
  116. Hashtable hashtable = new Hashtable();
  117. hashtable.Add("CardEffect", activateClass);
  118. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, hashtable).Tap());
  119. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  120. {
  121. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  122. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  123. selectPermanentEffect.SetUp(
  124. selectPlayer: card.Owner,
  125. canTargetCondition: CanSelectPermanentCondition,
  126. canTargetCondition_ByPreSelecetedList: null,
  127. canEndSelectCondition: null,
  128. maxCount: maxCount,
  129. canNoSelect: false,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: SelectPermanentCoroutine,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.Custom,
  134. cardEffect: activateClass);
  135. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -1000.", "The opponent is selecting 1 Digimon that will get DP -1000.");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -1000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. if (timing == EffectTiming.SecuritySkill)
  147. {
  148. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  149. }
  150. return cardEffects;
  151. }
  152. }