BT22_070.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //BT22 Darktyrannomon x
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_070 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alt digivolution
  13. if(timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent permanent)
  16. {
  17. return permanent.TopCard.IsLevel4 &&
  18. permanent.TopCard.ContainsCardName("Tyrannomon") &&
  19. !permanent.TopCard.HasXAntibodyTraits;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 0, false, card, null));
  22. }
  23. #endregion
  24. #region When Digivolving
  25. if(timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Delete level 4 or lower", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  30. cardEffects.Add(activateClass);
  31. string EffectDescription() => "[When Digivolving] If [DarkTyrannomon] or [X Antibody] is in this Digimon's digivolution cards, delete 1 of your opponent's level 4 or lower Digimon.";
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  35. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  36. }
  37. bool PermanentCondition(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.Level <= 4;
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  44. CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition) &&
  45. card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("DarkTyrannomon") || cardSource.EqualsCardName("X Antibody")) >= 1;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  50. {
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: PermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: null,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Destroy,
  63. cardEffect: activateClass);
  64. selectPermanentEffect.SetUpCustomMessage(
  65. "Select 1 opposing Digimon to delete.",
  66. "The opponent is selecting 1 of your Digimon to delete");
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. }
  69. }
  70. }
  71. #endregion
  72. #region When attacking
  73. if (timing == EffectTiming.OnAllyAttack)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("This Digimon digivolves", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  78. cardEffects.Add(activateClass);
  79. string EffectDescription() =>
  80. "[When Attacking] This Digimon may digivolve into a Digimon card with [Tyrannomon] in its name or the [Dinosaur] trait in the hand.";
  81. bool CanSelectCardCondition(CardSource cardSource)
  82. {
  83. return cardSource.IsDigimon && (cardSource.ContainsCardName("Tyrannomon") || cardSource.EqualsTraits("Dinosaur"));
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  88. }
  89. bool CanActivateCondition(Hashtable hashtable)
  90. {
  91. if (CardEffectCommons.IsExistOnBattleArea(card))
  92. {
  93. if (card.Owner.HandCards.Count >= 1)
  94. {
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  103. targetPermanent: card.PermanentOfThisCard(),
  104. cardCondition: CanSelectCardCondition,
  105. payCost: true,
  106. reduceCostTuple: null,
  107. fixedCostTuple: null,
  108. ignoreDigivolutionRequirementFixedCost: -1,
  109. isHand: true,
  110. activateClass: activateClass,
  111. successProcess: null));
  112. }
  113. }
  114. #endregion
  115. #region Inherit
  116. if (timing == EffectTiming.OnEndBattle)
  117. {
  118. ActivateClass activateClass = new ActivateClass();
  119. activateClass.SetUpICardEffect("Gain 1 memory", CanUseCondition, card);
  120. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  121. activateClass.SetHashString("Gain1_BT22-070");
  122. activateClass.SetIsInheritedEffect(true);
  123. cardEffects.Add(activateClass);
  124. string EffectDescription() =>
  125. "[All Turns] [Once Per Turn] When this Digimon deletes your opponent's Digimon in battle, gain 1 memory.";
  126. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  127. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  131. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  132. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  137. {
  138. return true;
  139. }
  140. return false;
  141. }
  142. IEnumerator ActivateCoroutine(Hashtable hashtable)
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  145. }
  146. }
  147. #endregion
  148. return cardEffects;
  149. }
  150. }
  151. }