BT21_064.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //bt21-064 guilmon
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_064 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Gigimon") || (targetPermanent.Level == 2 && targetPermanent.TopCard.EqualsTraits("Hero"));
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 0,
  21. ignoreDigivolutionRequirement: false,
  22. card: card, condition: null)
  23. );
  24. }
  25. #endregion
  26. #region on play
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Trash 1 [Hero] / gallant line, <Draw 2>", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return "[On Play] By trashing 1 card with [Guilmon], [Growlmon], [Gallantmon] or [Megidramon] in its name or the [Hero] trait from your hand, <Draw 2>.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool HasNameOrTrait(CardSource cardSource)
  42. {
  43. return cardSource.EqualsTraits("Hero")
  44. || cardSource.ContainsCardName("Guilmon")
  45. || cardSource.ContainsCardName("Growlmon")
  46. || cardSource.ContainsCardName("Gallantmon")
  47. || cardSource.ContainsCardName("Megidramon");
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  52. CardEffectCommons.HasMatchConditionOwnersHand(card, HasNameOrTrait);
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  57. bool trashed = false;
  58. selectHandEffect.SetUp(
  59. canTargetCondition: HasNameOrTrait,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. canNoSelect: true,
  63. selectCardCoroutine: SelectCardCoroutine,
  64. afterSelectCardCoroutine: null,
  65. maxCount: 1,
  66. canEndNotMax: false,
  67. isShowOpponent: true,
  68. mode: SelectHandEffect.Mode.Discard,
  69. selectPlayer: card.Owner,
  70. cardEffect: activateClass);
  71. selectHandEffect.SetUpCustomMessage("Select 1 card with the [Hero] trait or guilmon/growlmon/gallantmon/megidramon in name to discard.",
  72. "The opponent is selecting 1 card with the [Hero] trait or guilmon/growlmon/gallantmon/megidramon in name to discard.");
  73. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  74. IEnumerator SelectCardCoroutine(CardSource cardSource)
  75. {
  76. trashed = true;
  77. yield return null;
  78. }
  79. if (trashed)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(
  82. new DrawClass(card.Owner, 2, activateClass).Draw());
  83. }
  84. }
  85. }
  86. #endregion
  87. #region On Deletion inherit
  88. if (timing == EffectTiming.OnDestroyedAnyone)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  93. activateClass.SetIsInheritedEffect(true);
  94. cardEffects.Add(activateClass);
  95. string EffectDescription()
  96. {
  97. return "[On Deletion] Gain 1 memory.";
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  102. }
  103. bool CanActivateCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
  106. {
  107. if (card.Owner.CanAddMemory(activateClass))
  108. {
  109. return true;
  110. }
  111. }
  112. return false;
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  117. }
  118. }
  119. #endregion
  120. return cardEffects;
  121. }
  122. }
  123. }