BT6_104.cs 6.7 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 BT6_104 : 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] Gain 2 memory\" until the end of your opponent's next turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  26. {
  27. if(permanent.IsDigimon || permanent.IsToken)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  41. {
  42. int maxCount = 1;
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: CanSelectPermanentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: SelectPermanentCoroutine,
  53. afterSelectPermanentCoroutine: null,
  54. mode: SelectPermanentEffect.Mode.Custom,
  55. cardEffect: activateClass);
  56. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  59. {
  60. Permanent selectedPermanent = permanent;
  61. if (selectedPermanent != null)
  62. {
  63. CardSource _topCard = selectedPermanent.TopCard;
  64. ActivateClass activateClass1 = new ActivateClass();
  65. activateClass1.SetUpICardEffect("Memory +2", CanUseCondition1, selectedPermanent.TopCard);
  66. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  67. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  68. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  69. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  70. string EffectDiscription1()
  71. {
  72. return "[On Deletion] Gain 2 memory.";
  73. }
  74. bool CanUseCondition1(Hashtable hashtable1)
  75. {
  76. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  77. {
  78. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent, activateClass))
  79. {
  80. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  81. {
  82. return true;
  83. }
  84. }
  85. }
  86. return false;
  87. }
  88. bool CanActivateCondition1(Hashtable hashtable1)
  89. {
  90. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  91. {
  92. if (_topCard.Owner.CanAddMemory(activateClass1))
  93. {
  94. return true;
  95. }
  96. }
  97. return false;
  98. }
  99. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(_topCard.Owner.AddMemory(2, activateClass1));
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. if (timing == EffectTiming.SecuritySkill)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  112. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  113. activateClass.SetIsSecurityEffect(true);
  114. cardEffects.Add(activateClass);
  115. string EffectDiscription()
  116. {
  117. return "[Security] Add this card to its owner's hand.";
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  124. {
  125. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  126. }
  127. }
  128. return cardEffects;
  129. }
  130. }