BT11_042.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_042 : 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("Add 1 card from security to hand", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] You may search your security stack, reveal 1 card with [Angel], [Archangel], or [Fallen Angel] in its traits from it, and add it to your hand. If you added a card, <Recovery +1 (Deck)>. Then, shuffle your security stack.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.CardTraits.Contains("Angel"))
  24. {
  25. return true;
  26. }
  27. if (cardSource.CardTraits.Contains("Archangel"))
  28. {
  29. return true;
  30. }
  31. if (cardSource.CardTraits.Contains("Fallen Angel"))
  32. {
  33. return true;
  34. }
  35. if (cardSource.CardTraits.Contains("FallenAngel"))
  36. {
  37. return true;
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (card.Owner.SecurityCards.Count >= 1)
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (card.Owner.SecurityCards.Count >= 1)
  59. {
  60. int maxCount = Math.Min(1, card.Owner.SecurityCards.Count);
  61. CardSource selectedCard = null;
  62. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  63. selectCardEffect.SetUp(
  64. canTargetCondition: CanSelectCardCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. canNoSelect: () => true,
  68. selectCardCoroutine: null,
  69. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  70. message: "Select 1 card to add to your hand.",
  71. maxCount: maxCount,
  72. canEndNotMax: false,
  73. isShowOpponent: true,
  74. mode: SelectCardEffect.Mode.AddHand,
  75. root: SelectCardEffect.Root.Security,
  76. customRootCardList: null,
  77. canLookReverseCard: true,
  78. selectPlayer: card.Owner,
  79. cardEffect: activateClass);
  80. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  81. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  82. {
  83. foreach (CardSource cardSource in cardSources)
  84. {
  85. selectedCard = cardSource;
  86. }
  87. if (cardSources.Count >= 1)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  90. player: card.Owner,
  91. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  92. activateClass).ReduceSecurity());
  93. }
  94. yield return null;
  95. }
  96. if (selectedCard != null)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  99. }
  100. ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
  101. card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards);
  102. }
  103. }
  104. }
  105. if (timing == EffectTiming.OnEnterFieldAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  110. activateClass.SetHashString("Memory+1_BT11_042");
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[Your Turn][Once Per Turn] When you play [LadyDevimon] or [Mirei Mikagura], gain 1 memory.";
  115. }
  116. bool PermanentCondition(Permanent permanent)
  117. {
  118. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  119. {
  120. if (permanent.TopCard.CardNames.Contains("LadyDevimon"))
  121. {
  122. return true;
  123. }
  124. if (permanent.TopCard.CardNames.Contains("Mirei Mikagura") || permanent.TopCard.CardNames.Contains("MireiMikagura"))
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.IsExistOnBattleArea(card))
  134. {
  135. if (CardEffectCommons.IsOwnerTurn(card))
  136. {
  137. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  138. {
  139. return true;
  140. }
  141. }
  142. }
  143. return false;
  144. }
  145. bool CanActivateCondition(Hashtable hashtable)
  146. {
  147. if (CardEffectCommons.IsExistOnBattleArea(card))
  148. {
  149. return true;
  150. }
  151. return false;
  152. }
  153. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  154. {
  155. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  156. }
  157. }
  158. if (timing == EffectTiming.None)
  159. {
  160. bool CanUseCondition()
  161. {
  162. if (CardEffectCommons.IsExistOnBattleArea(card))
  163. {
  164. if (CardEffectCommons.IsOpponentTurn(card))
  165. {
  166. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardColors.Contains(CardColor.Purple)))
  167. {
  168. return true;
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. bool PermanentCondition(Permanent permanent)
  175. {
  176. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  177. {
  178. if (permanent.TopCard.CardTraits.Contains("Angel"))
  179. {
  180. return true;
  181. }
  182. if (permanent.TopCard.CardTraits.Contains("Archangel"))
  183. {
  184. return true;
  185. }
  186. if (permanent.TopCard.CardTraits.Contains("Fallen Angel"))
  187. {
  188. return true;
  189. }
  190. if (permanent.TopCard.CardTraits.Contains("FallenAngel"))
  191. {
  192. return true;
  193. }
  194. }
  195. return false;
  196. }
  197. cardEffects.Add(CardEffectFactory.BlockerStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: true, card: card, condition: CanUseCondition));
  198. }
  199. return cardEffects;
  200. }
  201. }
  202. }