Kari_Kamiya_BT15_084.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 Kari_Kamiya_BT15_084 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region When trashed from security
  14. if (timing == EffectTiming.OnDiscardSecurity)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Opponent's 1 Digimon gains Security Attack -1", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "When an effect trashes this card from the security stack, 1 of your opponent's Digimon gains [Security A -1] until the end of your opponent's turn.";
  23. }
  24. bool CanSelectPermanentCondition(Permanent permanent)
  25. {
  26. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.CanTriggerOnTrashSelfSecurity(hashtable, cardEffect => cardEffect != null, card);
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  35. {
  36. if (CardEffectCommons.IsExistOnTrash(card))
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectPermanentCondition,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: maxCount,
  55. canNoSelect: false,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: SelectPermanentCoroutine,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Custom,
  60. cardEffect: activateClass);
  61. selectPermanentEffect.SetUpCustomMessage(
  62. "Selcect 1 Digimon that will get Security Attack -1.",
  63. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  68. targetPermanent: permanent,
  69. changeValue: -1,
  70. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  71. activateClass: activateClass));
  72. }
  73. }
  74. }
  75. }
  76. #endregion
  77. #region Start of Turn
  78. if (timing == EffectTiming.OnStartTurn)
  79. {
  80. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  81. }
  82. #endregion
  83. #region All turns
  84. if (timing == EffectTiming.OnLoseSecurity)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("Opponent's 1 Digimon gains Security Attack -1", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  89. activateClass.SetHashString("AllTurns_BT15_084");
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[All Turns] When an effect removes a card from your security stack, by suspending this Tamer, 1 of your opponent's Digimon gains [Security A-1] until the end of your opponent's turn.";
  94. }
  95. bool CanSelectPermanentCondition(Permanent permanent)
  96. {
  97. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  104. {
  105. List<SkillInfo> skills = CardEffectCommons.GetSkillFromHashtable(hashtable);
  106. if(skills != null)
  107. {
  108. return true;
  109. }
  110. //if (!GManager.instance.attackProcess.DoSecurityCheck)
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanActivateCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.IsExistOnBattleArea(card))
  118. {
  119. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  130. {
  131. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: maxCount,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: SelectPermanentCoroutine,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Custom,
  144. cardEffect: activateClass);
  145. selectPermanentEffect.SetUpCustomMessage(
  146. "Selcect 1 Digimon that will get Security Attack -1.",
  147. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  152. targetPermanent: permanent,
  153. changeValue: -1,
  154. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  155. activateClass: activateClass));
  156. }
  157. }
  158. }
  159. }
  160. #endregion
  161. #region Security effect
  162. if (timing == EffectTiming.SecuritySkill)
  163. {
  164. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }