BT22_101.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Kyoko Kuremi
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_101 : 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 Turn
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. #endregion
  18. #region All Turns
  19. if (timing == EffectTiming.OnDestroyedAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Suspend tamer, add 1 [CS] digimon from trash to hand", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[All Turns] When any of your level 4 or higher [CS] trait Digimon are deleted, by suspending this Tamer, return 1 [CS] trait Digimon card from your trash to the hand.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, IsValidPermament, activateClass);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleArea(card)
  36. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  37. }
  38. bool IsValidPermament(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  41. permanent.TopCard.HasLevel && permanent.TopCard.Level >= 4 &&
  42. permanent.TopCard.HasCSTraits;
  43. }
  44. bool isValidCard(CardSource cardSource)
  45. {
  46. return cardSource.IsDigimon && cardSource.HasCSTraits;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(
  51. new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, hashtable).Tap());
  52. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, isValidCard))
  53. {
  54. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, isValidCard));
  55. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  56. selectCardEffect.SetUp(
  57. canTargetCondition: isValidCard,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. canNoSelect: () => false,
  61. selectCardCoroutine: null,
  62. afterSelectCardCoroutine: null,
  63. message: "Select 1 digimon to add to your hand.",
  64. maxCount: maxCount,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. mode: SelectCardEffect.Mode.AddHand,
  68. root: SelectCardEffect.Root.Trash,
  69. customRootCardList: null,
  70. canLookReverseCard: true,
  71. selectPlayer: card.Owner,
  72. cardEffect: activateClass);
  73. selectCardEffect.SetUpCustomMessage("Select 1 [CS] digimon to add to hand", "The opponent is selecting 1 digimon to add to hand");
  74. selectCardEffect.SetUpCustomMessage_ShowCard("Selected digimon");
  75. yield return StartCoroutine(selectCardEffect.Activate());
  76. }
  77. }
  78. }
  79. #endregion
  80. #region Your Turn
  81. if (timing == EffectTiming.OnUnTappedAnyone)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("Digivolve into [Alphamon] for 2 reduced cost", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  86. activateClass.SetHashString("BT22_101_Digivolve");
  87. cardEffects.Add(activateClass);
  88. string EffectDiscription()
  89. {
  90. return "[Your Turn] [Once Per Turn] When this Tamer unsuspends, if you don't have [Alphamon], this Tamer may digivolve into [Alphamon] in the hand with the digivolution cost reduced by 2.";
  91. }
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, IsKyokoKuremi);
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleArea(card)
  99. && CardEffectCommons.IsOwnerTurn(card)
  100. && !CardEffectCommons.HasMatchConditionOwnersPermanent(card, perm => IsAlphaMon(perm.TopCard))
  101. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsAlphaMon);
  102. }
  103. bool IsKyokoKuremi(Permanent permanent)
  104. {
  105. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  106. && permanent == card.PermanentOfThisCard();
  107. }
  108. bool IsAlphaMon(CardSource cardSource)
  109. {
  110. return cardSource.EqualsCardName("Alphamon");
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable hashtable)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(
  115. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  116. targetPermanent: card.PermanentOfThisCard(),
  117. cardCondition: IsAlphaMon,
  118. payCost: true,
  119. reduceCostTuple: (2, null),
  120. fixedCostTuple: null,
  121. ignoreDigivolutionRequirementFixedCost: -1,
  122. isHand: true,
  123. activateClass: activateClass,
  124. successProcess: null));
  125. }
  126. }
  127. #endregion
  128. #region Security
  129. if (timing == EffectTiming.SecuritySkill)
  130. {
  131. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  132. }
  133. #endregion
  134. return cardEffects;
  135. }
  136. }
  137. }