P_012.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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_012 : 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.OnDeclaration)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Draw 1 or your 1 Digimon gains DP +1000", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] If you have a Digimon with [Veedramon] in its name, you may suspend this Tamer to activate one of the following effects: - Trigger <Draw 1>. (Draw 1 card from your deck. - 1 of your Digimon gets +1000 DP for the turn.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (isExistOnField(card))
  26. {
  27. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  28. {
  29. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Veedramon")))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  38. {
  39. if (isExistOnField(card))
  40. {
  41. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  42. {
  43. Hashtable hashtable = new Hashtable();
  44. hashtable.Add("CardEffect", activateClass);
  45. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, hashtable).Tap());
  46. yield return GManager.instance.photonWaitController.StartWait("Taichi_Select");
  47. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
  48. {
  49. new SelectionElement<int>(message: $"Draw 1", value : 0, spriteIndex: 0),
  50. new SelectionElement<int>(message: $"DP +1000", value : 1, spriteIndex: 0),
  51. };
  52. string selectPlayerMessage = "Which effect will you activate?";
  53. string notSelectPlayerMessage = "The opponent is choosing which effect to activate.";
  54. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  55. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  56. int actionID = GManager.instance.userSelectionManager.SelectedIntValue;
  57. switch (actionID)
  58. {
  59. case 0:
  60. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  61. break;
  62. case 1:
  63. bool CanSelectPermanentCondition(Permanent permanent)
  64. {
  65. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  66. }
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  68. {
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP +1000.", "The opponent is selecting 1 Digimon that will get DP +1000.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 1000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  88. }
  89. }
  90. break;
  91. }
  92. }
  93. }
  94. }
  95. }
  96. if (timing == EffectTiming.SecuritySkill)
  97. {
  98. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  99. }
  100. return cardEffects;
  101. }
  102. }