BT6_102.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. public class BT6_102 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OptionSkill)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  14. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[Main] 1 of your opponent's Digimon gains \"[On Deletion] Lose 2 memory\" until the end of their next turn.";
  19. }
  20. bool CanSelectPermanentCondition(Permanent permanent)
  21. {
  22. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  27. }
  28. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  29. {
  30. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  31. {
  32. int maxCount = 1;
  33. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  34. selectPermanentEffect.SetUp(
  35. selectPlayer: card.Owner,
  36. canTargetCondition: CanSelectPermanentCondition,
  37. canTargetCondition_ByPreSelecetedList: null,
  38. canEndSelectCondition: null,
  39. maxCount: maxCount,
  40. canNoSelect: false,
  41. canEndNotMax: false,
  42. selectPermanentCoroutine: SelectPermanentCoroutine,
  43. afterSelectPermanentCoroutine: null,
  44. mode: SelectPermanentEffect.Mode.Custom,
  45. cardEffect: activateClass);
  46. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  47. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  48. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  49. {
  50. Permanent selectedPermanent = permanent;
  51. if (selectedPermanent != null)
  52. {
  53. CardSource _topCard = selectedPermanent.TopCard;
  54. ActivateClass activateClass1 = new ActivateClass();
  55. activateClass1.SetUpICardEffect("Memory -2", CanUseCondition1, selectedPermanent.TopCard);
  56. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  57. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  58. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  59. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  62. }
  63. string EffectDiscription1()
  64. {
  65. return "[On Deletion] Lose 2 memory.";
  66. }
  67. bool CanUseCondition1(Hashtable hashtable1)
  68. {
  69. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  70. {
  71. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent, activateClass))
  72. {
  73. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  74. {
  75. return true;
  76. }
  77. }
  78. }
  79. return false;
  80. }
  81. bool CanActivateCondition1(Hashtable hashtable1)
  82. {
  83. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  84. {
  85. return true;
  86. }
  87. return false;
  88. }
  89. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(_topCard.Owner.AddMemory(-2, activateClass1));
  92. }
  93. }
  94. }
  95. }
  96. }
  97. }
  98. return cardEffects;
  99. }
  100. }