BT9_087.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 BT9_087 : 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.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Main Phase] If you have a level 5 or higher Digimon in play, gain 1 memory. If your opponent has a level 5 or higher Digimon in play, gain 1 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 (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.CanAddMemory(activateClass))
  39. {
  40. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level >= 5))
  41. {
  42. return true;
  43. }
  44. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level >= 5))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level >= 5))
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  57. }
  58. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level >= 5))
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  61. }
  62. }
  63. }
  64. if (timing == EffectTiming.OnEnterFieldAnyone)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("DP -1000", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[Your Turn] When one of your Digimon digivolves into a yellow or green Digimon, you may suspend this Tamer to have 1 of your opponent's Digimon get -1000 DP until the end of your opponent's turn.";
  73. }
  74. bool CanSelectPermanentCondition(Permanent permanent)
  75. {
  76. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  77. }
  78. bool PermanentCondition(Permanent permanent)
  79. {
  80. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  81. {
  82. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  83. {
  84. return true;
  85. }
  86. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  87. {
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. if (CardEffectCommons.IsOwnerTurn(card))
  98. {
  99. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  100. {
  101. return true;
  102. }
  103. }
  104. }
  105. return false;
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.CanActivateSuspendCostEffect(card);
  110. }
  111. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  112. {
  113. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  114. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  115. {
  116. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  117. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  118. selectPermanentEffect.SetUp(
  119. selectPlayer: card.Owner,
  120. canTargetCondition: CanSelectPermanentCondition,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. maxCount: maxCount,
  124. canNoSelect: false,
  125. canEndNotMax: false,
  126. selectPermanentCoroutine: SelectPermanentCoroutine,
  127. afterSelectPermanentCoroutine: null,
  128. mode: SelectPermanentEffect.Mode.Custom,
  129. cardEffect: activateClass);
  130. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -1000.", "The opponent is selecting 1 Digimon that will get DP -1000.");
  131. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  132. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -1000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  135. }
  136. }
  137. }
  138. }
  139. if (timing == EffectTiming.SecuritySkill)
  140. {
  141. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  142. }
  143. return cardEffects;
  144. }
  145. }