AD1_021.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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.CardColors.Contains(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, true, EffectDescription());
  105. activateClass.SetHashString("AD1_021_EoYT");
  106. cardEffects.Add(activateClass);
  107. string EffectDescription()
  108. => "[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.";
  109. bool CanUseCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.IsExistOnBattleArea(card)
  112. && CardEffectCommons.IsOwnerTurn(card);
  113. }
  114. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
  115. bool PermanentCondition(Permanent permanent)
  116. {
  117. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  118. && permanent.TopCard.CardColors.Contains(CardColor.Yellow)
  119. && (permanent.TopCard.ContainsCardName("Agumon") || permanent.TopCard.ContainsCardName("Greymon"));
  120. }
  121. bool CanSelectTamer(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  124. && permanent.TopCard.EqualsCardName("Marcus Damon");
  125. }
  126. bool CanSelectDigimon(Permanent permanent)
  127. {
  128. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  129. && permanent.CanAttack(activateClass);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. bool activated = false;
  134. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  135. {
  136. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: CanSelectTamer,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: 1,
  143. canNoSelect: false,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: SelectPermanentCoroutine,
  146. afterSelectPermanentCoroutine: null,
  147. mode: SelectPermanentEffect.Mode.Custom,
  148. cardEffect: activateClass);
  149. selectPermanentEffect.SetUpCustomMessage("Select 1 [Marcus Damon].", "The opponent is selecting 1 [Marcus Damon].");
  150. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  151. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  152. {
  153. activated = true;
  154. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BecomeDigimonThatCantDigivolve(
  155. targetPermanent: permanent,
  156. DP: 6000,
  157. effectDuration: EffectDuration.UntilEachTurnEnd,
  158. activateClass: activateClass));
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  160. targetPermanent: permanent,
  161. effectDuration: EffectDuration.UntilEachTurnEnd,
  162. activateClass: activateClass));
  163. }
  164. }
  165. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectDigimon))
  166. {
  167. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  168. selectPermanentEffect.SetUp(
  169. selectPlayer: card.Owner,
  170. canTargetCondition: CanSelectDigimon,
  171. canTargetCondition_ByPreSelecetedList: null,
  172. canEndSelectCondition: null,
  173. maxCount: 1,
  174. canNoSelect: true,
  175. canEndNotMax: false,
  176. selectPermanentCoroutine: SelectPermanentCoroutine,
  177. afterSelectPermanentCoroutine: null,
  178. mode: SelectPermanentEffect.Mode.Custom,
  179. cardEffect: activateClass);
  180. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "Opponent is selecting 1 Digimon that will attack.");
  181. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  182. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  183. {
  184. activated = true;
  185. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  186. selectAttackEffect.SetUp(
  187. attacker: permanent,
  188. canAttackPlayerCondition: () => true,
  189. defenderCondition: (_) => true,
  190. cardEffect: activateClass);
  191. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  192. }
  193. }
  194. if (!activated) activateClass.RemoveUse();
  195. }
  196. }
  197. #endregion
  198. #region Security
  199. if (timing == EffectTiming.SecuritySkill)
  200. {
  201. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  202. }
  203. #endregion
  204. return cardEffects;
  205. }
  206. }
  207. }