BT9_084.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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_084 : 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 +", 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 3 or fewer security cards, gain 1 memory. If your opponent has 3 or fewer security cards, 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 (isExistOnField(card))
  37. {
  38. if (card.Owner.CanAddMemory(activateClass))
  39. {
  40. if (card.Owner.SecurityCards.Count <= 3)
  41. {
  42. return true;
  43. }
  44. if (card.Owner.Enemy.SecurityCards.Count <= 3)
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (isExistOnField(card))
  55. {
  56. if (card.Owner.CanAddMemory(activateClass))
  57. {
  58. if (card.Owner.SecurityCards.Count <= 3)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  61. }
  62. if (card.Owner.Enemy.SecurityCards.Count <= 3)
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  65. }
  66. }
  67. }
  68. }
  69. }
  70. if (timing == EffectTiming.OnAllyAttack)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("DP -2000 for Opponent's Security Digimon", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  75. cardEffects.Add(activateClass);
  76. string EffectDiscription()
  77. {
  78. return "[Your Turn] When one of your red or yellow Digimon attacks, you may suspend this Tamer to have all of your opponent's Security Digimon get -2000 DP for the turn.";
  79. }
  80. bool PermanentCondition(Permanent permanent)
  81. {
  82. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  83. {
  84. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  85. {
  86. return true;
  87. }
  88. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  89. {
  90. return true;
  91. }
  92. }
  93. return false;
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.IsExistOnBattleArea(card))
  98. {
  99. if (CardEffectCommons.IsOwnerTurn(card))
  100. {
  101. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. return false;
  108. }
  109. bool CanActivateCondition(Hashtable hashtable)
  110. {
  111. if (CardEffectCommons.IsExistOnBattleArea(card))
  112. {
  113. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  114. {
  115. return true;
  116. }
  117. }
  118. return false;
  119. }
  120. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  121. {
  122. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  123. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeSecurityDigimonCardDPPlayerEffect(
  124. cardCondition: cardSource => cardSource.Owner == card.Owner.Enemy,
  125. changeValue: -2000,
  126. effectDuration: EffectDuration.UntilEachTurnEnd,
  127. activateClass: activateClass));
  128. }
  129. }
  130. if (timing == EffectTiming.SecuritySkill)
  131. {
  132. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  133. }
  134. return cardEffects;
  135. }
  136. }