BT17_046.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT17
  4. {
  5. public class BT17_046 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Deletion
  11. if (timing == EffectTiming.OnDestroyedAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Play 1 [Terriermon]", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Deletion] You may play 1 [Terriermon] from your trash without paying the cost.";
  20. }
  21. bool IsTerriermon(CardSource source)
  22. {
  23. if (source.EqualsCardName("Terriermon"))
  24. {
  25. if (CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass, SelectCardEffect.Root.Trash))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  39. {
  40. if(CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsTerriermon))
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable hashtable)
  48. {
  49. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  50. selectCardEffect.SetUp(
  51. canTargetCondition: IsTerriermon,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. canNoSelect: () => true,
  55. selectCardCoroutine: null,
  56. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  57. message: "Select 1 card to play",
  58. maxCount: 1,
  59. canEndNotMax: false,
  60. isShowOpponent: false,
  61. mode: SelectCardEffect.Mode.Custom,
  62. root: SelectCardEffect.Root.Trash,
  63. customRootCardList: null,
  64. canLookReverseCard: true,
  65. selectPlayer: card.Owner,
  66. cardEffect: activateClass);
  67. yield return StartCoroutine(selectCardEffect.Activate());
  68. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  69. {
  70. if(cardSources != null)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  73. cardSources: cardSources,
  74. activateClass: activateClass,
  75. payCost: false,
  76. isTapped: false,
  77. root: SelectCardEffect.Root.Trash,
  78. activateETB: true));
  79. }
  80. }
  81. }
  82. }
  83. #endregion
  84. #region All Turns - ESS
  85. if (timing == EffectTiming.None)
  86. {
  87. bool Condition()
  88. {
  89. if (CardEffectCommons.IsExistOnBattleArea(card))
  90. {
  91. if (card.PermanentOfThisCard().IsSuspended)
  92. {
  93. return true;
  94. }
  95. }
  96. return false;
  97. }
  98. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  99. }
  100. #endregion
  101. return cardEffects;
  102. }
  103. }
  104. }