EX11_067.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Dokuson Aruba
  4. namespace DCGO.CardEffects.EX11
  5. {
  6. public class EX11_067 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Security
  12. if (timing == EffectTiming.SecuritySkill)
  13. {
  14. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  15. }
  16. #endregion
  17. #region Start of turn set to 3
  18. if (timing == EffectTiming.OnStartTurn)
  19. {
  20. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  21. }
  22. #endregion
  23. #region On Play
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("1 of your Digimon w/[Lucemon] in text can digivolve into a [Lucemon] in name in hand or trash for free.", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  29. cardEffects.Add(activateClass);
  30. string EffectDescription()
  31. {
  32. return
  33. "[On Play] 1 of your Digimon with [Lucemon] in its text on the field may digivolve into a Digimon card with [Lucemon] in its name in the hand or trash without paying the cost.";
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnBattleArea(card)
  38. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleArea(card)
  43. && (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition)
  44. || CardEffectCommons.HasMatchConditionOwnersBreedingPermanent(card, CanSelectPermanentCondition));
  45. }
  46. bool CanSelectPermanentCondition(Permanent permanent)
  47. {
  48. return (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  49. || (CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card)
  50. && permanent.IsDigimon))
  51. && permanent.TopCard.HasText("Lucemon");
  52. }
  53. bool CanSelectCardCondition(CardSource cardSource)
  54. {
  55. return cardSource.IsDigimon
  56. && cardSource.ContainsCardName("Lucemon");
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition, true))
  61. {
  62. Permanent selectedPermanent = null;
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: 1,
  70. canNoSelect: true,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.",
  77. "The opponent is selecting 1 Digimon that will digivolve.");
  78. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  79. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  80. {
  81. selectedPermanent = permanent;
  82. yield return null;
  83. }
  84. if (selectedPermanent != null)
  85. {
  86. bool CanDigivolveCondition(CardSource cardSource)
  87. {
  88. return CanSelectCardCondition(cardSource)
  89. && cardSource.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, false, activateClass);
  90. }
  91. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
  92. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanDigivolveCondition))
  93. {
  94. selectionElements.Add(new(message: "From hand", value: 0, spriteIndex: 0));
  95. }
  96. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanDigivolveCondition))
  97. {
  98. selectionElements.Add(new(message: "From trash", value: 1, spriteIndex: 0));
  99. }
  100. selectionElements.Add(new(message: "Do not digivolve", value: 2, spriteIndex: 1));
  101. string selectPlayerMessage = "From which area do you select a card?";
  102. string notSelectPlayerMessage = "The opponent is choosing from which area to digivolve.";
  103. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements,
  104. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  105. notSelectPlayerMessage: notSelectPlayerMessage);
  106. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  107. .WaitForEndSelect());
  108. int selection = GManager.instance.userSelectionManager.SelectedIntValue;
  109. if (selection != 2)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  112. targetPermanent: selectedPermanent,
  113. cardCondition: CanSelectCardCondition,
  114. payCost: false,
  115. reduceCostTuple: null,
  116. fixedCostTuple: null,
  117. ignoreDigivolutionRequirementFixedCost: -1,
  118. isHand: selection == 0,
  119. activateClass: activateClass,
  120. successProcess: null));
  121. }
  122. }
  123. }
  124. }
  125. }
  126. #endregion
  127. #region Your Turn
  128. if (timing == EffectTiming.OnEnterFieldAnyone)
  129. {
  130. ActivateClass activateClass = new ActivateClass();
  131. activateClass.SetUpICardEffect("Suspend this tamer to gain 1 memory", CanUseCondition, card);
  132. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  133. cardEffects.Add(activateClass);
  134. string EffectDescription()
  135. => "[Your Turn] When any of your Digimon digivolve into a Digimon card with [Lucemon] in its name, by suspending this Tamer, gain 1 memory.";
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleArea(card)
  139. && CardEffectCommons.IsOwnerTurn(card)
  140. && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition);
  141. }
  142. bool PermanentCondition(Permanent permanent)
  143. {
  144. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  145. && permanent.TopCard.ContainsCardName("Lucemon");
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.IsExistOnBattleArea(card)
  150. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  151. }
  152. IEnumerator ActivateCoroutine(Hashtable hashtable)
  153. {
  154. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  155. new List<Permanent>() { card.PermanentOfThisCard() },
  156. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  157. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  158. }
  159. }
  160. #endregion
  161. return cardEffects;
  162. }
  163. }
  164. }