BT4_098.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 BT4_098 : 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 with [Hybrid] in its form gets +3000 DP, <Security Attack +1> (This Digimon checks 1 additional security card), and \"[Your Turn] When this Digimon is blocked, gain + 3 memory\" for the turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.TopCard.CardTraits.Contains("Hybrid"))
  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 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  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(
  57. "Select 1 Digimon that will get effects.",
  58. "The opponent is selecting 1 Digimon that will get effects.");
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  63. targetPermanent: permanent,
  64. changeValue: 3000,
  65. effectDuration: EffectDuration.UntilEachTurnEnd,
  66. activateClass: activateClass));
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  68. targetPermanent: permanent,
  69. changeValue: 1,
  70. effectDuration: EffectDuration.UntilEachTurnEnd,
  71. activateClass: activateClass));
  72. Permanent selectedPermanent = permanent;
  73. if (selectedPermanent != null)
  74. {
  75. ActivateClass activateClass1 = new ActivateClass();
  76. activateClass1.SetUpICardEffect("Memory +3", CanUseCondition2, selectedPermanent.TopCard);
  77. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, true, EffectDiscription1());
  78. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  79. CardEffectCommons.AddEffectToPermanent(
  80. targetPermanent: selectedPermanent,
  81. effectDuration: EffectDuration.UntilEachTurnEnd,
  82. card: card,
  83. cardEffect: activateClass1,
  84. timing: EffectTiming.OnBlockAnyone
  85. );
  86. string EffectDiscription1()
  87. {
  88. return "[Your Turn] When this Digimon is blocked, gain + 3 memory";
  89. }
  90. bool CanUseCondition2(Hashtable hashtable1)
  91. {
  92. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  93. {
  94. if (CardEffectCommons.IsOwnerTurn(selectedPermanent.TopCard))
  95. {
  96. if (CardEffectCommons.CanTriggerOnAttack(hashtable1, selectedPermanent.TopCard))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanActivateCondition1(Hashtable hashtable1)
  105. {
  106. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  107. {
  108. if (selectedPermanent.TopCard.Owner.CanAddMemory(activateClass1))
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.TopCard.Owner.AddMemory(3, activateClass1));
  118. }
  119. }
  120. }
  121. }
  122. }
  123. }
  124. if (timing == EffectTiming.SecuritySkill)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect($"Security Attack +1", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  129. activateClass.SetIsSecurityEffect(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[Security] All of your Digimon gain <Security Attack +1> (This Digimon checks 1 additional security card) until the end of your next turn.";
  134. }
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  140. {
  141. bool PermanentCondition(Permanent permanent)
  142. {
  143. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  144. }
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttackPlayerEffect(
  146. permanentCondition: PermanentCondition,
  147. changeValue: 1,
  148. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  149. activateClass: activateClass));
  150. }
  151. }
  152. return cardEffects;
  153. }
  154. }