BT10_068.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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_068 : 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. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.CardNames.Contains("Gankoomon");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. if (timing == EffectTiming.None)
  24. {
  25. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Play 1 Digimon from hand or trash and your Digimon get effects", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "[When Digivolving] You may play 1 Digimon card with [Sistermon] in its name from your hand or trash without paying its memory cost. Then, if [Gankoomon] is in this Digimon's digivolution cards or you have a Digimon with [Sistermon] in its name in play, until the end of your opponent's turn, all of your Digimon get +2000 DP and your opponent's effects can't return them to hands or decks or reduce their DP.";
  36. }
  37. bool CanSelectCardCondition(CardSource cardSource)
  38. {
  39. if (cardSource.IsDigimon)
  40. {
  41. if (cardSource.ContainsCardName("Sistermon"))
  42. {
  43. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (card.Owner.HandCards.Count >= 1)
  60. {
  61. return true;
  62. }
  63. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  64. {
  65. return true;
  66. }
  67. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Gankoomon")) >= 1)
  68. {
  69. return true;
  70. }
  71. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Sistermon")))
  72. {
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  79. {
  80. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  81. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  82. if (canSelectHand || canSelectTrash)
  83. {
  84. if (canSelectHand && canSelectTrash)
  85. {
  86. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  87. {
  88. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  89. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  90. };
  91. string selectPlayerMessage = "From which area do you play a card?";
  92. string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
  93. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  94. }
  95. else
  96. {
  97. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  98. }
  99. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  100. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  101. List<CardSource> selectedCards = new List<CardSource>();
  102. IEnumerator SelectCardCoroutine(CardSource cardSource)
  103. {
  104. selectedCards.Add(cardSource);
  105. yield return null;
  106. }
  107. if (fromHand)
  108. {
  109. int maxCount = 1;
  110. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  111. selectHandEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition: CanSelectCardCondition,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: maxCount,
  117. canNoSelect: true,
  118. canEndNotMax: false,
  119. isShowOpponent: true,
  120. selectCardCoroutine: SelectCardCoroutine,
  121. afterSelectCardCoroutine: null,
  122. mode: SelectHandEffect.Mode.Custom,
  123. cardEffect: activateClass);
  124. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  125. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. }
  128. else
  129. {
  130. int maxCount = 1;
  131. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  132. selectCardEffect.SetUp(
  133. canTargetCondition: CanSelectCardCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. canNoSelect: () => true,
  137. selectCardCoroutine: SelectCardCoroutine,
  138. afterSelectCardCoroutine: null,
  139. message: "Select 1 card to play.",
  140. maxCount: maxCount,
  141. canEndNotMax: false,
  142. isShowOpponent: true,
  143. mode: SelectCardEffect.Mode.Custom,
  144. root: SelectCardEffect.Root.Trash,
  145. customRootCardList: null,
  146. canLookReverseCard: true,
  147. selectPlayer: card.Owner,
  148. cardEffect: activateClass);
  149. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  150. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  151. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  152. }
  153. SelectCardEffect.Root root = SelectCardEffect.Root.Hand;
  154. if (!fromHand)
  155. {
  156. root = SelectCardEffect.Root.Trash;
  157. }
  158. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: root, activateETB: true));
  159. }
  160. if ((CardEffectCommons.IsExistOnBattleArea(card) && card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Gankoomon")) >= 1) || CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Sistermon")))
  161. {
  162. bool PermanentCondition(Permanent permanent)
  163. {
  164. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  165. }
  166. bool CardEffectCondition(ICardEffect cardEffect)
  167. {
  168. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  169. }
  170. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  171. permanentCondition: PermanentCondition,
  172. changeValue: 2000,
  173. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  174. activateClass: activateClass));
  175. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHandPlayerEffect(
  176. permanentCondition: PermanentCondition,
  177. cardEffectCondition: CardEffectCondition,
  178. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  179. activateClass: activateClass,
  180. effectName: "Can't return to hand by opponent's effect"));
  181. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeckPlayerEffect(
  182. permanentCondition: PermanentCondition,
  183. cardEffectCondition: CardEffectCondition,
  184. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  185. activateClass: activateClass,
  186. effectName: "Can't return to deck by opponent's effect"));
  187. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainImmuneFromDPMinusPlayerEffect(
  188. permanentCondition: PermanentCondition,
  189. cardEffectCondition: CardEffectCondition,
  190. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  191. activateClass: activateClass,
  192. effectName: "Can't have DP reduced by opponent's effect"));
  193. }
  194. }
  195. }
  196. return cardEffects;
  197. }
  198. }
  199. }