EX11_068.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Violet Inboots
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_068 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Main
  14. if (timing == EffectTiming.OnStartTurn)
  15. {
  16. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  17. }
  18. #endregion
  19. #region Your Turn
  20. if (timing == EffectTiming.OnAllyAttack)
  21. {
  22. ActivateClass activateClass = new ();
  23. activateClass.SetUpICardEffect("By suspending this, Draw 1, Trash 1. If using Execute, attacker may digivolve into a Ghost with cost reduced by 2.", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  25. cardEffects.Add(activateClass);
  26. string EffectDescription() => "[Your Turn] When one of your [Ghost] trait Digimon attacks, by suspending this Tamer, <Draw 1> and trash 1 card in your hand. If attacking by <Execute>, it may digivolve into a [Ghost] trait Digimon card in the hand with the digivolution cost reduced by 2.";
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnBattleArea(card)
  30. && CardEffectCommons.IsOwnerTurn(card)
  31. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
  32. }
  33. bool PermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  36. && permanent.TopCard.EqualsTraits("Ghost");
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleArea(card)
  41. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  42. }
  43. bool CardSelectCondition(CardSource cardSource)
  44. {
  45. return cardSource.IsDigimon
  46. && cardSource.EqualsTraits("Ghost");
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  51. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  52. if (card.Owner.HandCards.Count >= 1)
  53. {
  54. int discardCount = 1;
  55. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  56. selectHandEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: (cardSource) => true,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: discardCount,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. isShowOpponent: true,
  65. selectCardCoroutine: null,
  66. afterSelectCardCoroutine: null,
  67. mode: SelectHandEffect.Mode.Discard,
  68. cardEffect: activateClass);
  69. yield return StartCoroutine(selectHandEffect.Activate());
  70. }
  71. ICardEffect triggeringEffect = CardEffectCommons.GetCardEffectFromHashtable(hashtable);
  72. if (triggeringEffect != null && triggeringEffect.EffectName == "Execute")
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  75. targetPermanent: GManager.instance.attackProcess.AttackingPermanent,
  76. cardCondition: CardSelectCondition,
  77. payCost: true,
  78. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  79. fixedCostTuple: null,
  80. ignoreDigivolutionRequirementFixedCost: -1,
  81. isHand: true,
  82. activateClass: activateClass,
  83. successProcess: null
  84. ));
  85. }
  86. }
  87. }
  88. #endregion
  89. #region Security Effect
  90. if (timing == EffectTiming.SecuritySkill)
  91. {
  92. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  93. }
  94. #endregion
  95. return cardEffects;
  96. }
  97. }
  98. }