ST13_11.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 ST13_11 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place this Digimon under your Digimon's digivolution cards and your 1 Digimon gains Reboot", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] By placing this Digimon under 1 of your other Digimon that's red or has [Legend-Arms] in its traits as its bottom digivolution card, 1 of your Digimon gains <Reboot> until the end of your opponent's turn. (Unsuspend this Digimon during your opponent's unsuspend phase.)";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent != card.PermanentOfThisCard())
  28. {
  29. if (!permanent.IsToken)
  30. {
  31. if (permanent.TopCard.CardTraits.Contains("Legend-Arms"))
  32. {
  33. return true;
  34. }
  35. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanSelectPermanentCondition1(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  66. {
  67. bool added = false;
  68. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  69. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  70. selectPermanentEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CanSelectPermanentCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount,
  76. canNoSelect: true,
  77. canEndNotMax: false,
  78. selectPermanentCoroutine: SelectPermanentCoroutine,
  79. afterSelectPermanentCoroutine: null,
  80. mode: SelectPermanentEffect.Mode.Custom,
  81. cardEffect: activateClass);
  82. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  85. {
  86. Permanent selectedPermanent = permanent;
  87. if (selectedPermanent != null)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { card.PermanentOfThisCard(), selectedPermanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
  90. if (CardEffectCommons.IsExistOnBattleArea(card))
  91. {
  92. if (selectedPermanent.DigivolutionCards.Contains(card))
  93. {
  94. added = true;
  95. }
  96. }
  97. }
  98. }
  99. if (added)
  100. {
  101. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition1,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: SelectPermanentCoroutine1,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Reboot.", "The opponent is selecting 1 Digimon that will get Reboot.");
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  117. {
  118. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  119. }
  120. }
  121. }
  122. }
  123. }
  124. if (timing == EffectTiming.None)
  125. {
  126. bool Condition()
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. if (CardEffectCommons.IsOpponentTurn(card))
  131. {
  132. if (card.Owner.GetBattleAreaDigimons().Count(permanent => permanent.TopCard.CardTraits.Contains("Legend-Arms") || permanent.TopCard.CardColors.Contains(CardColor.Red)) >= 1)
  133. {
  134. return true;
  135. }
  136. }
  137. }
  138. return false;
  139. }
  140. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  141. }
  142. return cardEffects;
  143. }
  144. }