BT22_084.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Nokia Shiramine
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_084 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of your turn
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. #endregion
  18. #region Start of your main phase
  19. if (timing == EffectTiming.OnStartMainPhase)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Play 1 [Agumon] or [Gabumon]", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, _ => SharedActivateCoroutine(activateClass), -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Start of Your Main Phase] If you have 1 or fewer Digimon, you may play 1 [Agumon] or [Gabumon] from your hand without paying the cost.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnField(card) &&
  32. CardEffectCommons.IsOwnerTurn(card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnField(card)
  37. && card.Owner.GetBattleAreaDigimons().Count <= 1;
  38. }
  39. }
  40. #endregion
  41. #region On Play
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Play 1 [Agumon] or [Gabumon]", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, _ => SharedActivateCoroutine(activateClass), -1, true, EffectDiscription());
  47. cardEffects.Add(activateClass);
  48. string EffectDiscription()
  49. {
  50. return "[On Play] If you have 1 or fewer Digimon, you may play 1 [Agumon] or [Gabumon] from your hand without paying the cost.";
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.IsExistOnField(card)
  59. && card.Owner.GetBattleAreaDigimons().Count <= 1;
  60. }
  61. }
  62. #endregion
  63. #region OP/SOYMP Shared
  64. IEnumerator SharedActivateCoroutine(ActivateClass activateClass)
  65. {
  66. bool CanSelectCardCondition(CardSource cardSource)
  67. {
  68. return cardSource.IsDigimon
  69. && (cardSource.EqualsCardName("Agumon") || cardSource.EqualsCardName("Gabumon"))
  70. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  71. }
  72. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  73. {
  74. CardSource selectedCard = null;
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  76. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  77. selectHandEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectCardCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. isShowOpponent: true,
  86. selectCardCoroutine: SelectCardCoroutine,
  87. afterSelectCardCoroutine: null,
  88. mode: SelectHandEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  91. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  92. yield return StartCoroutine(selectHandEffect.Activate());
  93. IEnumerator SelectCardCoroutine(CardSource cardSource)
  94. {
  95. selectedCard = cardSource;
  96. yield return null;
  97. }
  98. 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));
  99. }
  100. }
  101. #endregion
  102. #region All Turns
  103. if (timing == EffectTiming.None)
  104. {
  105. bool Condition()
  106. {
  107. return CardEffectCommons.IsExistOnBattleArea(card);
  108. }
  109. bool PermanentCondition(Permanent permanent)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  112. && (permanent.TopCard.ContainsCardName("Greymon")
  113. || permanent.TopCard.ContainsCardName("Garurumon")
  114. || permanent.TopCard.ContainsCardName("Omnimon"));
  115. }
  116. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  117. permanentCondition: PermanentCondition,
  118. changeValue: 1000,
  119. isInheritedEffect: false,
  120. card: card,
  121. condition: Condition,
  122. effectName: () => "Your Digimon with [Greymon], [Garurumon] or [Omnimon] in their names get +1000 DP"));
  123. }
  124. #endregion
  125. #region Security
  126. if (timing == EffectTiming.SecuritySkill)
  127. {
  128. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  129. }
  130. #endregion
  131. return cardEffects;
  132. }
  133. }
  134. }