EX1_019.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX1
  5. {
  6. public class EX1_019 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] If a Digimon card with [Free] in its traits is in this Digimon's digivolution cards, unsuspend this Digimon.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.IsExistOnBattleArea(card))
  28. {
  29. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  30. {
  31. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.IsDigimon && cardSource.CardTraits.Contains("Free")) >= 1)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  40. {
  41. Permanent selectedPermanent = card.PermanentOfThisCard();
  42. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  43. }
  44. }
  45. if (timing == EffectTiming.None)
  46. {
  47. bool Condition()
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (CardEffectCommons.IsOwnerTurn(card))
  52. {
  53. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Imperialdramon"))
  54. {
  55. return true;
  56. }
  57. }
  58. }
  59. return false;
  60. }
  61. cardEffects.Add(CardEffectFactory.CanNotBeBlockedStaticSelfEffect(
  62. defenderCondition: null,
  63. isInheritedEffect: true,
  64. card: card,
  65. condition: Condition,
  66. effectName: "Unblockable"));
  67. }
  68. return cardEffects;
  69. }
  70. }
  71. }