EX10_067.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Ryoma Mogami
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_067 : 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. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Suspend and place 1 to gain Alliance", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Your Turn] When any of your Digimon digivolve into a Digimon with <Save> in its text, by suspending this Tamer and placing 1 Digimon card with <Save> in its text from under your Tamers as that Digimon's bottom digivolution card, that Digimon gains <Alliance> for the turn.";
  28. }
  29. bool HasSaveText(CardSource source)
  30. {
  31. return source.IsDigimon && source.HasSaveText;
  32. }
  33. bool PermanentCondition(Permanent permanent)
  34. {
  35. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  36. return HasSaveText(permanent.TopCard);
  37. return false;
  38. }
  39. bool IsTamerHasSource(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  42. permanent.IsTamer &&
  43. permanent.DigivolutionCards.Count(HasSaveText) > 0;
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition, null))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(IsTamerHasSource))
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable hashtable)
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  71. Permanent selectedTamerPermanent = null;
  72. List<CardSource> selectedSource = new List<CardSource>();
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: IsTamerHasSource,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: 1,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: SelectPermanentCoroutine,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to get the placed card from.",
  87. "The opponent is selecting 1 Tamer to get the placed card from.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. selectedTamerPermanent = permanent;
  92. yield return null;
  93. }
  94. if (selectedTamerPermanent != null)
  95. {
  96. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  97. selectCardEffect.SetUp(
  98. canTargetCondition: HasSaveText,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. canNoSelect: () => false,
  102. selectCardCoroutine: SelectCardCoroutine,
  103. afterSelectCardCoroutine: null,
  104. message: "Select 1 card to place on bottom of digivolution cards.",
  105. maxCount: 1,
  106. canEndNotMax: false,
  107. isShowOpponent: true,
  108. mode: SelectCardEffect.Mode.Custom,
  109. root: SelectCardEffect.Root.Custom,
  110. customRootCardList: selectedTamerPermanent.DigivolutionCards,
  111. canLookReverseCard: true,
  112. selectPlayer: card.Owner,
  113. cardEffect: activateClass);
  114. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  115. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  116. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  117. IEnumerator SelectCardCoroutine(CardSource cardSource)
  118. {
  119. selectedSource.Add(cardSource);
  120. yield return null;
  121. }
  122. if (selectedSource.Count > 0)
  123. {
  124. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  125. hashtable: hashtable,
  126. rootCondition: null);
  127. yield return ContinuousController.instance.StartCoroutine(permanents[0].AddDigivolutionCardsBottom(selectedSource, activateClass));
  128. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: permanents[0], effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  129. }
  130. }
  131. }
  132. }
  133. #endregion
  134. #region Security Effect
  135. if (timing == EffectTiming.SecuritySkill)
  136. {
  137. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  138. }
  139. #endregion
  140. return cardEffects;
  141. }
  142. }
  143. }