BT6_066.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 BT6_066 : 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. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  16. }
  17. if (timing == EffectTiming.OnDestroyedAnyone)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("De-Digivolve 1 to 1 Digimon", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  22. activateClass.SetHashString("De-Digivolve_BT6_066");
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[Opponent's Turn][Once Per Turn] When one of your other Digimon is deleted, trigger <De-Digivolve 1> on 1 of your opponent's Digimon. (Trash 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.)";
  27. }
  28. bool CanSelectPermanentCondition(Permanent permanent)
  29. {
  30. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  31. }
  32. bool PermanentCondition(Permanent permanent)
  33. {
  34. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  35. {
  36. if (permanent != card.PermanentOfThisCard())
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  48. {
  49. if (CardEffectCommons.IsOpponentTurn(card))
  50. {
  51. return true;
  52. }
  53. }
  54. }
  55. return false;
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleArea(card))
  60. {
  61. return true;
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  68. {
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. Permanent selectedPermanent = permanent;
  88. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  89. }
  90. }
  91. }
  92. }
  93. return cardEffects;
  94. }
  95. }