EX10_073.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //EX10 Deusmon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_073 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static effects
  13. #region Alternative Digivolution Cost
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasUltimateAppTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Link +1
  24. if (timing == EffectTiming.None) cardEffects.Add(CardEffectFactory.ChangeSelfLinkMaxStaticEffect(1, false, card, null));
  25. #endregion
  26. #region Security Atk +1
  27. if (timing == EffectTiming.None)
  28. {
  29. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  30. }
  31. #endregion
  32. #region App Fusion (Warudamon & Cometmon)
  33. if (timing == EffectTiming.None)
  34. {
  35. cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List<string>() { "Warudamon", "Cometmon" }, card));
  36. }
  37. #endregion
  38. #endregion
  39. #region When Digivolving/EoOT shared
  40. bool CanActivateConditionShared(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  43. && (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectLinkCard)
  44. || CardEffectCommons.HasMatchConditionOwnersPermanent(card, ThisPermamentCondition));
  45. }
  46. bool CanSelectLinkCard(CardSource cardSource)
  47. {
  48. return cardSource.IsDigimon
  49. && cardSource.CanLinkToTargetPermanent(card.PermanentOfThisCard(), false);
  50. }
  51. bool ThisPermamentCondition(Permanent permanent)
  52. {
  53. return permanent == card.PermanentOfThisCard()
  54. && permanent.DigivolutionCards.Exists(CanSelectLinkCard);
  55. }
  56. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  57. {
  58. bool hasInHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectLinkCard);
  59. bool hasInSources = card.PermanentOfThisCard().DigivolutionCards.Exists(CanSelectLinkCard);
  60. CardSource selectedCard = null;
  61. IEnumerator SelectCardCoroutine(CardSource cardSource)
  62. {
  63. selectedCard = cardSource;
  64. yield return null;
  65. }
  66. if (hasInHand)
  67. {
  68. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  69. selectHandEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: CanSelectLinkCard,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: 1,
  75. canNoSelect: true,
  76. canEndNotMax: false,
  77. isShowOpponent: true,
  78. selectCardCoroutine: SelectCardCoroutine,
  79. afterSelectCardCoroutine: null,
  80. mode: SelectHandEffect.Mode.Custom,
  81. cardEffect: activateClass);
  82. selectHandEffect.SetUpCustomMessage("Select 1 card to link", "The opponent is selecting 1 card to link");
  83. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  84. if (selectedCard != null)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddLinkCard(selectedCard, activateClass));
  87. selectedCard = null;
  88. }
  89. }
  90. if (hasInSources)
  91. {
  92. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  93. selectCardEffect.SetUp(
  94. canTargetCondition: CanSelectLinkCard,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. canNoSelect: () => true,
  98. selectCardCoroutine: SelectCardCoroutine,
  99. afterSelectCardCoroutine: null,
  100. message: "Select 1 card to link.",
  101. maxCount: 1,
  102. canEndNotMax: false,
  103. isShowOpponent: true,
  104. mode: SelectCardEffect.Mode.Custom,
  105. root: SelectCardEffect.Root.DigivolutionCards,
  106. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  107. canLookReverseCard: true,
  108. selectPlayer: card.Owner,
  109. cardEffect: activateClass);
  110. selectCardEffect.SetUpCustomMessage("Select 1 card to link", "The opponent is selecting 1 card to link");
  111. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  112. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddLinkCard(selectedCard, activateClass));
  113. }
  114. }
  115. #endregion
  116. #region When Digivolving
  117. if (timing == EffectTiming.OnEnterFieldAnyone)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("Add new links to this digimon", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateConditionShared, (hashtable) => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  122. cardEffects.Add(activateClass);
  123. string EffectDiscription()
  124. => "[When Digivolving] You may link 1 Digimon card from your hand to this Digimon without paying the cost. Then, you may link 1 Digimon card from this Digimon's digivolution cards to this Digimon without paying the cost.";
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  128. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  129. }
  130. }
  131. #endregion
  132. #region End Of Opponent's Turn
  133. if (timing == EffectTiming.OnEndTurn)
  134. {
  135. ActivateClass activateClass = new ActivateClass();
  136. activateClass.SetUpICardEffect("Add new links to this digimon", CanUseCondition, card);
  137. activateClass.SetUpActivateClass(CanActivateConditionShared, (hashtable) => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. => "[End Of Opponent's Turn] You may link 1 Digimon card from your hand to this Digimon without paying the cost. Then, you may link 1 Digimon card from this Digimon's digivolution cards to this Digimon without paying the cost.";
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  144. && CardEffectCommons.IsOpponentTurn(card);
  145. }
  146. }
  147. #endregion
  148. #region All Turns
  149. if (timing == EffectTiming.OnLinkCardDiscarded)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("Delete when trash", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  154. activateClass.SetHashString("EX10-073AllTurns");
  155. cardEffects.Add(activateClass);
  156. string EffectDescription() => "[All Turns] [Once Per Turn] When effects trash any of this Digimon's link cards, delete 1 of your opponent's Digimon with the lowest play cost.";
  157. bool CanUseCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  160. CardEffectCommons.CanTriggerOnTrashLinkedCard(hashtable, perm => perm == card.PermanentOfThisCard(), cardEffect => cardEffect != null, source => source != null);
  161. }
  162. bool CanActivateCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  165. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon);
  166. }
  167. bool IsOpponentsDigimon(Permanent permanent)
  168. {
  169. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  170. && CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true, null);
  171. }
  172. IEnumerator ActivateCoroutine(Hashtable hashtable)
  173. {
  174. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))
  175. {
  176. #region Delete Lowest Play Cost Digimon
  177. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentsDigimon));
  178. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  179. selectPermanentEffect.SetUp(
  180. selectPlayer: card.Owner,
  181. canTargetCondition: IsOpponentsDigimon,
  182. canTargetCondition_ByPreSelecetedList: null,
  183. canEndSelectCondition: null,
  184. maxCount: maxCount,
  185. canNoSelect: false,
  186. canEndNotMax: false,
  187. selectPermanentCoroutine: null,
  188. afterSelectPermanentCoroutine: null,
  189. mode: SelectPermanentEffect.Mode.Destroy,
  190. cardEffect: activateClass);
  191. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  192. #endregion
  193. }
  194. }
  195. }
  196. #endregion
  197. return cardEffects;
  198. }
  199. }
  200. }