EX7_032.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX7
  5. {
  6. public class EX7_032 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Play 1 Tamer with [Shoto Kazama] in its name from hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return
  21. "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 [Shoto Kazama] from your hand without paying the cost.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  26. }
  27. bool IsShotoCardCondition(CardSource cardSource)
  28. {
  29. return cardSource.IsTamer &&
  30. cardSource.EqualsCardName("Shoto Kazama") &&
  31. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  36. CardEffectCommons.HasMatchConditionOwnersHand(card, IsShotoCardCondition) &&
  37. card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsShotoCardCondition))
  42. {
  43. List<CardSource> selectedCards = new List<CardSource>();
  44. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  45. selectHandEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: IsShotoCardCondition,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: 1,
  51. canNoSelect: true,
  52. canEndNotMax: false,
  53. isShowOpponent: true,
  54. selectCardCoroutine: SelectCardCoroutine,
  55. afterSelectCardCoroutine: null,
  56. mode: SelectHandEffect.Mode.Custom,
  57. cardEffect: activateClass);
  58. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  59. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  60. yield return StartCoroutine(selectHandEffect.Activate());
  61. IEnumerator SelectCardCoroutine(CardSource cardSource)
  62. {
  63. selectedCards.Add(cardSource);
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  65. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  66. root: SelectCardEffect.Root.Hand, activateETB: true));
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. #region All Turns - ESS
  73. if (timing == EffectTiming.OnEndBattle)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  78. activateClass.SetIsInheritedEffect(true);
  79. activateClass.SetHashString("Memory+1_EX7_032");
  80. cardEffects.Add(activateClass);
  81. string EffectDescription()
  82. {
  83. return "[All Turns] [Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, gain 1 memory.";
  84. }
  85. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  86. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  90. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  91. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  100. }
  101. }
  102. #endregion
  103. return cardEffects;
  104. }
  105. }
  106. }