EX3_065.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX3
  4. {
  5. public class EX3_065 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnStartTurn)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[Start of Your Turn] If your opponent has a Digimon in play, gain 1 memory.";
  19. }
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. if (CardEffectCommons.IsExistOnBattleArea(card))
  23. {
  24. if (CardEffectCommons.IsOwnerTurn(card))
  25. {
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  36. {
  37. if (card.Owner.CanAddMemory(activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  48. }
  49. }
  50. if (timing == EffectTiming.OnEnterFieldAnyone)
  51. {
  52. ActivateClass activateClass = new ActivateClass();
  53. activateClass.SetUpICardEffect("Activate [On Play] Effect", CanUseCondition, card);
  54. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  55. cardEffects.Add(activateClass);
  56. string EffectDiscription()
  57. {
  58. return "[Your Turn] When one of your Digimon digivolves into a Digimon with [Rock Dragon], [Earth Dragon], [Machine Dragon], or [Sky Dragon] in its traits, by suspending this Digimon, activate 1 of that Digimon's [On Play] effects.";
  59. }
  60. bool PermanentCondition(Permanent permanent)
  61. {
  62. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  63. {
  64. if (permanent.TopCard.CardTraits.Contains("Rock Dragon"))
  65. {
  66. return true;
  67. }
  68. if (permanent.TopCard.CardTraits.Contains("RockDragon"))
  69. {
  70. return true;
  71. }
  72. if (permanent.TopCard.CardTraits.Contains("Earth Dragon"))
  73. {
  74. return true;
  75. }
  76. if (permanent.TopCard.CardTraits.Contains("EarthDragon"))
  77. {
  78. return true;
  79. }
  80. if (permanent.TopCard.CardTraits.Contains("Machine Dragon"))
  81. {
  82. return true;
  83. }
  84. if (permanent.TopCard.CardTraits.Contains("MachineDragon"))
  85. {
  86. return true;
  87. }
  88. if (permanent.TopCard.CardTraits.Contains("Sky Dragon"))
  89. {
  90. return true;
  91. }
  92. if (permanent.TopCard.CardTraits.Contains("SkyDragon"))
  93. {
  94. return true;
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.IsOwnerTurn(card))
  104. {
  105. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  106. {
  107. return true;
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleArea(card))
  116. {
  117. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  118. {
  119. return true;
  120. }
  121. }
  122. return false;
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  127. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  128. hashtable: _hashtable,
  129. rootCondition: null);
  130. if (permanents != null)
  131. {
  132. List<ICardEffect> candidateEffects = permanents
  133. .Map(permanent => permanent.EffectList(EffectTiming.OnEnterFieldAnyone))
  134. .Flat()
  135. .Clone()
  136. .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsOnPlay);
  137. if (candidateEffects.Count >= 1)
  138. {
  139. ICardEffect selectedEffect = null;
  140. if (candidateEffects.Count == 1)
  141. {
  142. selectedEffect = candidateEffects[0];
  143. }
  144. else
  145. {
  146. List<SkillInfo> skillInfos = candidateEffects
  147. .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
  148. List<CardSource> cardSources = candidateEffects
  149. .Map(cardEffect => cardEffect.EffectSourceCard);
  150. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  151. selectCardEffect.SetUp(
  152. canTargetCondition: (cardSource) => true,
  153. canTargetCondition_ByPreSelecetedList: null,
  154. canEndSelectCondition: null,
  155. canNoSelect: () => false,
  156. selectCardCoroutine: null,
  157. afterSelectCardCoroutine: null,
  158. message: "Select 1 effect to activate.",
  159. maxCount: 1,
  160. canEndNotMax: false,
  161. isShowOpponent: false,
  162. mode: SelectCardEffect.Mode.Custom,
  163. root: SelectCardEffect.Root.Custom,
  164. customRootCardList: cardSources,
  165. canLookReverseCard: true,
  166. selectPlayer: card.Owner,
  167. cardEffect: activateClass);
  168. selectCardEffect.SetNotShowCard();
  169. selectCardEffect.SetUpSkillInfos(skillInfos);
  170. selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
  171. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  172. IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
  173. {
  174. if (selectedIndexes.Count == 1)
  175. {
  176. selectedEffect = candidateEffects[selectedIndexes[0]];
  177. yield return null;
  178. }
  179. }
  180. }
  181. if (selectedEffect != null)
  182. {
  183. if (selectedEffect.EffectSourceCard != null)
  184. {
  185. if (selectedEffect.EffectSourceCard.PermanentOfThisCard() != null)
  186. {
  187. Hashtable effectHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(selectedEffect.EffectSourceCard);
  188. if (selectedEffect.CanUse(effectHashtable))
  189. {
  190. selectedEffect.SetIsDigimonEffect(true);
  191. yield return ContinuousController.instance.StartCoroutine(((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(effectHashtable));
  192. }
  193. }
  194. }
  195. }
  196. }
  197. }
  198. }
  199. }
  200. if (timing == EffectTiming.SecuritySkill)
  201. {
  202. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  203. }
  204. return cardEffects;
  205. }
  206. }
  207. }