BT10_111.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_111 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.None)
  16. {
  17. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  18. changeCardNamesClass.SetUpICardEffect("Also treated as [Shoutmon]", CanUseCondition, card);
  19. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  20. cardEffects.Add(changeCardNamesClass);
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return true;
  24. }
  25. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  26. {
  27. if (cardSource == card)
  28. {
  29. CardNames.Add("Shoutmon");
  30. }
  31. return CardNames;
  32. }
  33. }
  34. if (timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Return 1 card from trash to hand and this Digimon gets effects", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  39. cardEffects.Add(activateClass);
  40. string EffectDiscription()
  41. {
  42. return "[On Play] Return 1 card with a DigiXros requirement from your trash to your hand. When DigiXrosing this turn, you may use this Digimon in place of one of the DigiXros requirements.";
  43. }
  44. bool CanSelectCardCondition(CardSource cardSource)
  45. {
  46. if (cardSource != null)
  47. {
  48. if (cardSource.Owner == card.Owner)
  49. {
  50. if (cardSource.HasDigiXros)
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. return true;
  67. }
  68. return false;
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  73. {
  74. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  75. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  76. selectCardEffect.SetUp(
  77. canTargetCondition: CanSelectCardCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. canNoSelect: () => true,
  81. selectCardCoroutine: null,
  82. afterSelectCardCoroutine: null,
  83. message: "Select 1 card to add to your hand.",
  84. maxCount: maxCount,
  85. canEndNotMax: false,
  86. isShowOpponent: true,
  87. mode: SelectCardEffect.Mode.AddHand,
  88. root: SelectCardEffect.Root.Trash,
  89. customRootCardList: null,
  90. canLookReverseCard: true,
  91. selectPlayer: card.Owner,
  92. cardEffect: activateClass);
  93. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  94. }
  95. Permanent selectedPermanent = card.PermanentOfThisCard();
  96. if (selectedPermanent != null)
  97. {
  98. CanSelectDigiXrosClass canSelectDigiXrosClass = new CanSelectDigiXrosClass();
  99. canSelectDigiXrosClass.SetUpICardEffect("Can be used for DigiXros requirements", CanUseCondition1, card);
  100. canSelectDigiXrosClass.SetUpCanSelectDigiXrosClass(CanSelectCondition: CanSelectCondition);
  101. selectedPermanent.UntilEachTurnEndEffects.Add((_timing) => canSelectDigiXrosClass);
  102. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  103. bool CanUseCondition1(Hashtable hashtable)
  104. {
  105. if (selectedPermanent.TopCard != null)
  106. {
  107. return true;
  108. }
  109. return false;
  110. }
  111. bool CanSelectCondition(CardSource cardSource, Permanent permanent)
  112. {
  113. if (PermanentCondition(permanent))
  114. {
  115. return true;
  116. }
  117. return false;
  118. }
  119. bool PermanentCondition(Permanent permanent)
  120. {
  121. if (permanent != null)
  122. {
  123. if (permanent.TopCard != null)
  124. {
  125. if (permanent == selectedPermanent)
  126. {
  127. return true;
  128. }
  129. }
  130. }
  131. return false;
  132. }
  133. }
  134. }
  135. }
  136. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  137. {
  138. cardEffects.Add(CardEffectFactory.MaterialSaveEffect(card: card, materialSaveCount: 1));
  139. }
  140. if (timing == EffectTiming.None)
  141. {
  142. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  143. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  144. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  145. addDigiXrosConditionClass.SetNotShowUI(true);
  146. cardEffects.Add(addDigiXrosConditionClass);
  147. bool CanUseCondition(Hashtable hashtable)
  148. {
  149. return true;
  150. }
  151. DigiXrosCondition GetDigiXros(CardSource cardSource)
  152. {
  153. if (cardSource == card)
  154. {
  155. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "[Xros Heart] Digimon");
  156. bool CanSelectCardCondition(CardSource cardSource)
  157. {
  158. if (cardSource != null)
  159. {
  160. if (cardSource.Owner == card.Owner)
  161. {
  162. if (cardSource.IsDigimon)
  163. {
  164. if (cardSource.CardTraits.Contains("Xros Heart"))
  165. {
  166. return true;
  167. }
  168. if (cardSource.CardTraits.Contains("XrosHeart"))
  169. {
  170. return true;
  171. }
  172. }
  173. }
  174. }
  175. return false;
  176. }
  177. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  178. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  179. return digiXrosCondition;
  180. }
  181. return null;
  182. }
  183. }
  184. if (timing == EffectTiming.None)
  185. {
  186. bool Condition()
  187. {
  188. if (CardEffectCommons.IsExistOnBattleArea(card))
  189. {
  190. if (CardEffectCommons.IsOwnerTurn(card))
  191. {
  192. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Shoutmon"))
  193. {
  194. return true;
  195. }
  196. }
  197. }
  198. return false;
  199. }
  200. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  201. }
  202. return cardEffects;
  203. }
  204. }
  205. }