BT7_045.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_045 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place a card from hand to deck top to get DP +3000", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Attacking] You may reveal 1 green Digimon card from your hand and place it on top of your deck to have this Digimon get +3000 DP for the turn.";
  23. }
  24. bool CanSelectCardCondition(CardSource cardSource)
  25. {
  26. if (cardSource != null)
  27. {
  28. if (cardSource.IsDigimon)
  29. {
  30. if (cardSource.Owner == card.Owner)
  31. {
  32. if (cardSource.HasCardColor(CardColor.Green))
  33. {
  34. return true;
  35. }
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (card.Owner.HandCards.Count >= 1)
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (isExistOnField(card))
  59. {
  60. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  61. {
  62. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  63. {
  64. bool putHand = false;
  65. int maxCount = 1;
  66. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  67. selectHandEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectCardCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: true,
  74. canEndNotMax: false,
  75. isShowOpponent: true,
  76. selectCardCoroutine: null,
  77. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  78. mode: SelectHandEffect.Mode.PutLibraryTop,
  79. cardEffect: activateClass);
  80. yield return StartCoroutine(selectHandEffect.Activate());
  81. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  82. {
  83. if (cardSources.Count >= 1)
  84. {
  85. putHand = true;
  86. }
  87. yield return null;
  88. }
  89. if (putHand)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  92. }
  93. }
  94. }
  95. }
  96. }
  97. }
  98. return cardEffects;
  99. }
  100. }