PawnDevice_P_155.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects
  5. {
  6. public class PawnDevice_P_155 : 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 !CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("Pawn Device"));
  21. }
  22. bool CardCondition(CardSource cardSource)
  23. {
  24. return (cardSource == card);
  25. }
  26. }
  27. #endregion
  28. #region Main
  29. if (timing == EffectTiming.OptionSkill)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Draw 1, then place in battle area", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[Main] <Draw 1>. Then, place this card in the battle area.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  47. }
  48. }
  49. #endregion
  50. #region Main - Delay
  51. if (timing == EffectTiming.OnDeclaration)
  52. {
  53. ActivateClass activateClass = new ActivateClass();
  54. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  55. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  56. cardEffects.Add(activateClass);
  57. string EffectDiscription()
  58. {
  59. return "[Main] <Delay> (By trashing this card after the placing turn, active the effect.)\r\n• By trashing 1 of your non-red option cards in your battle area, gain 1 memory.";
  60. }
  61. bool HasNonRedOption(Permanent permanent)
  62. {
  63. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  64. {
  65. if (!permanent.IsTamer || !permanent.IsDigimon)
  66. {
  67. return !permanent.TopCard.CardColors.Contains(CardColor.Red);
  68. }
  69. }
  70. return false;
  71. }
  72. bool CanUseCondition(Hashtable hashtable)
  73. {
  74. if (CardEffectCommons.HasMatchConditionPermanent(HasNonRedOption))
  75. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  76. return false;
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  81. IEnumerator SuccessProcess()
  82. {
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: HasNonRedOption,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: 1,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 option to trash.", "The opponent is selecting 1 option to trash.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  101. targetPermanents: new List<Permanent>() { permanent },
  102. activateClass: activateClass,
  103. successProcess: permanents => TrashedSuccessProcess(),
  104. failureProcess: null));
  105. }
  106. IEnumerator TrashedSuccessProcess()
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  109. }
  110. }
  111. }
  112. }
  113. #endregion
  114. #region Security Effect
  115. if (timing == EffectTiming.SecuritySkill)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("Delete 1 of your opponents Digimon with 11000 DP or less, then add this to hand", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  120. activateClass.SetIsSecurityEffect(true);
  121. cardEffects.Add(activateClass);
  122. string EffectDiscription()
  123. {
  124. return "[Security] Delete 1 of your opponent's Digimon with 11000 DP or less. Then, add this card to the hand.";
  125. }
  126. bool CanSelectPermanentCondition(Permanent permanent)
  127. {
  128. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  129. return permanent.HasDP && permanent.DP <= 11000;
  130. return false;
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  135. }
  136. IEnumerator ActivateCoroutine(Hashtable hashtable)
  137. {
  138. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  139. {
  140. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  141. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  142. selectPermanentEffect.SetUp(
  143. selectPlayer: card.Owner,
  144. canTargetCondition: CanSelectPermanentCondition,
  145. canTargetCondition_ByPreSelecetedList: null,
  146. canEndSelectCondition: null,
  147. maxCount: maxCount,
  148. canNoSelect: false,
  149. canEndNotMax: false,
  150. selectPermanentCoroutine: null,
  151. afterSelectPermanentCoroutine: null,
  152. mode: SelectPermanentEffect.Mode.Destroy,
  153. cardEffect: activateClass);
  154. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. }
  157. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  158. }
  159. }
  160. #endregion
  161. return cardEffects;
  162. }
  163. }
  164. }