EX11_060.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // arisa Kinosaki
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_060 : 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.OnDestroyedAnyone)
  21. {
  22. ActivateClass activateClass = new ();
  23. activateClass.SetUpICardEffect("By suspending this, Draw 1. If deleted by Overclock, you may play 1 level 4 or lower Puppet Digimon from hand.", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  25. cardEffects.Add(activateClass);
  26. string EffectDescription() => "[All Turns] When any of your Tokens or [Puppet] trait Digimon are deleted, by suspending this Tamer, <Draw 1>. If deleted by <Overclock>, you may play 1 level 4 or lower [Puppet] trait Digimon card from your hand without paying the cost.";
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnBattleArea(card)
  30. && CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass);
  31. }
  32. bool PermanentCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  35. && (permanent.IsToken || permanent.TopCard.EqualsTraits("Puppet"));
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleArea(card)
  40. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  41. }
  42. bool CardSelectCondition(CardSource cardSource)
  43. {
  44. return cardSource.IsDigimon
  45. && cardSource.HasLevel
  46. && cardSource.Level <= 4
  47. && cardSource.EqualsTraits("Puppet");
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  52. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  53. ICardEffect triggeringEffect = CardEffectCommons.GetCardEffectFromHashtable(hashtable);
  54. if (triggeringEffect != null
  55. && triggeringEffect.EffectName == "Overclock"
  56. && CardEffectCommons.HasMatchConditionOwnersHand(card, CardSelectCondition))
  57. {
  58. List<CardSource> selectedCards = new List<CardSource>();
  59. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  60. selectHandEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CardSelectCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: 1,
  66. canNoSelect: true,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. mode: SelectHandEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectHandEffect.SetUpCustomMessage("Select 1 digimon to play", "The opponent is selecting 1 digimon to play");
  74. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCards.Add(cardSource);
  78. yield return null;
  79. }
  80. if (selectedCards.Count > 0) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  81. selectedCards,
  82. activateClass: activateClass,
  83. payCost: false,
  84. isTapped: false,
  85. root: SelectCardEffect.Root.Hand,
  86. activateETB: true));
  87. }
  88. }
  89. }
  90. #endregion
  91. #region Security Effect
  92. if (timing == EffectTiming.SecuritySkill)
  93. {
  94. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  95. }
  96. #endregion
  97. return cardEffects;
  98. }
  99. }
  100. }