BT21_044.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // RizeGreymon
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_044 : 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.EqualsCardName("GeoGreymon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Shared OP/WD
  22. string SharedEffectName = "[Marcus Damon] becomes a Digimon with <Rush> and <Alliance> for turn, then 1 Digimon may attack";
  23. CardEffectFactory.ActivateClassesForSharedEffects
  24. (ref cardEffects, timing, card,
  25. SharedEffectName,
  26. SharedActivateCoroutine,
  27. SharedEffectDescription,
  28. optional: false,
  29. isSkippableFunction: IsSkippable,
  30. onPlay: true,
  31. whenDigivolving: true);
  32. string SharedEffectDescription(string tag) => $"[{tag}] For the turn, 1 of your [Marcus Damon]s is also treated as a 3000 DP Digimon, can't digivolve, and gains <Rush> and <Alliance>. Then, 1 of your Digimon may attack.";
  33. bool IsSkippable(Hashtable hashtable)
  34. {
  35. return !CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectPermanentCondition);
  36. }
  37. bool SharedCanSelectPermanentCondition(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  40. && permanent.TopCard.EqualsCardName("Marcus Damon");
  41. }
  42. bool SharedCanSelectOwnerPermanentCondition(Permanent permanent, ActivateClass activateClass)
  43. {
  44. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  45. && permanent.CanAttack(activateClass);
  46. }
  47. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectPermanentCondition))
  50. {
  51. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect1.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: SharedCanSelectPermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: SelectPermanentCoroutine1,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. selectPermanentEffect1.SetUpCustomMessage("Select 1 [Marcus Damon].", "The opponent is selecting 1 [Marcus Damon].");
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  66. IEnumerator SelectPermanentCoroutine1(Permanent selectedPermanent)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BecomeDigimonThatCantDigivolve(targetPermanent: selectedPermanent, DP: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  70. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  71. }
  72. }
  73. if (CardEffectCommons.HasMatchConditionPermanent(_ => SharedCanSelectOwnerPermanentCondition(_, activateClass)))
  74. {
  75. SelectPermanentEffect selectPermanentEffect2 = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect2.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: _ => SharedCanSelectOwnerPermanentCondition(_, activateClass),
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: 1,
  82. canNoSelect: true,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: null,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Attack,
  87. cardEffect: activateClass);
  88. selectPermanentEffect2.SetUpCustomMessage("Select 1 Digimon that will attack.",
  89. "The opponent is selecting 1 Digimon that will attack.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect2.Activate());
  91. }
  92. }
  93. #endregion
  94. #region Shared AT/Inherit
  95. string SharedEffectDescription1()
  96. {
  97. return "[All Turns][Once Per Turn] When any of your yellow or red Tamers are deleted, you may place 1 [Marcus Damon] from your trash as the top security card.";
  98. }
  99. bool SharedCanActivateCondition1(ActivateClass activateClass)
  100. {
  101. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  102. }
  103. bool SharedCanSelectCardCondition1(CardSource cardSource)
  104. {
  105. return cardSource.EqualsCardName("Marcus Damon");
  106. }
  107. bool SharedPermanentCondition1(Permanent permanent)
  108. {
  109. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card);
  110. }
  111. IEnumerator SharedActivateCoroutine1(ActivateClass activateClass)
  112. {
  113. bool Used = false;
  114. if (card.Owner.CanAddSecurity(activateClass)
  115. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, SharedCanSelectCardCondition1))
  116. {
  117. List<CardSource> selectedCards = new List<CardSource>();
  118. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  119. selectCardEffect.SetUp(
  120. canTargetCondition: SharedCanSelectCardCondition1,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. canNoSelect: () => true,
  124. selectCardCoroutine: SelectCardCoroutine,
  125. afterSelectCardCoroutine: null,
  126. message: "Select 1 [Marcus Damon] to add to security.",
  127. maxCount: 1,
  128. canEndNotMax: false,
  129. isShowOpponent: true,
  130. mode: SelectCardEffect.Mode.Custom,
  131. root: SelectCardEffect.Root.Trash,
  132. customRootCardList: null,
  133. canLookReverseCard: true,
  134. selectPlayer: card.Owner,
  135. cardEffect: activateClass);
  136. selectCardEffect.SetUpCustomMessage("Select 1 card to add to security.", "The opponent is selecting 1 card to add to security.");
  137. selectCardEffect.SetUpCustomMessage_ShowCard("Security Card");
  138. yield return StartCoroutine(selectCardEffect.Activate());
  139. IEnumerator SelectCardCoroutine(CardSource cardSource)
  140. {
  141. selectedCards.Add(cardSource);
  142. yield return null;
  143. }
  144. if (selectedCards.Count >= 1)
  145. {
  146. foreach (CardSource selectedCard in selectedCards)
  147. {
  148. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard));
  149. }
  150. }
  151. }
  152. if (!Used) activateClass.RemoveUse();
  153. }
  154. #endregion
  155. #region All Turns
  156. if (timing == EffectTiming.OnDestroyedAnyone)
  157. {
  158. ActivateClass activateClass = new ActivateClass();
  159. activateClass.SetUpICardEffect("Place 1 [Marcus Damon] on the top of security from trash", CanUseCondition, card);
  160. activateClass.SetUpActivateClass(_ => SharedCanActivateCondition1(activateClass), _ => SharedActivateCoroutine1(activateClass), 1, false, SharedEffectDescription1());
  161. activateClass.SetHashString("BT21_044_AT");
  162. cardEffects.Add(activateClass);
  163. bool CanUseCondition(Hashtable hashtable)
  164. {
  165. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  166. && CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, SharedPermanentCondition1, activateClass);
  167. }
  168. }
  169. #endregion
  170. #region Inherit
  171. if (timing == EffectTiming.OnDestroyedAnyone)
  172. {
  173. ActivateClass activateClass = new ActivateClass();
  174. activateClass.SetUpICardEffect("Place 1 [Marcus Damon] on the top of security from trash", CanUseCondition, card);
  175. activateClass.SetUpActivateClass(_ => SharedCanActivateCondition1(activateClass), _ => SharedActivateCoroutine1(activateClass), 1, false, SharedEffectDescription1());
  176. activateClass.SetIsInheritedEffect(true);
  177. activateClass.SetHashString("BT21_044_Inherited_AT");
  178. cardEffects.Add(activateClass);
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  182. && CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, SharedPermanentCondition1, activateClass);
  183. }
  184. }
  185. #endregion
  186. return cardEffects;
  187. }
  188. }
  189. }