BT18_038.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT18
  6. {
  7. public class BT18_038 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return (targetPermanent.TopCard.EqualsTraits("Angel") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Place a card in the bottom of security, then add top security to hand", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  28. cardEffects.Add(activateClass);
  29. string EffectDescription()
  30. {
  31. return "[On Play] You may place 1 Digimon card with the [Angel]/[Archangel]/[Three Great Angels] trait from your hand at the bottom of your security stack. Then, if you have 4 or more security cards, add the top card of your security stack to the hand.";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool CanSelectCardCondition(CardSource cardSource)
  38. {
  39. if (cardSource.IsDigimon)
  40. {
  41. if (cardSource.HasAngelTraitRestrictive)
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  51. {
  52. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  62. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  63. selectHandEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectCardCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: maxCount,
  69. canNoSelect: true,
  70. canEndNotMax: false,
  71. isShowOpponent: true,
  72. selectCardCoroutine: SelectCardCoroutine,
  73. afterSelectCardCoroutine: null,
  74. mode: SelectHandEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of security.", "The opponent is selecting 1 card to place at the bottom of security.");
  77. selectHandEffect.SetUpCustomMessage_ShowCard("Security Bottom Card");
  78. yield return StartCoroutine(selectHandEffect.Activate());
  79. IEnumerator SelectCardCoroutine(CardSource cardSource)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(cardSource, toTop: false));
  82. }
  83. if (card.Owner.SecurityCards.Count >= 4)
  84. {
  85. CardSource topCard = card.Owner.SecurityCards[0];
  86. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  87. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  88. player: card.Owner,
  89. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  90. activateClass).ReduceSecurity());
  91. }
  92. }
  93. }
  94. #endregion
  95. #region On Deletion
  96. if (timing == EffectTiming.OnDestroyedAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Place a card in the bottom of security, then add top security to hand", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  101. cardEffects.Add(activateClass);
  102. string EffectDescription()
  103. {
  104. return "[On Deletion] You may place 1 Digimon card with the [Angel]/[Archangel]/[Three Great Angels] trait from your hand at the bottom of your security stack. Then, if you have 4 or more security cards, add the top card of your security stack to the hand.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  109. }
  110. bool CanSelectCardCondition(CardSource cardSource)
  111. {
  112. if (cardSource.IsDigimon)
  113. {
  114. if (cardSource.HasAngelTraitRestrictive)
  115. {
  116. return true;
  117. }
  118. }
  119. return false;
  120. }
  121. bool CanActivateCondition(Hashtable hashtable)
  122. {
  123. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  124. {
  125. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  126. {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable hashtable)
  133. {
  134. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  135. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  136. selectHandEffect.SetUp(
  137. selectPlayer: card.Owner,
  138. canTargetCondition: CanSelectCardCondition,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. maxCount: maxCount,
  142. canNoSelect: true,
  143. canEndNotMax: false,
  144. isShowOpponent: true,
  145. selectCardCoroutine: SelectCardCoroutine,
  146. afterSelectCardCoroutine: null,
  147. mode: SelectHandEffect.Mode.Custom,
  148. cardEffect: activateClass);
  149. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of security.", "The opponent is selecting 1 card to place at the bottom of security.");
  150. selectHandEffect.SetUpCustomMessage_ShowCard("Security Bottom Card");
  151. yield return StartCoroutine(selectHandEffect.Activate());
  152. IEnumerator SelectCardCoroutine(CardSource cardSource)
  153. {
  154. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(cardSource, toTop: false));
  155. }
  156. if (card.Owner.SecurityCards.Count >= 4)
  157. {
  158. CardSource topCard = card.Owner.SecurityCards[0];
  159. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  160. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(player: card.Owner, refSkillInfos: ref ContinuousController.instance.nullSkillInfos, activateClass).ReduceSecurity());
  161. }
  162. }
  163. }
  164. #endregion
  165. #region Inherit
  166. if (timing == EffectTiming.OnDestroyedAnyone)
  167. {
  168. ActivateClass activateClass = new ActivateClass();
  169. activateClass.SetUpICardEffect("Recovery +1", CanUseCondition, card);
  170. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  171. activateClass.SetIsInheritedEffect(true);
  172. cardEffects.Add(activateClass);
  173. string EffectDiscription()
  174. {
  175. return "[On Deletion] Recovery +1.";
  176. }
  177. bool CanUseCondition(Hashtable hashtable)
  178. {
  179. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  180. }
  181. bool CanActivateCondition(Hashtable hashtable)
  182. {
  183. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  184. {
  185. if (card.Owner.CanAddSecurity(activateClass))
  186. {
  187. return true;
  188. }
  189. }
  190. return false;
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  193. {
  194. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  195. }
  196. }
  197. #endregion
  198. return cardEffects;
  199. }
  200. }
  201. }