BT17_053.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_053 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Opponenets Turn
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Digivole Into [Infermon]", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Opponent's Turn] When an opponent's Digimon is played or digivolves, if that Digimon is level 5 or higher, this Digimon may digivolve into [Infermon] in the hand ignoring its digivolution requirements and without paying the cost.";
  21. }
  22. bool HasInfermonInHand (CardSource source)
  23. {
  24. return source.EqualsCardName("Infermon");
  25. }
  26. bool OpponentPermanentCondition (Permanent permanent)
  27. {
  28. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  29. {
  30. if(permanent.TopCard.HasLevel && permanent.Level >= 5)
  31. return true;
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsOpponentTurn(card))
  38. {
  39. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, OpponentPermanentCondition))
  40. return true;
  41. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, OpponentPermanentCondition))
  42. return true;
  43. }
  44. return false;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  49. {
  50. if(CardEffectCommons.HasMatchConditionOwnersHand(card, HasInfermonInHand))
  51. {
  52. return true;
  53. }
  54. }
  55. return false;
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  60. targetPermanent: card.PermanentOfThisCard(),
  61. cardCondition: HasInfermonInHand,
  62. payCost: false,
  63. reduceCostTuple: null,
  64. fixedCostTuple: null,
  65. ignoreDigivolutionRequirementFixedCost: 0,
  66. isHand: true,
  67. activateClass: activateClass,
  68. successProcess: null));
  69. }
  70. }
  71. #endregion
  72. #region On Deletion - ESS
  73. if (timing == EffectTiming.OnDestroyedAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Play 1 [Diaboromon] Token", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  78. activateClass.SetIsInheritedEffect(true);
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[On Deletion] If this card has the [Unidentified] trait, you may play 1 [Diaboromon] (Digimon | 14 Cost | Level 6 | White | Mega | Unknown | Unidentified | DP3000) Token without paying the cost.";
  83. }
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  87. }
  88. bool CanActivateCondition(Hashtable hashtable)
  89. {
  90. if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
  91. {
  92. if (CardEffectCommons.CanActivateSelfOnDeletionWithContainingTrait(hashtable, "Unidentified", card))
  93. {
  94. if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame()) >= 1)
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable hashtable)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayDiaboromonToken(activateClass));
  103. }
  104. }
  105. #endregion
  106. return cardEffects;
  107. }
  108. }
  109. }