EX11_061.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_061 : 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 Turn
  14. if (timing == EffectTiming.OnStartMainPhase)
  15. {
  16. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOpponentDigimonEffect(card));
  17. }
  18. #endregion
  19. #region Your Turn
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Suspend tamer, play lvl 3 [Puppet], delete it at end of turns.", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[Your Turn] When any of your Digimon digivolve into a [Puppet] trait Digimon, by suspending this Tamer, you may play 1 level 3 [Puppet] trait Digimon card from your hand without paying the cost. At turn end, delete the Digimon this effect played.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition)
  33. && CardEffectCommons.IsOwnerTurn(card)
  34. && CardEffectCommons.IsExistOnBattleArea(card);
  35. }
  36. bool PermanentCondition (Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  39. && permanent.TopCard.EqualsTraits("Puppet");
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleArea(card)
  44. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  45. }
  46. bool IsLevel3PuppetCardCondition(CardSource cardSource)
  47. {
  48. return cardSource.IsDigimon
  49. && cardSource.IsLevel3
  50. && cardSource.ContainsTraits("Puppet")
  51. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  56. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  57. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsLevel3PuppetCardCondition))
  58. {
  59. List<CardSource> selectedCards = new List<CardSource>();
  60. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  61. selectHandEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: IsLevel3PuppetCardCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: 1,
  67. canNoSelect: true,
  68. canEndNotMax: false,
  69. isShowOpponent: true,
  70. selectCardCoroutine: SelectCardCoroutine,
  71. afterSelectCardCoroutine: null,
  72. mode: SelectHandEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectHandEffect.SetUpCustomMessage("Select 1 Digimon card to play.", "The opponent is selecting 1 Digimon card to play.");
  75. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  76. IEnumerator SelectCardCoroutine(CardSource cardSource)
  77. {
  78. selectedCards.Add(cardSource);
  79. yield return null;
  80. }
  81. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  82. if (selectedCards.Count> 0)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(
  85. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  86. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  87. Permanent playedDigimon = null;
  88. yield return new WaitForSeconds(0.2f);
  89. playedDigimon = selectedCards[0].PermanentOfThisCard();
  90. #region Delete Played Digimon
  91. Permanent selectedPermanent = selectedCards[0].PermanentOfThisCard();
  92. ActivateClass activateClass1 = new ActivateClass();
  93. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition2, card);
  94. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
  95. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  96. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnEndTurn);
  97. bool CanUseCondition2(Hashtable hashtable)
  98. {
  99. return true;
  100. }
  101. bool CanActivateCondition1(Hashtable hashtable)
  102. {
  103. return selectedPermanent.TopCard != null
  104. && selectedPermanent.CanBeDestroyedBySkill(activateClass1)
  105. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass1);
  106. }
  107. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { selectedPermanent }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  110. }
  111. #endregion
  112. }
  113. }
  114. }
  115. }
  116. #endregion
  117. #region Security Skill
  118. if (timing == EffectTiming.SecuritySkill)
  119. {
  120. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  121. }
  122. #endregion
  123. return cardEffects;
  124. }
  125. }
  126. }