EX9_068.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX9
  6. {
  7. public class EX9_068 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Your Turn
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. #endregion
  18. #region Your Turn
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. List<Permanent> playedPermanent = new List<Permanent>();
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Draw 1 and gain 1 memory. Then place one digimon face down as a source.", 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 play cost 7 or higher [Cyborg], [Machine] or [DM] trait Digimon are played, by suspending this Tamer, <Draw 1> and gain 1 memory. Then, you may place 1 card from your hand face down as any of those Digimon's bottom digivolution card.";
  29. }
  30. bool EnterFieldPermanent(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  33. permanent.IsDigimon && permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself >= 7 &&
  34. (permanent.TopCard.EqualsTraits("Cyborg") || permanent.TopCard.EqualsTraits("Machine") || permanent.TopCard.EqualsTraits("DM")) &&
  35. playedPermanent.Contains(permanent);
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. List<Hashtable> hash = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
  40. hash.ForEach(x =>
  41. playedPermanent.Add(CardEffectCommons.GetPermanentFromHashtable(x))
  42. );
  43. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, EnterFieldPermanent);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. return isExistOnField(card) && CardEffectCommons.CanActivateSuspendCostEffect(card);
  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. if (card.Owner.LibraryCards.Count >= 1)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  55. }
  56. if (card.Owner.CanAddMemory(activateClass))
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  59. }
  60. if (card.Owner.HandCards.Any())
  61. {
  62. CardSource selectedCard = null;
  63. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  64. selectHandEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: (cardSource) => true,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: 1,
  70. canNoSelect: true,
  71. canEndNotMax: false,
  72. isShowOpponent: false,
  73. selectCardCoroutine: SelectCardCoroutine,
  74. afterSelectCardCoroutine: null,
  75. mode: SelectHandEffect.Mode.Custom,
  76. cardEffect: activateClass);
  77. yield return StartCoroutine(selectHandEffect.Activate());
  78. selectHandEffect.SetUpCustomMessage("Select a card to add face down as a source", "Opponent is selecting a card to add face down as a source");
  79. IEnumerator SelectCardCoroutine(CardSource cardSource)
  80. {
  81. selectedCard = cardSource;
  82. yield return null;
  83. }
  84. if (selectedCard != null)
  85. {
  86. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, EnterFieldPermanent))
  87. {
  88. Permanent selectedPermanent = null;
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: EnterFieldPermanent,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: 1,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass
  102. );
  103. selectPermanentEffect.SetUpCustomMessage("Select a Digimon to add source to", "Opponent is selecting a Digimon to add source to");
  104. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  105. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  106. {
  107. selectedPermanent = permanent;
  108. yield return null;
  109. }
  110. if (selectedPermanent != null)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  113. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }
  120. #endregion
  121. #region Inherit
  122. if (timing == EffectTiming.SecuritySkill)
  123. {
  124. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  125. }
  126. #endregion
  127. return cardEffects;
  128. }
  129. }
  130. }