BT22_014.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Gaiomon
  4. namespace DCGO.CardEffects.BT22
  5. {
  6. public class BT22_014 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel5 &&
  17. (targetPermanent.TopCard.HasCSTraits || targetPermanent.TopCard.HasGreymonName);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 4,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Static Effects
  29. #region Card Name
  30. if (timing == EffectTiming.None)
  31. {
  32. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  33. changeCardNamesClass.SetUpICardEffect("Also treated as having [Greymon]", hashtable => true, card);
  34. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  35. cardEffects.Add(changeCardNamesClass);
  36. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  37. {
  38. if (cardSource == card)
  39. {
  40. CardNames.Add("Greymon_BT22_014");
  41. }
  42. return CardNames;
  43. }
  44. }
  45. #endregion
  46. //Raid
  47. if (timing == EffectTiming.OnAllyAttack)
  48. {
  49. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  50. }
  51. //Reboot
  52. if (timing == EffectTiming.None)
  53. {
  54. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  55. }
  56. #endregion
  57. #region When Digivolving
  58. if (timing == EffectTiming.OnEnterFieldAnyone)
  59. {
  60. ActivateClass activateClass = new ActivateClass();
  61. activateClass.SetUpICardEffect("Unsuspend 1, then attack", CanUseCondition, card);
  62. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[When Digivolving] You may unsuspend 1 of your opponent's Digimon. Then, this Digimon may attack.";
  67. }
  68. bool IsOpponentsDigimon(Permanent permanent)
  69. {
  70. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  71. }
  72. bool CanUseCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  75. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  76. }
  77. bool CanActivateCondition(Hashtable hashtable)
  78. {
  79. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  80. }
  81. IEnumerator ActivateCoroutine(Hashtable hashtable)
  82. {
  83. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  84. {
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: IsOpponentsDigimon,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: 1,
  92. canNoSelect: true,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: null,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.UnTap,
  97. cardEffect: activateClass);
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. }
  100. if (CardEffectCommons.IsExistOnBattleArea(card))
  101. {
  102. if (card.PermanentOfThisCard().CanAttack(activateClass))
  103. {
  104. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  105. selectAttackEffect.SetUp(
  106. attacker: card.PermanentOfThisCard(),
  107. canAttackPlayerCondition: () => true,
  108. defenderCondition: (permanent) => true,
  109. cardEffect: activateClass);
  110. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  111. }
  112. }
  113. }
  114. }
  115. #endregion
  116. #region All Turns - OPT
  117. if (timing == EffectTiming.OnAttackTargetChanged)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("Gain Piercing, +5000 DP", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  122. activateClass.SetHashString("AllTurns_BT22-014");
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[All Turns] [Once Per Turn] When attack targets change, this Digimon gains <Piercing> (When this Digimon attacks and deletes an opponent's Digimon and survives the battle, it performs any security checks it normally would.) and +5000 DP for the turn.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  131. CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => true);
  132. }
  133. bool CanActivateCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable hashtable)
  138. {
  139. Permanent permanent = card.PermanentOfThisCard();
  140. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  141. targetPermanent: permanent,
  142. effectDuration: EffectDuration.UntilEachTurnEnd,
  143. activateClass: activateClass));
  144. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  145. targetPermanent: permanent,
  146. changeValue: 5000,
  147. effectDuration: EffectDuration.UntilEachTurnEnd,
  148. activateClass: activateClass));
  149. }
  150. }
  151. #endregion
  152. return cardEffects;
  153. }
  154. }
  155. }