BT14_071.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_071 : 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.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Place cards under this Digimon's digivolution cards to gain Memory +1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Start of Your Main Phase] By placing 1 [Eiji Nagasumi] from your hand or trash as this Digimon's bottom digivolution card, gain 1 memory.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.CardNames.Contains("Eiji Nagasumi"))
  24. {
  25. return true;
  26. }
  27. if (cardSource.CardNames.Contains("EijiNagasumi"))
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.IsOwnerTurn(card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  49. {
  50. return true;
  51. }
  52. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  62. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  63. if (canSelectHand || canSelectTrash)
  64. {
  65. if (canSelectHand && canSelectTrash)
  66. {
  67. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  68. {
  69. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  70. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  71. };
  72. string selectPlayerMessage = "From which area do you select a card?";
  73. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  74. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  75. }
  76. else
  77. {
  78. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  79. }
  80. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  81. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  82. List<CardSource> selectedCards = new List<CardSource>();
  83. IEnumerator SelectCardCoroutine(CardSource cardSource)
  84. {
  85. selectedCards.Add(cardSource);
  86. yield return null;
  87. }
  88. if (fromHand)
  89. {
  90. int maxCount = 1;
  91. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  92. selectHandEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: CanSelectCardCondition,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: maxCount,
  98. canNoSelect: true,
  99. canEndNotMax: false,
  100. isShowOpponent: true,
  101. selectCardCoroutine: SelectCardCoroutine,
  102. afterSelectCardCoroutine: null,
  103. mode: SelectHandEffect.Mode.Custom,
  104. cardEffect: activateClass);
  105. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  106. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  107. yield return StartCoroutine(selectHandEffect.Activate());
  108. }
  109. else
  110. {
  111. int maxCount = 1;
  112. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  113. selectCardEffect.SetUp(
  114. canTargetCondition: CanSelectCardCondition,
  115. canTargetCondition_ByPreSelecetedList: null,
  116. canEndSelectCondition: null,
  117. canNoSelect: () => true,
  118. selectCardCoroutine: SelectCardCoroutine,
  119. afterSelectCardCoroutine: null,
  120. message: "Select 1 card to place on bottom of digivolution cards.",
  121. maxCount: maxCount,
  122. canEndNotMax: false,
  123. isShowOpponent: true,
  124. mode: SelectCardEffect.Mode.Custom,
  125. root: SelectCardEffect.Root.Trash,
  126. customRootCardList: null,
  127. canLookReverseCard: true,
  128. selectPlayer: card.Owner,
  129. cardEffect: activateClass);
  130. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  131. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  132. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  133. }
  134. if (selectedCards.Count >= 1)
  135. {
  136. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  137. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  138. }
  139. }
  140. }
  141. }
  142. if (timing == EffectTiming.OnEnterFieldAnyone)
  143. {
  144. ActivateClass activateClass = new ActivateClass();
  145. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  146. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  147. activateClass.SetIsInheritedEffect(true);
  148. activateClass.SetHashString("Memory+1_BT14_071");
  149. cardEffects.Add(activateClass);
  150. string EffectDiscription()
  151. {
  152. return "[Your Turn][Once Per Turn] When you play a card with the [Dark Animal] or [SoC] trait, gain 1 memory.";
  153. }
  154. bool PermanentCondition(Permanent permanent)
  155. {
  156. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  157. {
  158. if (permanent.IsDigimon || permanent.IsTamer)
  159. {
  160. if (permanent.TopCard.ContainsTraits("Dark Animal"))
  161. return true;
  162. if (permanent.TopCard.HasSocTraits)
  163. return true;
  164. }
  165. }
  166. return false;
  167. }
  168. bool CanUseCondition(Hashtable hashtable)
  169. {
  170. if (CardEffectCommons.IsExistOnBattleArea(card))
  171. {
  172. if (CardEffectCommons.IsOwnerTurn(card))
  173. {
  174. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  175. {
  176. return true;
  177. }
  178. }
  179. }
  180. return false;
  181. }
  182. bool CanActivateCondition(Hashtable hashtable)
  183. {
  184. if (CardEffectCommons.IsExistOnBattleArea(card))
  185. {
  186. return true;
  187. }
  188. return false;
  189. }
  190. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  193. }
  194. }
  195. return cardEffects;
  196. }
  197. }
  198. }