BT23_009.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Coachmon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_009 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition - Stnd.
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasStandardAppTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Link
  23. if (timing == EffectTiming.OnDeclaration)
  24. {
  25. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  26. }
  27. #endregion
  28. #region Link Condition
  29. if (timing == EffectTiming.None)
  30. {
  31. bool PermanentCondition(Permanent targetPermanent) => targetPermanent.IsDigimon && targetPermanent.TopCard.HasAppmonTraits;
  32. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  33. }
  34. #endregion
  35. #region When Linked - OPT
  36. if (timing == EffectTiming.WhenLinked)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("1 digimon gains 4K DP", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  41. activateClass.SetHashString("BT23-009_WL");
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[Your Turn] [Once Per Turn] When this Digimon gets linked, 1 of your Digimon gets +4000 DP for the turn.";
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  50. && CardEffectCommons.CanTriggerWhenLinked(hashtable, ThisDigimonPermanentCondition, null);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  55. && CardEffectCommons.IsOwnerTurn(card);
  56. }
  57. bool ThisDigimonPermanentCondition(Permanent permanent)
  58. {
  59. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  60. && permanent == card.PermanentOfThisCard();
  61. }
  62. bool CanSelectPermanentCondition(Permanent permanent)
  63. {
  64. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. Permanent selectedPermanent = null;
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectPermanentCoroutine,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. selectedPermanent = permanent;
  88. yield return null;
  89. }
  90. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to gain 4K DP", "Opponent is selecting 1 digimon to gain 4K DP");
  91. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  92. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  93. targetPermanent: selectedPermanent,
  94. changeValue: 4000,
  95. effectDuration: EffectDuration.UntilEachTurnEnd,
  96. activateClass: activateClass));
  97. }
  98. }
  99. }
  100. #endregion
  101. #region End of Your Turn - OPT
  102. if (timing == EffectTiming.OnEndTurn)
  103. {
  104. ActivateClass activateClass = new ActivateClass();
  105. activateClass.SetUpICardEffect("This digimon may attack a player", CanUseCondition, card);
  106. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  107. activateClass.SetIsLinkedEffect(true);
  108. activateClass.SetHashString("BT23-009_OET");
  109. cardEffects.Add(activateClass);
  110. string EffectDiscription()
  111. {
  112. return "[End of Your Turn] [Once Per Turn] This Digimon may attack a player.";
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  121. && CardEffectCommons.IsOwnerTurn(card);
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable hashtable)
  124. {
  125. if (card.PermanentOfThisCard().CanAttack(activateClass))
  126. {
  127. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  128. selectAttackEffect.SetUp(
  129. attacker: card.PermanentOfThisCard(),
  130. canAttackPlayerCondition: () => true,
  131. defenderCondition: (permanent) => false,
  132. cardEffect: activateClass);
  133. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  134. }
  135. }
  136. }
  137. #endregion
  138. return cardEffects;
  139. }
  140. }
  141. }