LM_065.cs 8.9 KB

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