BT15_032.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_032 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. //Alternate Evo Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Plesiomon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #region When Attacking/When Digivolving Shared
  27. string EffectSharedDescription()
  28. {
  29. return "[When Digivolving] [When Attacking] [Once per Turn] Return 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the hand.";
  30. }
  31. bool CanSelectPermanentCondition(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count)
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. bool CanActivateSharedCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. #endregion
  54. #region When Digivolving
  55. if (timing == EffectTiming.OnEnterFieldAnyone)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("Return 1 Digimon to hand", CanUseCondition, card);
  59. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, 1, false, EffectSharedDescription());
  60. activateClass.SetHashString("Bounce_BT15_032");
  61. cardEffects.Add(activateClass);
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Bounce,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. }
  86. }
  87. }
  88. #endregion
  89. #region When Attacking
  90. if (timing == EffectTiming.OnAllyAttack)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Return 1 Digimon to hand", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, 1, false, EffectSharedDescription());
  95. activateClass.SetHashString("Bounce_BT15_032");
  96. cardEffects.Add(activateClass);
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  102. {
  103. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  104. {
  105. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. selectPermanentEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: CanSelectPermanentCondition,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: maxCount,
  113. canNoSelect: false,
  114. canEndNotMax: false,
  115. selectPermanentCoroutine: null,
  116. afterSelectPermanentCoroutine: null,
  117. mode: SelectPermanentEffect.Mode.Bounce,
  118. cardEffect: activateClass);
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. }
  121. }
  122. }
  123. #endregion
  124. #region Opponent's Turn
  125. if (timing == EffectTiming.OnAllyAttack)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[Opponent's Turn] When an opponent's Digimon with as many or fewer digivolution cards as this Digimon attacks, if [Plesiomon] or [X Antibody] is in this Digimon's digivolution cards, gain 2 memory.";
  134. }
  135. bool PermanentCondition(Permanent permanent)
  136. {
  137. if (CardEffectCommons.IsOpponentPermanent(permanent, card))
  138. {
  139. if (permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count)
  140. {
  141. return true;
  142. }
  143. }
  144. return false;
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.IsExistOnBattleArea(card))
  149. {
  150. if (CardEffectCommons.IsOpponentTurn(card))
  151. {
  152. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  153. {
  154. return true;
  155. }
  156. }
  157. }
  158. return false;
  159. }
  160. bool CanActivateCondition(Hashtable hashtable)
  161. {
  162. if (CardEffectCommons.IsExistOnBattleArea(card))
  163. {
  164. if (card.Owner.CanAddMemory(activateClass))
  165. {
  166. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Plesiomon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  167. {
  168. return true;
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  175. {
  176. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  177. }
  178. }
  179. #endregion
  180. return cardEffects;
  181. }
  182. }
  183. }