BT11_112.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_112 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Your 1 Digimon gets Blocker and Evade", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Until the end of your opponent's turn, 1 of your Digimon with [Veemon] or [Veedramon] in its name gains <Blocker> and <Evade>.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.TopCard.ContainsCardName("Veemon"))
  26. {
  27. return true;
  28. }
  29. if (permanent.TopCard.ContainsCardName("Veedramon"))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: CanSelectPermanentCondition,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: maxCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: SelectPermanentCoroutine,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon with [Veemon] or [Veedramon] in its name that will get Blocker and Evade.", "The opponent is selecting 1 Digimon with [Veemon] or [Veedramon] in its name that will get Blocker and Evade.");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainEvade(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  73. }
  74. }
  75. }
  76. if (timing == EffectTiming.OnTappedAnyone)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Activate [When Digivolving] effect", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[All Turns] When one of your Digimon with [Veedramon] in its name becomes suspended, by suspending this Tamer, activate 1 of that Digimon's [When Digivolving] effects.";
  85. }
  86. bool PermanentCondition(Permanent permanent)
  87. {
  88. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  89. {
  90. if (permanent.TopCard.ContainsCardName("Veedramon"))
  91. {
  92. return true;
  93. }
  94. }
  95. return false;
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  102. {
  103. return true;
  104. }
  105. }
  106. return false;
  107. }
  108. bool CanActivateCondition(Hashtable hashtable)
  109. {
  110. if (CardEffectCommons.IsExistOnBattleArea(card))
  111. {
  112. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  122. List<Permanent> tappedPermanents = CardEffectCommons.GetPermanentsFromHashtable(_hashtable)
  123. .Filter(PermanentCondition);
  124. if (tappedPermanents != null)
  125. {
  126. List<ICardEffect> candidateEffects = tappedPermanents
  127. .Map(permanent => permanent.EffectList(EffectTiming.OnEnterFieldAnyone))
  128. .Flat()
  129. .Clone()
  130. .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsWhenDigivolving);
  131. if (candidateEffects.Count >= 1)
  132. {
  133. ICardEffect selectedEffect = null;
  134. if (candidateEffects.Count == 1)
  135. {
  136. selectedEffect = candidateEffects[0];
  137. }
  138. else
  139. {
  140. List<SkillInfo> skillInfos = candidateEffects
  141. .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
  142. List<CardSource> cardSources = candidateEffects
  143. .Map(cardEffect => cardEffect.EffectSourceCard);
  144. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  145. selectCardEffect.SetUp(
  146. canTargetCondition: (cardSource) => true,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. canNoSelect: () => false,
  150. selectCardCoroutine: null,
  151. afterSelectCardCoroutine: null,
  152. message: "Select 1 effect to activate.",
  153. maxCount: 1,
  154. canEndNotMax: false,
  155. isShowOpponent: false,
  156. mode: SelectCardEffect.Mode.Custom,
  157. root: SelectCardEffect.Root.Custom,
  158. customRootCardList: cardSources,
  159. canLookReverseCard: true,
  160. selectPlayer: card.Owner,
  161. cardEffect: activateClass);
  162. selectCardEffect.SetNotShowCard();
  163. selectCardEffect.SetUpSkillInfos(skillInfos);
  164. selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
  165. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  166. IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
  167. {
  168. if (selectedIndexes.Count == 1)
  169. {
  170. selectedEffect = candidateEffects[selectedIndexes[0]];
  171. yield return null;
  172. }
  173. }
  174. }
  175. if (selectedEffect != null)
  176. {
  177. if (selectedEffect.EffectSourceCard != null)
  178. {
  179. if (selectedEffect.EffectSourceCard.PermanentOfThisCard() != null)
  180. {
  181. Hashtable effectHashtable = CardEffectCommons.WhenDigivolvingCheckHashtableOfCard(selectedEffect.EffectSourceCard);
  182. if (selectedEffect.CanUse(effectHashtable))
  183. {
  184. selectedEffect.SetIsDigimonEffect(true);
  185. yield return ContinuousController.instance.StartCoroutine(((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(effectHashtable));
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. if (timing == EffectTiming.OnUnTappedAnyone)
  195. {
  196. ActivateClass activateClass = new ActivateClass();
  197. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  198. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  199. activateClass.SetHashString("Memory+1_BT11_112");
  200. cardEffects.Add(activateClass);
  201. string EffectDiscription()
  202. {
  203. return "[Your Turn][Once Per Turn] When one of your blue Digimon becomes unsuspended, gain 1 memory.";
  204. }
  205. bool PermanentCondition(Permanent permanent)
  206. {
  207. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  208. {
  209. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  210. {
  211. return true;
  212. }
  213. }
  214. return false;
  215. }
  216. bool CanUseCondition(Hashtable hashtable)
  217. {
  218. if (CardEffectCommons.IsExistOnBattleArea(card))
  219. {
  220. if (CardEffectCommons.IsOwnerTurn(card))
  221. {
  222. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, PermanentCondition))
  223. {
  224. return true;
  225. }
  226. }
  227. }
  228. return false;
  229. }
  230. bool CanActivateCondition(Hashtable hashtable)
  231. {
  232. if (CardEffectCommons.IsExistOnBattleArea(card))
  233. {
  234. return true;
  235. }
  236. return false;
  237. }
  238. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  239. {
  240. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  241. }
  242. }
  243. if (timing == EffectTiming.SecuritySkill)
  244. {
  245. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  246. }
  247. return cardEffects;
  248. }
  249. }
  250. }