BT24_041.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. // Minervamon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_041 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.IsLevel5
  19. && (targetPermanent.TopCard.EqualsTraits("Beastkin")
  20. || targetPermanent.TopCard.EqualsTraits("Dark Dragon")
  21. || targetPermanent.TopCard.HasTSTraits);
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  24. }
  25. #endregion
  26. #region Reduce Play Cost
  27. if (timing == EffectTiming.None)
  28. {
  29. bool Condition()
  30. {
  31. return CardEffectCommons.HasMatchConditionPermanent(IsIliad);
  32. }
  33. bool IsIliad(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  36. && permanent.TopCard.EqualsTraits("Iliad")
  37. && (permanent.IsDigimon
  38. || permanent.IsTamer);
  39. }
  40. cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
  41. }
  42. #endregion
  43. #region Shared OP / WD/ OD
  44. string SharedEffectName = "May play 1 cost 5- [Iliad], then De-Digivolve 1 Digimon";
  45. string SharedEffectDescription(string tag) => $"[{tag}] You may play 1 play cost 5 or lower [Iliad] trait card from your hand without paying the cost. Then, to 1 of your opponent's Digimon, <De-Digivolve 1> for each of your Digimon.";
  46. bool SharedCanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  49. }
  50. bool CanSelectCardCondition(CardSource cardSource, ActivateClass activateClass)
  51. {
  52. return cardSource.HasPlayCost
  53. && cardSource.GetCostItself <= 5
  54. && cardSource.EqualsTraits("Iliad")
  55. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  56. }
  57. bool CanSelectPermanentCondition(Permanent permanent)
  58. {
  59. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent,card);
  60. }
  61. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  62. {
  63. CardSource selectedCard = null;
  64. int maxCount = Math.Min (1, card.Owner.HandCards.Count(cardSource => CanSelectCardCondition(cardSource, activateClass)));
  65. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  66. selectHandEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: cardSource => CanSelectCardCondition(cardSource, activateClass),
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: maxCount,
  72. canNoSelect: true,
  73. canEndNotMax: false,
  74. isShowOpponent: true,
  75. selectCardCoroutine: SelectCardCoroutine,
  76. afterSelectCardCoroutine: null,
  77. mode: SelectHandEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  80. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  81. yield return StartCoroutine(selectHandEffect.Activate());
  82. IEnumerator SelectCardCoroutine(CardSource cardSource)
  83. {
  84. selectedCard = cardSource;
  85. yield return null;
  86. }
  87. if (selectedCard != null)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  90. }
  91. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  92. {
  93. int deDigiCount = card.Owner.GetBattleAreaDigimons().Count;
  94. SelectPermanentEffect selectDeDigivolvePermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectDeDigivolvePermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: CanSelectPermanentCondition,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: 1,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: DeDigivolvePermanent,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Custom,
  106. cardEffect: activateClass);
  107. yield return ContinuousController.instance.StartCoroutine(selectDeDigivolvePermanentEffect.Activate());
  108. IEnumerator DeDigivolvePermanent(Permanent permanent)
  109. {
  110. for (int i = 0; i < deDigiCount; i++)
  111. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  112. }
  113. }
  114. }
  115. #endregion
  116. #region On Play
  117. if (timing == EffectTiming.OnEnterFieldAnyone)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  121. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  122. cardEffects.Add(activateClass);
  123. bool CanUseCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  126. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  127. }
  128. }
  129. #endregion
  130. #region When Digivolving
  131. if (timing == EffectTiming.OnEnterFieldAnyone)
  132. {
  133. ActivateClass activateClass = new ActivateClass();
  134. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  135. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  136. cardEffects.Add(activateClass);
  137. bool CanUseCondition(Hashtable hashtable)
  138. {
  139. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  140. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  141. }
  142. }
  143. #endregion
  144. #region On Deletion
  145. if (timing == EffectTiming.OnDestroyedAnyone)
  146. {
  147. ActivateClass activateClass = new ActivateClass();
  148. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  149. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Deletion"));
  150. cardEffects.Add(activateClass);
  151. bool CanUseCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  154. }
  155. bool CanActivateCondition(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  158. }
  159. }
  160. #endregion
  161. #region Opponent's Turn
  162. if (timing == EffectTiming.None)
  163. {
  164. bool PermanentCondition(Permanent permanent)
  165. {
  166. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  167. && permanent.TopCard.EqualsTraits("Iliad");
  168. }
  169. bool Condition()
  170. {
  171. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  172. && CardEffectCommons.IsOpponentTurn(card);
  173. }
  174. cardEffects.Add(CardEffectFactory.RebootStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, Condition));
  175. cardEffects.Add(CardEffectFactory.BlockerStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, Condition));
  176. }
  177. #endregion
  178. return cardEffects;
  179. }
  180. }
  181. }