BT3_109.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 BT3_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] 1 of your Digimon gains \"[On Deletion] Play this card without paying its memory cost. Any [On Play] effects on Digimon played with this effect don't activate\" for the turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  34. {
  35. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  36. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  37. selectPermanentEffect.SetUp(
  38. selectPlayer: card.Owner,
  39. canTargetCondition: CanSelectPermanentCondition,
  40. canTargetCondition_ByPreSelecetedList: null,
  41. canEndSelectCondition: null,
  42. maxCount: maxCount,
  43. canNoSelect: false,
  44. canEndNotMax: false,
  45. selectPermanentCoroutine: SelectPermanentCoroutine,
  46. afterSelectPermanentCoroutine: null,
  47. mode: SelectPermanentEffect.Mode.Custom,
  48. cardEffect: activateClass);
  49. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  50. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  51. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  52. {
  53. Permanent selectedPermanent = permanent;
  54. if (selectedPermanent != null)
  55. {
  56. CardSource _topCard = selectedPermanent.TopCard;
  57. ActivateClass activateClass1 = new ActivateClass();
  58. activateClass1.SetUpICardEffect("Play this card from trash", CanUseCondition1, selectedPermanent.TopCard);
  59. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  60. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  61. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  62. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  63. string EffectDiscription1()
  64. {
  65. return "[On Deletion] Play this card without paying its memory cost. Any [On Play] effects on Digimon played with this effect don't activate";
  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. CardSource TopCard = CardEffectCommons.GetTopCardFromEffectHashtable(hashtable1);
  86. if (TopCard != null)
  87. {
  88. if (CardEffectCommons.IsExistOnTrash(TopCard))
  89. {
  90. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: TopCard, payCost: false, cardEffect: activateClass1))
  91. {
  92. return true;
  93. }
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  100. {
  101. CardSource TopCard = CardEffectCommons.GetTopCardFromEffectHashtable(_hashtable1);
  102. if (TopCard != null)
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  105. cardSources: new List<CardSource>() { TopCard },
  106. activateClass: activateClass1,
  107. payCost: false,
  108. isTapped: false,
  109. root: SelectCardEffect.Root.Trash,
  110. activateETB: false));
  111. }
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. return cardEffects;
  119. }
  120. }