ST14_12.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class ST14_12 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnDiscardLibrary)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place this card in the Battle Area", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "When this card is trashed from your deck, you may place it in the battle area.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenSelfDiscardLibrary(hashtable, card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnTrash(card))
  30. {
  31. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: activateClass, root: SelectCardEffect.Root.Trash, isPlayOption: true))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  39. {
  40. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  41. }
  42. }
  43. if (timing == EffectTiming.OptionSkill)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  47. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  48. cardEffects.Add(activateClass);
  49. string EffectDiscription()
  50. {
  51. return "[Main] Delete 1 of your opponent's Digimon with the highest level.";
  52. }
  53. bool CanSelectPermanentCondition(Permanent permanent)
  54. {
  55. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  56. {
  57. if (CardEffectCommons.IsMaxLevel(permanent, card.Owner.Enemy))
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectPermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: null,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Destroy,
  85. cardEffect: activateClass);
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. }
  88. }
  89. }
  90. if (timing == EffectTiming.OnDeclaration)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Return 1 card from trash to hand", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[Main] <Delay> (After this card is placed, by trashing it the next turn or later, activate the effect below.) - Return 1 purple Digimon card or Tamer card from your trash to your hand.";
  99. }
  100. bool CanSelectCardCondition(CardSource cardSource)
  101. {
  102. if (cardSource.HasCardColor(CardColor.Purple))
  103. {
  104. if (cardSource.IsDigimon)
  105. {
  106. return true;
  107. }
  108. if (cardSource.IsTamer)
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  122. IEnumerator SuccessProcess()
  123. {
  124. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  125. {
  126. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  127. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  128. selectCardEffect.SetUp(
  129. canTargetCondition: CanSelectCardCondition,
  130. canTargetCondition_ByPreSelecetedList: null,
  131. canEndSelectCondition: null,
  132. canNoSelect: () => false,
  133. selectCardCoroutine: null,
  134. afterSelectCardCoroutine: null,
  135. message: "Select 1 card to add to your hand.",
  136. maxCount: maxCount,
  137. canEndNotMax: false,
  138. isShowOpponent: true,
  139. mode: SelectCardEffect.Mode.AddHand,
  140. root: SelectCardEffect.Root.Trash,
  141. customRootCardList: null,
  142. canLookReverseCard: true,
  143. selectPlayer: card.Owner,
  144. cardEffect: activateClass);
  145. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  146. }
  147. }
  148. }
  149. }
  150. if (timing == EffectTiming.SecuritySkill)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect($"Delete 1 Digimon with the highest level", CanUseCondition, card);
  154. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  155. activateClass.SetIsSecurityEffect(true);
  156. cardEffects.Add(activateClass);
  157. string EffectDiscription()
  158. {
  159. return "[Security] Delete 1 of your opponent's Digimon with the highest level.";
  160. }
  161. bool CanSelectPermanentCondition(Permanent permanent)
  162. {
  163. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  164. {
  165. if (CardEffectCommons.IsMaxLevel(permanent, card.Owner.Enemy))
  166. {
  167. return true;
  168. }
  169. }
  170. return false;
  171. }
  172. bool CanUseCondition(Hashtable hashtable)
  173. {
  174. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  175. }
  176. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  177. {
  178. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  179. {
  180. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  181. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  182. selectPermanentEffect.SetUp(
  183. selectPlayer: card.Owner,
  184. canTargetCondition: CanSelectPermanentCondition,
  185. canTargetCondition_ByPreSelecetedList: null,
  186. canEndSelectCondition: null,
  187. maxCount: maxCount,
  188. canNoSelect: false,
  189. canEndNotMax: false,
  190. selectPermanentCoroutine: null,
  191. afterSelectPermanentCoroutine: null,
  192. mode: SelectPermanentEffect.Mode.Destroy,
  193. cardEffect: activateClass);
  194. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  195. }
  196. }
  197. }
  198. return cardEffects;
  199. }
  200. }