AD1_021.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Marcus Damon & Agumon
  6. namespace DCGO.CardEffects.AD1
  7. {
  8. public class AD1_021 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Name Rule
  14. if (timing == EffectTiming.None)
  15. {
  16. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  17. changeCardNamesClass.SetUpICardEffect("Also treated as [Marcus Damon]", CanUseCondition, card);
  18. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  19. cardEffects.Add(changeCardNamesClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return true;
  23. }
  24. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  25. {
  26. if (cardSource == card)
  27. {
  28. CardNames.Add("Marcus Damon");
  29. }
  30. return CardNames;
  31. }
  32. }
  33. #endregion
  34. #region Your Turn
  35. if (timing == EffectTiming.OnTappedAnyone)
  36. {
  37. ActivateClass activateClass = new ActivateClass();
  38. activateClass.SetUpICardEffect("Draw 1, 1 Digimon may digivolve into a yellow Digimon with [Greymon] in name for -3", CanUseCondition, card);
  39. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  40. cardEffects.Add(activateClass);
  41. string EffectDescription()
  42. => "[Your Turn] When this Tamer suspends, <Draw 1>. Then, 1 of your Digimon may digivolve into a yellow Digimon card with [Greymon] in its name in the hand with the digivolution cost reduced by 3.";
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleArea(card)
  46. && CardEffectCommons.IsOwnerTurn(card)
  47. && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
  50. bool CanSelectDigimonCondition(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  53. && CardEffectCommons.HasMatchConditionOwnersHand(card, cardSource => CanSelectGreymonCard(cardSource)
  54. && cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
  55. }
  56. bool CanSelectGreymonCard(CardSource cardSource)
  57. {
  58. return cardSource.HasCardColor(CardColor.Yellow)
  59. && cardSource.ContainsCardName("Greymon");
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable hashtable)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  64. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectDigimonCondition))
  65. {
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectDigimonCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: 1,
  73. canNoSelect: true,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: SelectPermanentCoroutine,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "The opponent is selecting 1 Digimon to digivolve.");
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  82. {
  83. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  84. targetPermanent: permanent,
  85. cardCondition: CanSelectGreymonCard,
  86. payCost: true,
  87. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  88. fixedCostTuple: null,
  89. ignoreDigivolutionRequirementFixedCost: -1,
  90. isHand: true,
  91. activateClass,
  92. successProcess: null
  93. ));
  94. }
  95. }
  96. }
  97. }
  98. #endregion
  99. #region End of Your Turn
  100. if (timing == EffectTiming.OnEndTurn)
  101. {
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect("1 Marcus Damon is also a 6k Digimon, gains Rush & can't digivolve. Then, 1 of your Digimon may attack", CanUseCondition, card);
  104. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  105. activateClass.SetIsSkippableFunction(IsSkippable);
  106. activateClass.SetHashString("AD1_021_EoYT");
  107. cardEffects.Add(activateClass);
  108. string EffectDescription()
  109. => "[End of Your Turn] [Once Per Turn] If you have a yellow Digimon with [Agumon] or [Greymon] in its name, for the turn, 1 of your [Marcus Damon]s is treated as a 6000 DP Digimon, gains <Rush> and can't digivolve. Then, 1 of your Digimon may attack.";
  110. bool CanUseCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleArea(card)
  113. && CardEffectCommons.IsOwnerTurn(card);
  114. }
  115. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
  116. bool IsSkippable(Hashtable hashtable) => !CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
  117. bool PermanentCondition(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  120. && permanent.TopCard.CardColors.Contains(CardColor.Yellow)
  121. && (permanent.TopCard.ContainsCardName("Agumon") || permanent.TopCard.ContainsCardName("Greymon"));
  122. }
  123. bool CanSelectTamer(Permanent permanent)
  124. {
  125. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  126. && permanent.TopCard.EqualsCardName("Marcus Damon");
  127. }
  128. bool CanSelectDigimon(Permanent permanent)
  129. {
  130. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  131. && permanent.CanAttack(activateClass);
  132. }
  133. IEnumerator ActivateCoroutine(Hashtable hashtable)
  134. {
  135. bool activated = false;
  136. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  137. {
  138. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  139. selectPermanentEffect.SetUp(
  140. selectPlayer: card.Owner,
  141. canTargetCondition: CanSelectTamer,
  142. canTargetCondition_ByPreSelecetedList: null,
  143. canEndSelectCondition: null,
  144. maxCount: 1,
  145. canNoSelect: false,
  146. canEndNotMax: false,
  147. selectPermanentCoroutine: SelectPermanentCoroutine,
  148. afterSelectPermanentCoroutine: null,
  149. mode: SelectPermanentEffect.Mode.Custom,
  150. cardEffect: activateClass);
  151. selectPermanentEffect.SetUpCustomMessage("Select 1 [Marcus Damon].", "The opponent is selecting 1 [Marcus Damon].");
  152. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  153. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  154. {
  155. activated = true;
  156. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BecomeDigimonThatCantDigivolve(
  157. targetPermanent: permanent,
  158. DP: 6000,
  159. effectDuration: EffectDuration.UntilEachTurnEnd,
  160. activateClass: activateClass));
  161. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  162. targetPermanent: permanent,
  163. effectDuration: EffectDuration.UntilEachTurnEnd,
  164. activateClass: activateClass));
  165. }
  166. }
  167. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectDigimon))
  168. {
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectDigimon,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: 1,
  176. canNoSelect: true,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: SelectPermanentCoroutine,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.Custom,
  181. cardEffect: activateClass);
  182. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "Opponent is selecting 1 Digimon that will attack.");
  183. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  184. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  185. {
  186. activated = true;
  187. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  188. selectAttackEffect.SetUp(
  189. attacker: permanent,
  190. canAttackPlayerCondition: () => true,
  191. defenderCondition: (_) => true,
  192. cardEffect: activateClass);
  193. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  194. }
  195. }
  196. if (!activated) activateClass.RemoveUse();
  197. }
  198. }
  199. #endregion
  200. #region Security
  201. if (timing == EffectTiming.SecuritySkill)
  202. {
  203. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  204. }
  205. #endregion
  206. return cardEffects;
  207. }
  208. }
  209. }