P_023.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 P_023 : 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] If you have [T.K. Takaishi] in play, place 1 of your [Patamon] at the bottom of your security stack face down. Trash that Digimon's digivolution cards.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  26. {
  27. if (permanent.TopCard.CardNames.Contains("T.K. Takaishi"))
  28. {
  29. return true;
  30. }
  31. if (permanent.TopCard.CardNames.Contains("T.K.Takaishi"))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanSelectPermanentCondition1(Permanent permanent)
  39. {
  40. if (card.Owner.CanAddSecurity(activateClass))
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  43. {
  44. if (permanent.TopCard.CardNames.Contains("Patamon"))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  59. {
  60. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1) >= 1)
  61. {
  62. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition1,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 [Patamon] to place to security.", "The opponent is selecting 1 [Patamon] to place to security.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  79. {
  80. Permanent selectedPermanent = permanent;
  81. if (selectedPermanent != null)
  82. {
  83. yield return ContinuousController.instance.StartCoroutine(new IPutSecurityPermanent(selectedPermanent, CardEffectCommons.CardEffectHashtable(activateClass), toTop: false).PutSecurity());
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. if (timing == EffectTiming.SecuritySkill)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  95. activateClass.SetIsSecurityEffect(true);
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[Security] Add this card to its owner's hand.";
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  104. }
  105. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  108. }
  109. }
  110. return cardEffects;
  111. }
  112. }