BT9_009.cs 5.1 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. public class BT9_009 : 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.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Guilmon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] Delete 1 of your opponent's Digimon with 3000 DP or less.";
  30. }
  31. bool CanSelectPermanentCondition(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  34. {
  35. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  51. {
  52. return true;
  53. }
  54. }
  55. return false;
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  58. {
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectPermanentCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: maxCount,
  69. canNoSelect: false,
  70. canEndNotMax: false,
  71. selectPermanentCoroutine: null,
  72. afterSelectPermanentCoroutine: null,
  73. mode: SelectPermanentEffect.Mode.Destroy,
  74. cardEffect: activateClass);
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. }
  77. }
  78. }
  79. if (timing == EffectTiming.None)
  80. {
  81. ChangeDPDeleteEffectMaxDPClass changeDPDeleteEffectMaxDPClass = new ChangeDPDeleteEffectMaxDPClass();
  82. changeDPDeleteEffectMaxDPClass.SetUpICardEffect("Maximum DP of DP-based deletion effects gets +1000 DP", CanUseCondition, card);
  83. changeDPDeleteEffectMaxDPClass.SetUpChangeDPDeleteEffectMaxDPClass(changeMaxDP: ChangeMaxDP);
  84. changeDPDeleteEffectMaxDPClass.SetIsInheritedEffect(true);
  85. cardEffects.Add(changeDPDeleteEffectMaxDPClass);
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. if (isExistOnField(card))
  89. {
  90. if (CardEffectCommons.IsOwnerTurn(card))
  91. {
  92. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. int ChangeMaxDP(int maxDP, ICardEffect cardEffect)
  101. {
  102. if (cardEffect != null)
  103. {
  104. if (cardEffect.EffectSourceCard != null)
  105. {
  106. if (cardEffect.EffectSourceCard.Owner == card.Owner)
  107. {
  108. maxDP += 1000;
  109. }
  110. }
  111. }
  112. return maxDP;
  113. }
  114. }
  115. return cardEffects;
  116. }
  117. }