EX11_011.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. // Dinomon
  8. public class EX11_011 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return (targetPermanent.TopCard.EqualsTraits("Dinosaur") || targetPermanent.TopCard.ContainsCardName("Tyrannomon"))
  19. && targetPermanent.TopCard.IsLevel5;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Security Attack +1
  25. if (timing == EffectTiming.None)
  26. {
  27. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region Fortitude
  31. if (timing == EffectTiming.OnDestroyedAnyone)
  32. {
  33. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. #endregion
  36. #region On Play/When Digivolving Shared
  37. string SharedEffectName = "May suspend 1 Digimon. Delete all but highest play cost for each player.";
  38. string SharedEffectDescription(string tag) => $"[{tag}] You may suspend 1 Digimon. Then, choose 1 of each player's Digimon with the highest play cost and delete all other Digimon.";
  39. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  40. bool IsDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  41. bool IsMaxCostOwnersDigimon(Permanent permanent) => CardEffectCommons.IsMaxCost(permanent, card.Owner, true);
  42. bool IsMaxCostOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsMaxCost(permanent, card.Owner.Enemy, true);
  43. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  44. {
  45. SelectPermanentEffect suspendPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. suspendPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: IsDigimonCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: 1,
  52. canNoSelect: true,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: null,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Tap,
  57. cardEffect: activateClass);
  58. yield return ContinuousController.instance.StartCoroutine(suspendPermanentEffect.Activate());
  59. List<Permanent> selectedPermanents = new List<Permanent>();
  60. IEnumerator selectPermanentCoroutine(Permanent permanent)
  61. {
  62. selectedPermanents.Add(permanent);
  63. yield return null;
  64. }
  65. if (card.Owner.GetBattleAreaDigimons().Count > 1)
  66. {
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsMaxCostOwnersDigimon));
  69. selectPermanentEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: IsMaxCostOwnersDigimon,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: maxCount,
  75. canNoSelect: false,
  76. canEndNotMax: false,
  77. selectPermanentCoroutine: selectPermanentCoroutine,
  78. afterSelectPermanentCoroutine: null,
  79. mode: SelectPermanentEffect.Mode.Custom,
  80. cardEffect: activateClass);
  81. selectPermanentEffect.SetUpCustomMessage("Select 1 of your highest cost Digimon, the rest will be deleted.", "Opponent is selecting which of their Digimon they will not delete.");
  82. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  83. }
  84. else if (card.Owner.GetBattleAreaDigimons().Count == 1)
  85. {
  86. selectedPermanents.Add(card.Owner.GetBattleAreaDigimons()[0]);
  87. }
  88. if (card.Owner.Enemy.GetBattleAreaDigimons().Count > 1)
  89. {
  90. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  91. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsMaxCostOpponentsDigimon));
  92. selectPermanentEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: IsMaxCostOpponentsDigimon,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: 1,
  98. canNoSelect: false,
  99. canEndNotMax: false,
  100. selectPermanentCoroutine: selectPermanentCoroutine,
  101. afterSelectPermanentCoroutine: null,
  102. mode: SelectPermanentEffect.Mode.Custom,
  103. cardEffect: activateClass);
  104. selectPermanentEffect.SetUpCustomMessage("Select 1 of your opponent's highest cost Digimon, the rest will be deleted.", "Opponent is selecting which of your Digimon they will not delete.");
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. }
  107. else if (card.Owner.Enemy.GetBattleAreaDigimons().Count == 1)
  108. {
  109. selectedPermanents.Add(card.Owner.Enemy.GetBattleAreaDigimons()[0]);
  110. }
  111. List<Permanent> DestroyTargetPermanents = GManager.instance.turnStateMachine.gameContext.Players.Map(player => player.GetBattleAreaDigimons()).Flat().Except(selectedPermanents).ToList();
  112. if (DestroyTargetPermanents.Count > 0)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(DestroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  115. }
  116. }
  117. #endregion
  118. #region On Play
  119. if (timing == EffectTiming.OnEnterFieldAnyone)
  120. {
  121. ActivateClass activateClass = new ActivateClass();
  122. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  123. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  124. cardEffects.Add(activateClass);
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerOnPlay(hashtable, card) &&
  128. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  129. }
  130. }
  131. #endregion
  132. #region When Digivolving
  133. if (timing == EffectTiming.OnEnterFieldAnyone)
  134. {
  135. ActivateClass activateClass = new ActivateClass();
  136. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  137. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  138. cardEffects.Add(activateClass);
  139. bool CanUseCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  142. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  143. }
  144. }
  145. #endregion
  146. #region Opponent's Turn
  147. if (timing == EffectTiming.None)
  148. {
  149. bool AttackerCondition(Permanent permanent)
  150. {
  151. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  152. }
  153. bool DefenderCondition(Permanent permanent)
  154. {
  155. return !(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  156. && permanent.IsSuspended);
  157. }
  158. bool Condition()
  159. {
  160. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  161. && CardEffectCommons.IsOpponentTurn(card)
  162. && card.PermanentOfThisCard().IsSuspended;
  163. }
  164. string effectName = "While this Digimon is suspended, all of your opponent's Digimon can only attack suspended Digimon.";
  165. cardEffects.Add(CardEffectFactory.CanNotAttackStaticEffect(
  166. attackerCondition: AttackerCondition,
  167. defenderCondition: DefenderCondition,
  168. isInheritedEffect: false,
  169. card: card,
  170. condition: Condition,
  171. effectName: effectName
  172. ));
  173. }
  174. #endregion
  175. return cardEffects;
  176. }
  177. }
  178. }