BT7_042.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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_042 : 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.None)
  14. {
  15. bool CardCondition(CardSource cardSource)
  16. {
  17. return cardSource.Owner == card.Owner;
  18. }
  19. bool Condition()
  20. {
  21. if (CardEffectCommons.IsExistOnBattleArea(card))
  22. {
  23. if (CardEffectCommons.IsOpponentTurn(card))
  24. {
  25. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardTraits.Contains("Hybrid")) >= 1)
  26. {
  27. return true;
  28. }
  29. }
  30. }
  31. return false;
  32. }
  33. cardEffects.Add(CardEffectFactory.ChangeSecurityDigimonCardDPStaticEffect(
  34. cardCondition: CardCondition,
  35. changeValue: 4000,
  36. isInheritedEffect: false,
  37. card: card,
  38. condition: Condition,
  39. effectName: "Your Security Digimon gains DP +4000"));
  40. }
  41. if (timing == EffectTiming.OnDestroyedAnyone)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Play 1 Digimon from hand", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[On Deletion] You may play 1 yellow level 4 or lower Digimon card with[Hybrid] in its form from your hand without paying its memory cost.";
  50. }
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. if (cardSource.IsDigimon)
  54. {
  55. if (cardSource.CardColors.Contains(CardColor.Yellow))
  56. {
  57. if (cardSource.Level <= 4)
  58. {
  59. if (cardSource.CardTraits.Contains("Hybrid"))
  60. {
  61. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  62. {
  63. if (cardSource.HasLevel)
  64. {
  65. return true;
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. return false;
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  77. }
  78. bool CanActivateCondition(Hashtable hashtable)
  79. {
  80. if (CardEffectCommons.IsExistOnTrash(card))
  81. {
  82. if (card.Owner.HandCards.Count >= 1)
  83. {
  84. return true;
  85. }
  86. }
  87. return false;
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  92. {
  93. List<CardSource> selectedCards = new List<CardSource>();
  94. int maxCount = 1;
  95. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  96. selectHandEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectCardCondition,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCount,
  102. canNoSelect: true,
  103. canEndNotMax: false,
  104. isShowOpponent: true,
  105. selectCardCoroutine: SelectCardCoroutine,
  106. afterSelectCardCoroutine: null,
  107. mode: SelectHandEffect.Mode.Custom,
  108. cardEffect: activateClass);
  109. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  110. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  111. yield return StartCoroutine(selectHandEffect.Activate());
  112. IEnumerator SelectCardCoroutine(CardSource cardSource)
  113. {
  114. selectedCards.Add(cardSource);
  115. yield return null;
  116. }
  117. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  118. }
  119. }
  120. }
  121. return cardEffects;
  122. }
  123. }