BT9_089.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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_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.OnUnTappedAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[All Turns] When an opponent's Digimon becomes unsuspended during a main phase, you may suspend this Tamer to gain 1 memory.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (GManager.instance.turnStateMachine.gameContext.TurnPhase == GameContext.phase.Main)
  32. {
  33. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, PermanentCondition))
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  55. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  56. }
  57. }
  58. if (timing == EffectTiming.OnEnterFieldAnyone)
  59. {
  60. ActivateClass activateClass = new ActivateClass();
  61. activateClass.SetUpICardEffect("Your Digimon gets Blocker", CanUseCondition, card);
  62. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[Your Turn] When one of your Digimon digivolves into a black level 6 Digimon, it gains <Blocker> until the end of your opponent's turn. (When an opponent's Digimon attacks, you may suspend this Digimon to force the opponent to attack it instead.)";
  67. }
  68. bool PermanentCondition(Permanent permanent)
  69. {
  70. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  71. {
  72. if (permanent.Level == 6)
  73. {
  74. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  75. {
  76. return true;
  77. }
  78. }
  79. }
  80. return false;
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleArea(card))
  85. {
  86. if (CardEffectCommons.IsOwnerTurn(card))
  87. {
  88. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  101. hashtable: hashtable,
  102. rootCondition: null);
  103. if (permanents.Count(permanent => CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) >= 1)
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  111. {
  112. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  113. hashtable: _hashtable,
  114. rootCondition: null);
  115. foreach (Permanent permanent in permanents)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  118. targetPermanent: permanent,
  119. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  120. activateClass: activateClass));
  121. }
  122. }
  123. }
  124. if (timing == EffectTiming.SecuritySkill)
  125. {
  126. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  127. }
  128. return cardEffects;
  129. }
  130. }