LM_057.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Wall Training
  5. namespace DCGO.CardEffects.LM
  6. {
  7. public class LM_057 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Ignore Color Requirements
  13. if (timing == EffectTiming.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return !card.Owner.GetBattleAreaPermanents().Some(permanet =>
  22. permanet.TopCard.EqualsCardName("Wall Training"));
  23. }
  24. bool CardCondition(CardSource cardSource)
  25. {
  26. return cardSource == card;
  27. }
  28. }
  29. #endregion
  30. CardColor targetColor = CardColor.Red;
  31. CardColor targetColor1 = CardColor.Blue;
  32. #region Main Effect
  33. if (timing == EffectTiming.OptionSkill)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  37. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[Main] Reveal the top 2 cards of your deck. Add 1 Red or Blue card among them to the hand. Return the rest at the bottom of your deck. Then, place this card in the battle area.";
  42. }
  43. bool CanSelectCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.HasCardColor(targetColor)
  46. || cardSource.HasCardColor(targetColor1);
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  55. revealCount: 2,
  56. simplifiedSelectCardConditions:
  57. new SimplifiedSelectCardConditionClass[]
  58. {
  59. new SimplifiedSelectCardConditionClass(
  60. canTargetCondition:CanSelectCardCondition,
  61. message: "Select 1 Red or Blue card.",
  62. mode: SelectCardEffect.Mode.AddHand,
  63. maxCount: 1,
  64. selectCardCoroutine: null),
  65. },
  66. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  67. activateClass: activateClass
  68. ));
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  70. }
  71. }
  72. #endregion
  73. #region Delay
  74. if (timing == EffectTiming.OnDeclaration)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Your 1 Digimon digivolves", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[Main] <Delay> - 1 of your Digimon may digivolve into a Red or Blue Digimon card in the hand with the digivolution cost reduced by 2.";
  83. }
  84. bool CanSelectPermanentCondition(Permanent permanent)
  85. {
  86. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  87. {
  88. foreach (CardSource cardSource in card.Owner.HandCards)
  89. {
  90. if (CanSelectCardCondition(cardSource)
  91. && cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  92. {
  93. return true;
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanSelectCardCondition(CardSource cardSource)
  100. {
  101. return cardSource.IsDigimon
  102. && (cardSource.HasCardColor(targetColor)
  103. || cardSource.HasCardColor(targetColor1));
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  108. }
  109. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  112. IEnumerator SuccessProcess()
  113. {
  114. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  115. {
  116. Permanent selectedPermanent = null;
  117. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectPermanentCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: true,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: SelectPermanentCoroutine,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Custom,
  130. cardEffect: activateClass);
  131. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  134. {
  135. selectedPermanent = permanent;
  136. yield return null;
  137. }
  138. if (selectedPermanent != null)
  139. {
  140. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  141. targetPermanent: selectedPermanent,
  142. cardCondition: CanSelectCardCondition,
  143. payCost: true,
  144. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  145. fixedCostTuple: null,
  146. ignoreDigivolutionRequirementFixedCost: -1,
  147. isHand: true,
  148. activateClass: activateClass,
  149. successProcess: null));
  150. }
  151. }
  152. }
  153. }
  154. }
  155. #endregion
  156. #region Security Effect
  157. if (timing == EffectTiming.SecuritySkill)
  158. {
  159. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  160. card: card,
  161. cardEffects: ref cardEffects,
  162. effectName: "[Main] Reveal the top 2 cards of your deck. Add 1 Red or Blue card among them to the hand.Return the rest at the bottom of your deck.Then, place this card in the battle area.");
  163. }
  164. #endregion
  165. return cardEffects;
  166. }
  167. }
  168. }