Callismon_EX8_045.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class Callismon_EX8_045 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsTraits("NSo");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region DNA Digivolution
  29. if (timing == EffectTiming.None)
  30. {
  31. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  32. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  33. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  34. addJogressConditionClass.SetNotShowUI(true);
  35. cardEffects.Add(addJogressConditionClass);
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return true;
  39. }
  40. JogressCondition GetJogress(CardSource cardSource)
  41. {
  42. if (cardSource == card)
  43. {
  44. bool PermanentCondition1(Permanent permanent)
  45. {
  46. if (permanent != null)
  47. {
  48. if (permanent.TopCard != null)
  49. {
  50. if (permanent.TopCard.Owner == card.Owner)
  51. {
  52. if (permanent.IsDigimon)
  53. {
  54. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  55. card))
  56. {
  57. if (permanent.TopCard.CardColors.Contains(CardColor.Green) ||
  58. permanent.TopCard.CardColors.Contains(CardColor.Purple))
  59. {
  60. if (permanent.Levels_ForJogress(card).Contains(5))
  61. {
  62. return true;
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. return false;
  71. }
  72. bool PermanentCondition2(Permanent permanent)
  73. {
  74. if (permanent != null)
  75. {
  76. if (permanent.TopCard != null)
  77. {
  78. if (permanent.TopCard.Owner == card.Owner)
  79. {
  80. if (permanent.IsDigimon)
  81. {
  82. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  83. card))
  84. {
  85. if (permanent.TopCard.CardColors.Contains(CardColor.Red) ||
  86. permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  87. {
  88. if (permanent.Levels_ForJogress(card).Contains(5))
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. }
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. JogressConditionElement[] elements =
  101. {
  102. new(PermanentCondition1, "a level 5 Green or Purple Digimon"),
  103. new(PermanentCondition2, "a level 5 Red or Yellow Digimon")
  104. };
  105. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  106. return jogressCondition;
  107. }
  108. return null;
  109. }
  110. }
  111. #endregion
  112. #region When Digivolving
  113. if (timing == EffectTiming.OnEnterFieldAnyone)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("Suspend and then return Tamer to bottom of deck", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  118. cardEffects.Add(activateClass);
  119. string EffectDescription()
  120. {
  121. return
  122. "[When Digivolving] Suspend 1 of your opponent's Digimon or Tamers. Then, return 1 of their suspended Tamers to the bottom of the deck.";
  123. }
  124. bool CanUseCondition(Hashtable hashtable)
  125. {
  126. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  127. }
  128. bool CanSelectPermanentCondition(Permanent permanent)
  129. {
  130. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  131. (permanent.IsDigimon || permanent.IsTamer);
  132. }
  133. bool CanSelectSuspendedTamerCondition(Permanent permanent)
  134. {
  135. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  136. permanent.IsTamer && permanent.IsSuspended;
  137. }
  138. bool CanActivateCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  141. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  142. }
  143. IEnumerator ActivateCoroutine(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  146. {
  147. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  148. selectPermanentEffect.SetUp(
  149. selectPlayer: card.Owner,
  150. canTargetCondition: CanSelectSuspendedTamerCondition,
  151. canTargetCondition_ByPreSelecetedList: null,
  152. canEndSelectCondition: null,
  153. maxCount: 1,
  154. canNoSelect: false,
  155. canEndNotMax: false,
  156. selectPermanentCoroutine: null,
  157. afterSelectPermanentCoroutine: null,
  158. mode: SelectPermanentEffect.Mode.Tap,
  159. cardEffect: activateClass);
  160. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  161. }
  162. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendedTamerCondition))
  163. {
  164. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  165. selectPermanentEffect.SetUp(
  166. selectPlayer: card.Owner,
  167. canTargetCondition: CanSelectSuspendedTamerCondition,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: 1,
  171. canNoSelect: false,
  172. canEndNotMax: false,
  173. selectPermanentCoroutine: null,
  174. afterSelectPermanentCoroutine: null,
  175. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  176. cardEffect: activateClass);
  177. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  178. }
  179. }
  180. }
  181. #endregion
  182. #region Your Turn
  183. if (timing == EffectTiming.None)
  184. {
  185. int SourceCount()
  186. {
  187. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  188. ? card.PermanentOfThisCard().DigivolutionCardsColors.Count
  189. : 0;
  190. }
  191. bool DPCondition()
  192. {
  193. return CardEffectCommons.IsOwnerTurn(card) &&
  194. CardEffectCommons.IsExistOnBattleAreaDigimon(card) && SourceCount() >= 1;
  195. }
  196. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(changeValue: () => 1000 * SourceCount(),
  197. isInheritedEffect: false,
  198. card: card,
  199. condition: DPCondition));
  200. bool KeywordCondition()
  201. {
  202. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  203. card.PermanentOfThisCard().DP > card.Owner.Enemy.GetBattleAreaDigimons().Map(p => p.DP).Max();
  204. }
  205. cardEffects.Add(CardEffectFactory.PierceSelfEffect(
  206. isInheritedEffect: false,
  207. card: card,
  208. condition: KeywordCondition));
  209. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1,
  210. isInheritedEffect: false,
  211. card: card,
  212. condition: KeywordCondition));
  213. }
  214. #endregion
  215. return cardEffects;
  216. }
  217. }
  218. }