BT22_068.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. //BT22 Agumon X-Antibody
  6. namespace DCGO.CardEffects.BT22
  7. {
  8. public class BT22_068 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt digivolution
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent permanent)
  17. {
  18. return permanent.TopCard.EqualsCardName("Agumon") || permanent.TopCard.EqualsCardName("Koromon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 0, false, card, null));
  21. }
  22. #endregion
  23. #region On Play/When Digivolving shared
  24. bool CanActivateConditionShared(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  27. }
  28. bool CanSelectCardCondition(CardSource trashCard)
  29. {
  30. return trashCard.IsDigimon && (trashCard.ContainsCardName("Tyrannomon") || trashCard.EqualsTraits("Dinosaur"));
  31. }
  32. #endregion
  33. #region On Play
  34. if(timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Return Tyranno/Dinosaur", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  39. cardEffects.Add(activateClass);
  40. string EffectDescription() => "[On Play] You may return 1 Digimon card with [Tyrannomon] in its name or the [Dinosaur] trait from your trash to the hand.";
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  48. {
  49. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  50. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  51. selectCardEffect.SetUp(
  52. canTargetCondition: CanSelectCardCondition,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. canNoSelect: () => true,
  56. selectCardCoroutine: null,
  57. afterSelectCardCoroutine: null,
  58. message: "Select 1 card to add to your hand.",
  59. maxCount: maxCount,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. mode: SelectCardEffect.Mode.AddHand,
  63. root: SelectCardEffect.Root.Trash,
  64. customRootCardList: null,
  65. canLookReverseCard: true,
  66. selectPlayer: card.Owner,
  67. cardEffect: activateClass);
  68. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  69. }
  70. }
  71. }
  72. #endregion
  73. #region When Digivolving
  74. if (timing == EffectTiming.OnEnterFieldAnyone)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Return Tyranno/Dinosaur", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  79. cardEffects.Add(activateClass);
  80. string EffectDescription() => "[When Digivolving] You may return 1 Digimon card with [Tyrannomon] in its name or the [Dinosaur] trait from your trash to the hand.";
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable hashtable)
  86. {
  87. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  88. {
  89. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  90. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  91. selectCardEffect.SetUp(
  92. canTargetCondition: CanSelectCardCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. canNoSelect: () => true,
  96. selectCardCoroutine: null,
  97. afterSelectCardCoroutine: null,
  98. message: "Select 1 card to add to your hand.",
  99. maxCount: maxCount,
  100. canEndNotMax: false,
  101. isShowOpponent: true,
  102. mode: SelectCardEffect.Mode.AddHand,
  103. root: SelectCardEffect.Root.Trash,
  104. customRootCardList: null,
  105. canLookReverseCard: true,
  106. selectPlayer: card.Owner,
  107. cardEffect: activateClass);
  108. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  109. }
  110. }
  111. }
  112. #endregion
  113. #region Inherit
  114. if (timing == EffectTiming.OnEndBattle)
  115. {
  116. ActivateClass activateClass = new ActivateClass();
  117. activateClass.SetUpICardEffect("Gain 1 memory", CanUseCondition, card);
  118. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  119. activateClass.SetHashString("Gain1_BT22-068");
  120. activateClass.SetIsInheritedEffect(true);
  121. cardEffects.Add(activateClass);
  122. string EffectDiscription()
  123. {
  124. return "[All Turns] [Once Per Turn] When this Digimon deletes your opponent's Digimon in battle, gain 1 memory.";
  125. }
  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. }