ST10_01.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 ST10_01 : 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("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Attacking] If you have a yellow Digimon in play, <Draw 1>. (Draw 1 card from your deck.) If you do, trash 1 card in your hand.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleArea(card))
  31. {
  32. if (card.Owner.LibraryCards.Count >= 1)
  33. {
  34. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardColors.Contains(CardColor.Yellow)))
  35. {
  36. return true;
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. if (isExistOnField(card))
  45. {
  46. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  47. {
  48. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  49. if (card.Owner.HandCards.Count >= 1)
  50. {
  51. int discardCount = 1;
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: (cardSource) => true,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: discardCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: null,
  64. mode: SelectHandEffect.Mode.Discard,
  65. cardEffect: activateClass);
  66. yield return StartCoroutine(selectHandEffect.Activate());
  67. }
  68. }
  69. }
  70. }
  71. }
  72. return cardEffects;
  73. }
  74. }