EX12_001.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Nyaromon
  5. namespace DCGO.CardEffects.EX12
  6. {
  7. public class EX12_001 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Inherit
  13. if (timing == EffectTiming.OnEndTurn)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("May DNA this [VB] Digimon and 1 other into a [VB] in hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  18. activateClass.SetIsSkippable(true);
  19. activateClass.SetIsInheritedEffect(true);
  20. cardEffects.Add(activateClass);
  21. string EffectDescription()
  22. {
  23. return "[End of Your Turn] This [VB] trait Digimon and any of your other Digimon may DNA digivolve into a [VB] trait Digimon card in the hand. Then, that DNA digivolved Digimon may attack.";
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  28. && CardEffectCommons.IsOwnerTurn(card);
  29. }
  30. bool CanActivateCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass)
  33. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDNACondition)
  34. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard())
  35. && card.PermanentOfThisCard().TopCard.EqualsTraits("VB");
  36. }
  37. bool CanSelectDNACondition(CardSource cardSource)
  38. {
  39. return cardSource.EqualsTraits("VB")
  40. && cardSource.CanPlayJogress(true)
  41. && cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. Func<Permanent, bool>[] permanentConditions = new Func<Permanent, bool>[] { permanent => permanent == card.PermanentOfThisCard() };
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  47. canSelectDNACardCondition: CanSelectDNACondition,
  48. payCost: true,
  49. isHand: true,
  50. activateClass,
  51. permanentConditions,
  52. successProcess: SuccessProcess
  53. ));
  54. IEnumerator SuccessProcess(CardSource cardSource)
  55. {
  56. if (card.PermanentOfThisCard().CanAttack(activateClass))
  57. {
  58. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  59. selectAttackEffect.SetUp(
  60. attacker: card.PermanentOfThisCard(),
  61. canAttackPlayerCondition: () => true,
  62. defenderCondition: _ => true,
  63. cardEffect: activateClass);
  64. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  65. }
  66. yield return null;
  67. }
  68. }
  69. }
  70. #endregion
  71. return cardEffects;
  72. }
  73. }
  74. }