P_241.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Yujin Ozora
  6. namespace DCGO.CardEffects.P
  7. {
  8. public class P_241 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Your Turn
  14. if (timing == EffectTiming.OnStartTurn)
  15. {
  16. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  17. }
  18. #endregion
  19. #region Your Turn - When Linked
  20. if (timing == EffectTiming.WhenLinked)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("1 of your [Appmon] gains <Vortex> and +3K DP for turn, then you may app fuse", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  25. cardEffects.Add(activateClass);
  26. string EffectDescription()
  27. {
  28. return "[Your Turn] When your Digimon get linked, by suspending this Tamer, 1 of your Digimon with the [Appmon] trait gains <Vortex> and +3000 DP for the turn. Then, 1 of your Digimon may app fuse into a Digimon card in the hand.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  33. && CardEffectCommons.IsOwnerTurn(card)
  34. && CardEffectCommons.CanTriggerWhenLinked(hashtable, LinkPermanentCondition, null);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  39. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  40. }
  41. bool LinkPermanentCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  44. }
  45. bool CanSelectFusePermanentCondition(Permanent permanent)
  46. {
  47. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  48. {
  49. foreach(CardSource hand in card.Owner.HandCards)
  50. {
  51. if (hand.appFusionCondition != null)
  52. {
  53. if (hand.CanAppFusionFromTargetPermanent(permanent, true))
  54. return true;
  55. }
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanSelectCardCondition(CardSource card, Permanent permanent)
  61. {
  62. return CardEffectCommons.IsExistOnHand(card)
  63. && card.appFusionCondition != null
  64. && card.CanAppFusionFromTargetPermanent(permanent, true);
  65. }
  66. bool CanSelectBuffPermanentCondition(Permanent permanent)
  67. {
  68. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  69. && permanent.TopCard.EqualsTraits("Appmon");
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable hashtable)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  74. #region Give DP and Vortex
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectBuffPermanentCondition))
  76. {
  77. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectBuffPermanentCondition));
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectBuffPermanentCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: maxCount,
  85. canNoSelect: false,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: SelectPermanentCoroutine,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Custom,
  90. cardEffect: activateClass);
  91. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to give <Vortex> and +3000 DP", "The opponent is selecting 1 Digimon to give <Vortex> and +3000 DP");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainVortex(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  96. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  97. }
  98. }
  99. #endregion
  100. #region App Fuse
  101. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectFusePermanentCondition))
  102. {
  103. Permanent selectedPermanent = null;
  104. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, CanSelectFusePermanentCondition));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectFusePermanentCondition,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. maxCount: maxCount,
  112. canNoSelect: true,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: SelectPermanentCoroutine,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to app fuse", "The opponent is selecting 1 digimon to app fuse");
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  121. {
  122. selectedPermanent = permanent;
  123. yield return null;
  124. }
  125. if (selectedPermanent != null)
  126. {
  127. CardSource selectedCard = null;
  128. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, handCard => CanSelectCardCondition(handCard, selectedPermanent)));
  129. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  130. selectHandEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: handCard => CanSelectCardCondition(handCard, selectedPermanent),
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: maxCount1,
  136. canNoSelect: true,
  137. canEndNotMax: false,
  138. isShowOpponent: true,
  139. selectCardCoroutine: SelectCardCoroutine,
  140. afterSelectCardCoroutine: null,
  141. mode: SelectHandEffect.Mode.Custom,
  142. cardEffect: activateClass);
  143. selectHandEffect.SetUpCustomMessage("Select digimon to app fuse into.", "The opponent is selecting digimon to app fuse into.");
  144. selectHandEffect.SetUpCustomMessage_ShowCard("Selected digimon");
  145. yield return StartCoroutine(selectHandEffect.Activate());
  146. IEnumerator SelectCardCoroutine(CardSource cardSource)
  147. {
  148. selectedCard = cardSource;
  149. yield return null;
  150. }
  151. if (selectedCard != null && selectedCard.CanAppFusionFromTargetPermanent(selectedPermanent, true))
  152. {
  153. CardSource linkCard = selectedPermanent.LinkedCards.Where(x => selectedCard.appFusionCondition.linkedCondition(selectedPermanent, x)).First();
  154. PlayCardClass playCardClass = new PlayCardClass(new List<CardSource> { selectedCard }, hashtable, true, selectedPermanent, false, SelectCardEffect.Root.Hand, true);
  155. playCardClass.SetAppFusion(new int[] { selectedPermanent.PermanentFrame.FrameID, selectedPermanent.LinkedCards.IndexOf(linkCard) });
  156. yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
  157. }
  158. }
  159. }
  160. #endregion
  161. }
  162. }
  163. #endregion
  164. #region Security
  165. if (timing == EffectTiming.SecuritySkill)
  166. {
  167. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }