BT11_104.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_104 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. ChangeCostClass changeCostClass = new ChangeCostClass();
  15. changeCostClass.SetUpICardEffect($"Play Cost -1", CanUseCondition, card);
  16. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  17. cardEffects.Add(changeCostClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardColors.Contains(CardColor.Green) && permanent.IsTamer))
  21. {
  22. return true;
  23. }
  24. return false;
  25. }
  26. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  27. {
  28. if (CardSourceCondition(cardSource))
  29. {
  30. if (RootCondition(root))
  31. {
  32. if (PermanentsCondition(targetPermanents))
  33. {
  34. Cost -= 1;
  35. }
  36. }
  37. }
  38. return Cost;
  39. }
  40. bool PermanentsCondition(List<Permanent> targetPermanents)
  41. {
  42. return true;
  43. }
  44. bool CardSourceCondition(CardSource cardSource)
  45. {
  46. return cardSource == card;
  47. }
  48. bool RootCondition(SelectCardEffect.Root root)
  49. {
  50. return true;
  51. }
  52. bool isUpDown()
  53. {
  54. return true;
  55. }
  56. }
  57. if (timing == EffectTiming.OptionSkill)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  61. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  62. cardEffects.Add(activateClass);
  63. string EffectDiscription()
  64. {
  65. return "[Main] 1 of your Digimon gets +5000 DP and gains <Rush> for the turn. (This Digimon may attack the turn it was played.) Then, 1 of your Digimon may attack your opponent's Digimon.";
  66. }
  67. bool CanSelectPermanentCondition(Permanent permanent)
  68. {
  69. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  70. }
  71. bool CanSelectPermanentCondition1(Permanent permanent)
  72. {
  73. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  74. {
  75. if (permanent.CanAttack(activateClass))
  76. {
  77. if (card.Owner.Enemy.GetBattleAreaDigimons().Count((enemyDigimon) => permanent.CanAttackTargetDigimon(enemyDigimon, activateClass)) >= 1)
  78. {
  79. return true;
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. List<Permanent> selectedPermanents = new List<Permanent>();
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  93. {
  94. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectPermanentCondition,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCount,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: SelectPermanentCoroutine,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Custom,
  107. cardEffect: activateClass);
  108. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP +5000 and Rush.", "The opponent is selecting 1 Digimon that will get DP +5000 and Rush.");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  113. targetPermanent: permanent,
  114. changeValue: 5000,
  115. effectDuration: EffectDuration.UntilEachTurnEnd,
  116. activateClass: activateClass));
  117. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  118. targetPermanent: permanent,
  119. effectDuration: EffectDuration.UntilEachTurnEnd,
  120. activateClass: activateClass));
  121. }
  122. }
  123. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  124. {
  125. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  126. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  127. selectPermanentEffect.SetUp(
  128. selectPlayer: card.Owner,
  129. canTargetCondition: CanSelectPermanentCondition1,
  130. canTargetCondition_ByPreSelecetedList: null,
  131. canEndSelectCondition: null,
  132. maxCount: maxCount,
  133. canNoSelect: true,
  134. canEndNotMax: false,
  135. selectPermanentCoroutine: null,
  136. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  137. mode: SelectPermanentEffect.Mode.Custom,
  138. cardEffect: activateClass);
  139. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "The opponent is selecting 1 Digimon that will attack.");
  140. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  141. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  142. {
  143. selectedPermanents = permanents;
  144. yield return null;
  145. }
  146. foreach (Permanent permanent in selectedPermanents)
  147. {
  148. Permanent selectedPermanent = permanent;
  149. if (selectedPermanent != null)
  150. {
  151. if (selectedPermanent.CanAttack(activateClass))
  152. {
  153. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  154. selectAttackEffect.SetUp(
  155. attacker: selectedPermanent,
  156. canAttackPlayerCondition: () => false,
  157. defenderCondition: (permanent) => true,
  158. cardEffect: activateClass);
  159. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. if (timing == EffectTiming.SecuritySkill)
  167. {
  168. ActivateClass activateClass = new ActivateClass();
  169. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  170. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  171. activateClass.SetIsSecurityEffect(true);
  172. cardEffects.Add(activateClass);
  173. string EffectDiscription()
  174. {
  175. return "[Security] Add this card to its owner's hand.";
  176. }
  177. bool CanUseCondition(Hashtable hashtable)
  178. {
  179. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  180. }
  181. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  182. {
  183. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  184. }
  185. }
  186. return cardEffects;
  187. }
  188. }
  189. }