BT15_045.cs 8.3 KB

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