EX9_066.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. //Tai Kamiya & Matt Ishida
  5. namespace DCGO.CardEffects.EX9
  6. {
  7. public class EX9_066 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Return 1 card, or Draw 1.", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may return 1 Digimon card with [Greymon], [Garurumon] or [Omnimon] in its name from your trash to the hand. If this effect didn't return, <Draw 1>";
  22. }
  23. bool ReturnCard(CardSource source)
  24. {
  25. return source.HasGreymonName ||
  26. source.HasGarurumonName ||
  27. source.ContainsCardName("Omnimon");
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleArea(card);
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. bool cardAdded = false;
  40. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, ReturnCard))
  41. {
  42. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  43. selectCardEffect.SetUp(
  44. canTargetCondition: ReturnCard,
  45. canTargetCondition_ByPreSelecetedList: null,
  46. canEndSelectCondition: null,
  47. canNoSelect: () => true,
  48. selectCardCoroutine: null,
  49. afterSelectCardCoroutine: SelectCardCoroutine,
  50. message: "Select 1 Digimon card with [Greymon], [Garurumon] or [Omnimon] in its name",
  51. maxCount: 1,
  52. canEndNotMax: false,
  53. isShowOpponent: true,
  54. mode: SelectCardEffect.Mode.AddHand,
  55. root: SelectCardEffect.Root.Trash,
  56. customRootCardList: null,
  57. canLookReverseCard: true,
  58. selectPlayer: card.Owner,
  59. cardEffect: activateClass);
  60. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  61. IEnumerator SelectCardCoroutine(List<CardSource> sources)
  62. {
  63. if (sources.Count > 0)
  64. cardAdded = true;
  65. yield return null;
  66. }
  67. }
  68. if (!cardAdded)
  69. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  70. }
  71. }
  72. #endregion
  73. #region All Turns
  74. if (timing == EffectTiming.OnEnterFieldAnyone)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Suspend this tamer to gain memory", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[All Turns] When any of your Digimon are played or digivolve, by suspending this Tamer, gain 1 memory if you have a Digimon with [Greymon] in its name. Then, gain 1 memory if you have a Digimon with [Garurumon] in its name.";
  83. }
  84. bool EnterFieldDigimon(Permanent permanent)
  85. {
  86. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  87. }
  88. bool DigimonWithGreymon(Permanent permanent)
  89. {
  90. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  91. permanent.TopCard.HasGreymonName;
  92. }
  93. bool DigimonWithGarurumon(Permanent permanent)
  94. {
  95. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  96. permanent.TopCard.HasGarurumonName;
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return isExistOnField(card) &&
  101. (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, EnterFieldDigimon) ||
  102. CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, EnterFieldDigimon));
  103. }
  104. bool CanActivateCondition(Hashtable hashtable)
  105. {
  106. return isExistOnField(card) &&
  107. CardEffectCommons.CanActivateSuspendCostEffect(card);
  108. }
  109. IEnumerator ActivateCoroutine(Hashtable hashtable)
  110. {
  111. int plusMemory = 0;
  112. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  113. if (CardEffectCommons.HasMatchConditionPermanent(DigimonWithGreymon))
  114. plusMemory++;
  115. if (CardEffectCommons.HasMatchConditionPermanent(DigimonWithGarurumon))
  116. plusMemory++;
  117. if (card.Owner.CanAddMemory(activateClass))
  118. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(plusMemory, activateClass));
  119. }
  120. }
  121. #endregion
  122. #region Security
  123. if (timing == EffectTiming.SecuritySkill)
  124. {
  125. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  126. }
  127. #endregion
  128. return cardEffects;
  129. }
  130. }
  131. }