BT23_041.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Kabuterimon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_041 : 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
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasCSTraits
  18. && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel3;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 2,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Alliance
  30. if (timing == EffectTiming.OnAllyAttack)
  31. {
  32. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  33. }
  34. #endregion
  35. #region All Turns - OPT
  36. if (timing == EffectTiming.OnTappedAnyone)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("1 digimon gains <Piercing> and 3K DP", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  41. activateClass.SetHashString("BT23_041_AT");
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[All Turns] [Once Per Turn] When this Digimon suspends, 1 of your Digimon gains <Piercing> and +3000 DP for the turn.";
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  50. && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  55. }
  56. bool CanSelectPermamentCondition(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermamentCondition))
  63. {
  64. Permanent selectedPermament = null;
  65. #region Select Permanent
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermamentCondition));
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectPermamentCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: SelectPermanentCoroutine,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  81. {
  82. selectedPermament = permanent;
  83. yield return null;
  84. }
  85. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to gain <Piercing> and 3K DP.", "The opponent is selecting 1 digimon to gain <Piercing> and 3K DP.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. #endregion
  88. if (selectedPermament != null)
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  91. targetPermanent: selectedPermament,
  92. effectDuration: EffectDuration.UntilEachTurnEnd,
  93. activateClass: activateClass));
  94. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  95. targetPermanent: selectedPermament,
  96. changeValue: 3000,
  97. effectDuration: EffectDuration.UntilEachTurnEnd,
  98. activateClass: activateClass));
  99. }
  100. }
  101. }
  102. }
  103. #endregion
  104. return cardEffects;
  105. }
  106. }
  107. }