BT10_057.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_057 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Suspend 1 Digimon, gain Memory and get Pierce", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[When Digivolving] You may suspend 1 of your Digimon. Then, gain 1 memory for each suspended Digimon with [Vegetation], [Plant] or [Fairy] in their traits you have in play. If you gain 2 or more memory by this effect, unsuspend this Digimon and it gains <Piercing> for the turn.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleArea(card);
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  38. {
  39. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  40. {
  41. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  42. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  43. selectPermanentEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: CanSelectPermanentCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: maxCount,
  49. canNoSelect: true,
  50. canEndNotMax: false,
  51. selectPermanentCoroutine: null,
  52. afterSelectPermanentCoroutine: null,
  53. mode: SelectPermanentEffect.Mode.Tap,
  54. cardEffect: activateClass);
  55. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  56. }
  57. int plusMemory = card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent.IsSuspended && (permanent.TopCard.HasPlantTraits || permanent.TopCard.HasFairyTraits));
  58. if (card.Owner.CanAddMemory(activateClass))
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(plusMemory, activateClass));
  61. if (plusMemory >= 2)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  65. }
  66. }
  67. }
  68. }
  69. if (timing == EffectTiming.None)
  70. {
  71. int count()
  72. {
  73. return card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent.IsSuspended) / 2;
  74. }
  75. bool Condition()
  76. {
  77. if (CardEffectCommons.IsExistOnBattleArea(card))
  78. {
  79. if (CardEffectCommons.IsOwnerTurn(card))
  80. {
  81. if (count() >= 1)
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. return false;
  88. }
  89. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(changeValue: () => 2000 * count(), isInheritedEffect: false, card: card, condition: Condition));
  90. }
  91. if (timing == EffectTiming.None)
  92. {
  93. int count()
  94. {
  95. return card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent.IsSuspended) / 2;
  96. }
  97. bool Condition()
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. if (CardEffectCommons.IsOwnerTurn(card))
  102. {
  103. if (count() >= 1)
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect<Func<int>>(changeValue: () => count(), isInheritedEffect: false, card: card, condition: Condition));
  112. }
  113. return cardEffects;
  114. }
  115. }
  116. }