BT22_012.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // RizeGreymon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_012 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel4 && (targetPermanent.TopCard.ContainsCardName("Greymon") || targetPermanent.TopCard.HasCSTraits);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Raid
  23. if (timing == EffectTiming.OnAllyAttack)
  24. {
  25. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region When Digivolving
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Play either 1 4 cost or less red/black tamer, or 1 [CS] tamer", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 red or black Tamer card with a play cost of 4 or less or 1 Tamer card with the [CS] trait.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  46. && CardEffectCommons.IsOwnerTurn(card)
  47. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectTamer)
  48. && card.Owner.GetBattleAreaPermanents().Filter(x => x.IsTamer).Count <= 1;
  49. }
  50. bool CanSelectTamer(CardSource cardSource)
  51. {
  52. if (cardSource.IsTamer)
  53. {
  54. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass))
  55. {
  56. if (cardSource.BasePlayCostFromEntity <= 4 && (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Black)))
  57. {
  58. return true;
  59. }
  60. if (cardSource.HasCSTraits)
  61. {
  62. return true;
  63. }
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectTamer))
  71. {
  72. CardSource selectedCard = null;
  73. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectTamer));
  74. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  75. selectHandEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectTamer,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: true,
  82. canEndNotMax: false,
  83. isShowOpponent: true,
  84. selectCardCoroutine: SelectCardCoroutine,
  85. afterSelectCardCoroutine: null,
  86. mode: SelectHandEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  89. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  90. yield return StartCoroutine(selectHandEffect.Activate());
  91. IEnumerator SelectCardCoroutine(CardSource cardSource)
  92. {
  93. selectedCard = cardSource;
  94. yield return null;
  95. }
  96. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  97. }
  98. }
  99. }
  100. #endregion
  101. #region ESS
  102. if (timing == EffectTiming.None)
  103. {
  104. bool Condition()
  105. {
  106. return CardEffectCommons.IsExistOnBattleArea(card);
  107. }
  108. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  109. }
  110. #endregion
  111. return cardEffects;
  112. }
  113. }
  114. }