BT7_095.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 BT7_095 : 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] For the turn, 1 of your Digimon gets +3000 DP and can also attack your opponent's unsuspended Digimon with no digivolution cards.";
  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. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  54. targetPermanent: permanent,
  55. changeValue: 3000,
  56. effectDuration: EffectDuration.UntilEachTurnEnd,
  57. activateClass: activateClass));
  58. Permanent selectedPermanent = permanent;
  59. if (selectedPermanent != null)
  60. {
  61. CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass();
  62. canAttackTargetDefendingPermanentClass.SetUpICardEffect($"Can attack to unsuspended Digimon with no digivolution cards", CanUseCondition1, card);
  63. canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass(
  64. attackerCondition: AttackerCondition,
  65. defenderCondition: DefenderCondition,
  66. cardEffectCondition: CardEffectCondition);
  67. selectedPermanent.UntilEachTurnEndEffects.Add((_timing) => canAttackTargetDefendingPermanentClass);
  68. bool CanUseCondition1(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  71. {
  72. return true;
  73. }
  74. return false;
  75. }
  76. bool AttackerCondition(Permanent attacker)
  77. {
  78. return attacker == selectedPermanent;
  79. }
  80. bool DefenderCondition(Permanent defender)
  81. {
  82. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(defender, card))
  83. {
  84. if (!defender.IsSuspended)
  85. {
  86. if (defender.HasNoDigivolutionCards)
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. bool CardEffectCondition(ICardEffect cardEffect)
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. }
  101. }
  102. }
  103. if (timing == EffectTiming.SecuritySkill)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  108. activateClass.SetIsSecurityEffect(true);
  109. cardEffects.Add(activateClass);
  110. string EffectDiscription()
  111. {
  112. return "[Security] Add this card to its owner's hand.";
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  117. }
  118. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  121. }
  122. }
  123. return cardEffects;
  124. }
  125. }