BT1_109.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. public class BT1_109 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] For the turn, the next time you would digivolve one of your green Digimon from level 5 to level 6, decrease the digivolution cost by 4.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  26. }
  27. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  28. {
  29. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  30. yield return new WaitForSeconds(0.2f);
  31. ChangeCostClass changeCostClass = new ChangeCostClass();
  32. Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
  33. changeCostClass.SetUpICardEffect("Digivolution Cost -4", CanUseCondition1, card);
  34. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  35. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: null, timing: EffectTiming.None, getCardEffect: getCardEffect);
  36. ActivateClass activateClass1 = new ActivateClass();
  37. Func<EffectTiming, ICardEffect> getCardEffect1 = GetCardEffect1;
  38. activateClass1.SetUpICardEffect("Remove Effect", CanUseCondition1, card);
  39. activateClass1.SetUpActivateClass(null, ActivateCoroutine1, -1, false, "");
  40. activateClass1.SetIsBackgroundProcess(true);
  41. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: null, timing: EffectTiming.None, getCardEffect: getCardEffect1);
  42. bool CanUseCondition1(Hashtable hashtable)
  43. {
  44. return true;
  45. }
  46. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  47. {
  48. if (CardSourceCondition(cardSource))
  49. {
  50. if (RootCondition(root))
  51. {
  52. if (PermanentsCondition(targetPermanents))
  53. {
  54. Cost -= 4;
  55. }
  56. }
  57. }
  58. return Cost;
  59. }
  60. bool PermanentsCondition(List<Permanent> targetPermanents)
  61. {
  62. if (targetPermanents != null)
  63. {
  64. if (targetPermanents.Count(PermanentCondition) >= 1)
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. bool PermanentCondition(Permanent targetPermanent)
  72. {
  73. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card))
  74. {
  75. if (targetPermanent.TopCard.CardColors.Contains(CardColor.Green))
  76. {
  77. if (targetPermanent.Level == 5 && targetPermanent.TopCard.HasLevel)
  78. {
  79. return true;
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. bool CardSourceCondition(CardSource cardSource)
  86. {
  87. if (cardSource.Level == 6)
  88. {
  89. if (cardSource.HasLevel)
  90. {
  91. return true;
  92. }
  93. }
  94. return false;
  95. }
  96. bool RootCondition(SelectCardEffect.Root root)
  97. {
  98. return true;
  99. }
  100. bool isUpDown()
  101. {
  102. return true;
  103. }
  104. ICardEffect GetCardEffect(EffectTiming _timing)
  105. {
  106. return changeCostClass;
  107. }
  108. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  109. {
  110. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(
  111. hashtable: _hashtable1,
  112. permanentCondition: PermanentCondition,
  113. cardCondition: CardSourceCondition))
  114. {
  115. card.Owner.UntilEachTurnEndEffects.Remove(getCardEffect);
  116. card.Owner.UntilEachTurnEndEffects.Remove(getCardEffect1);
  117. yield return null;
  118. }
  119. }
  120. ICardEffect GetCardEffect1(EffectTiming _timing)
  121. {
  122. if (_timing == EffectTiming.AfterPayCost)
  123. {
  124. return activateClass1;
  125. }
  126. return null;
  127. }
  128. }
  129. }
  130. return cardEffects;
  131. }
  132. }