BT10_085.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_085 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Your 1 Digimon can digivolve to 1 [Royal Knight] card from hand", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] If it's your turn, 1 of your Digimon may digivolve into a Digimon card with [Royal Knight] in its traits in your hand for its digivolution cost.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  28. {
  29. foreach (CardSource cardSource in card.Owner.HandCards)
  30. {
  31. if (CanSelectCardCondition(cardSource))
  32. {
  33. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, true, activateClass))
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanSelectCardCondition(CardSource cardSource)
  43. {
  44. return cardSource.IsDigimon && cardSource.HasRoyalKnightTraits;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. if (CardEffectCommons.IsOwnerTurn(card))
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  65. {
  66. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  67. {
  68. Permanent selectedPermanent = null;
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: true,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "The opponent is selecting 1 Digimon to digivolve.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. selectedPermanent = permanent;
  88. yield return null;
  89. }
  90. if (selectedPermanent != null)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  93. targetPermanent: selectedPermanent,
  94. cardCondition: CanSelectCardCondition,
  95. payCost: true,
  96. reduceCostTuple: null,
  97. fixedCostTuple: null,
  98. ignoreDigivolutionRequirementFixedCost: -1,
  99. isHand: true,
  100. activateClass: activateClass,
  101. successProcess: null));
  102. }
  103. }
  104. }
  105. }
  106. if (timing == EffectTiming.OnEnterFieldAnyone)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  111. activateClass.SetHashString("Memory+1_BT10_085");
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[Your Turn][Once Per Turn] When one of your Digimon digivolves into a Digimon with [Huckmon] in its name or [Royal Knight] in its traits, gain 1 memory.";
  116. }
  117. bool PermanentCondition(Permanent permanent)
  118. {
  119. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  120. {
  121. if (permanent.TopCard.ContainsCardName("Huckmon"))
  122. {
  123. return true;
  124. }
  125. if (permanent.TopCard.HasRoyalKnightTraits)
  126. {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.IsExistOnBattleArea(card))
  135. {
  136. if (CardEffectCommons.IsOwnerTurn(card))
  137. {
  138. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  139. {
  140. return true;
  141. }
  142. }
  143. }
  144. return false;
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.IsExistOnBattleArea(card))
  149. {
  150. return true;
  151. }
  152. return false;
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  157. }
  158. }
  159. return cardEffects;
  160. }
  161. }
  162. }