EX12_028.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Gusokumon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_028 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("DS");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 3,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null,
  24. level: 4)
  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. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  47. && (permanent.TopCard.CardColors.Contains(CardColor.Blue)
  48. || permanent.TopCard.CardColors.Contains(CardColor.Purple))
  49. && permanent.Levels_ForJogress(card).Contains(4);
  50. }
  51. bool PermanentCondition2(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  54. && (permanent.TopCard.CardColors.Contains(CardColor.Black)
  55. || permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  56. && permanent.Levels_ForJogress(card).Contains(4);
  57. }
  58. JogressConditionElement[] elements = new JogressConditionElement[]
  59. {
  60. new JogressConditionElement(PermanentCondition1, "a level 4 Blue or Purple Digimon"),
  61. new JogressConditionElement(PermanentCondition2, "a level 4 Black or Yellow Digimon"),
  62. };
  63. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  64. return jogressCondition;
  65. }
  66. return null;
  67. }
  68. }
  69. #endregion
  70. #region Blocker
  71. if (timing == EffectTiming.None)
  72. {
  73. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  74. }
  75. #endregion
  76. #region Decode
  77. if (timing == EffectTiming.WhenRemoveField)
  78. {
  79. bool SourceCondition(CardSource cardSource)
  80. {
  81. return cardSource.IsDigimon
  82. && cardSource.HasLevel
  83. && cardSource.Level <= 4
  84. && cardSource.EqualsTraits("DS");
  85. }
  86. string[] decodeStrings = { "(Lv.4 or lower w/[DS] trait)", "Level 4 or lower Digimon card with [DS] trait" };
  87. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  88. }
  89. #endregion
  90. #region All Turns
  91. if (timing == EffectTiming.OnAllyAttack)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("You may DNA digivolve. Then you may change the attack target to 1 Digimon.", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  96. activateClass.SetIsSkippable(true);
  97. activateClass.SetHashString("EX12_028_AT");
  98. cardEffects.Add(activateClass);
  99. string EffectDescription()
  100. => "[All Turns] [Once Per Turn] When a Digimon attacks, by placing 1 [DS] trait Digimon card from your hand as this Digimon's bottom digivolution card, <De-Digivolve 1> 1 of your opponent's Digimon. After, if you have 0 or less memory, gain 1 memory.";
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  104. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
  105. }
  106. bool PermanentCondition(Permanent permanent)
  107. {
  108. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass)
  113. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  114. }
  115. bool CanSelectCardCondition(CardSource cardSource)
  116. {
  117. return cardSource.EqualsTraits("DS");
  118. }
  119. bool CanSelectPermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  120. IEnumerator ActivateCoroutine(Hashtable hashtable)
  121. {
  122. bool isUsed = false;
  123. List<CardSource> selectedCards = new List<CardSource>();
  124. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  125. selectHandEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: CanSelectCardCondition,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: 1,
  131. canNoSelect: true,
  132. canEndNotMax: false,
  133. isShowOpponent: true,
  134. selectCardCoroutine: SelectCardCoroutine,
  135. afterSelectCardCoroutine: null,
  136. mode: SelectHandEffect.Mode.Custom,
  137. cardEffect: activateClass);
  138. IEnumerator SelectCardCoroutine(CardSource cardSource)
  139. {
  140. selectedCards.Add(cardSource);
  141. yield return null;
  142. }
  143. selectHandEffect.SetUpCustomMessage("Select 1 card to place.", "Opponent is selecting 1 card to place under.");
  144. yield return StartCoroutine(selectHandEffect.Activate());
  145. if (selectedCards.Count > 0)
  146. {
  147. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  148. isUsed = true;
  149. }
  150. if (isUsed)
  151. {
  152. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  153. {
  154. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  155. selectPermanentEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectPermanentCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: 1,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: null,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.Degenerate,
  166. cardEffect: activateClass);
  167. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to <De-Digivolve 1>", "The opponent is selecting 1 Digimon to <De-Digivolve 1>");
  168. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  169. }
  170. if(card.Owner.MemoryForPlayer <= 0)
  171. {
  172. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  173. }
  174. }
  175. else activateClass.RemoveUse();
  176. }
  177. }
  178. #endregion
  179. #region Inherited
  180. if (timing == EffectTiming.OnAllyAttack)
  181. {
  182. ActivateClass activateClass = new ActivateClass();
  183. activateClass.SetUpICardEffect("May change the attack target to 1 [DS] Digimon.", CanUseCondition, card);
  184. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  185. activateClass.SetHashString("EX12_028_Inherited");
  186. activateClass.SetIsInheritedEffect(true);
  187. cardEffects.Add(activateClass);
  188. string EffectDescription()
  189. => "[Opponent's Turn] [Once Per Turn] When one of your opponent's Digimon attacks, you may change the attack target to 1 of your [DS] trait Digimon.";
  190. bool CanUseCondition(Hashtable hashtable)
  191. {
  192. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  193. && CardEffectCommons.IsOpponentTurn(card)
  194. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
  195. }
  196. bool PermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  197. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass);
  198. bool CanSelectPermanentCondition(Permanent permanent)
  199. {
  200. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  201. && permanent.TopCard.EqualsTraits("DS");
  202. }
  203. IEnumerator ActivateCoroutine(Hashtable hashtable)
  204. {
  205. Permanent selectedPermanent = null;
  206. SelectPermanentEffect selectPermanentEffect =
  207. GManager.instance.GetComponent<SelectPermanentEffect>();
  208. selectPermanentEffect.SetUp(
  209. selectPlayer: card.Owner,
  210. canTargetCondition: CanSelectPermanentCondition,
  211. canTargetCondition_ByPreSelecetedList: null,
  212. canEndSelectCondition: null,
  213. maxCount: 1,
  214. canNoSelect: true,
  215. canEndNotMax: false,
  216. selectPermanentCoroutine: SelectPermanentCoroutine,
  217. afterSelectPermanentCoroutine: null,
  218. mode: SelectPermanentEffect.Mode.Custom,
  219. cardEffect: activateClass);
  220. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to change the attack target to.", "The opponent is selecting 1 Digimon to change the attack target to.");
  221. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  222. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  223. {
  224. selectedPermanent = permanent;
  225. yield return null;
  226. }
  227. if (selectedPermanent != null)
  228. {
  229. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
  230. activateClass,
  231. false,
  232. selectedPermanent));
  233. }
  234. }
  235. }
  236. #endregion
  237. return cardEffects;
  238. }
  239. }
  240. }