EX11_006.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Flickmon
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. public class EX11_006 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnAllyAttack)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Digivolve this Digimon into a Digimon with [Maquinamon] in text.", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  17. activateClass.SetHashString("Digivolve_EX11_006");
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDescription()
  21. => "[When Attacking] [Once Per Turn] This Digimon linked with [Maquinamon] may digivolve into a Digimon card with [Maquinamon] in its text in the hand with the digivolution cost reduced by 2.";
  22. bool CanUseCondition(Hashtable hashtable)
  23. => CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  24. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  25. bool CanActivateCondition(Hashtable hashtable)
  26. => CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  27. && card.Owner.HandCards.Count >= 1
  28. && card.PermanentOfThisCard().LinkedCards.Any(cardSource => cardSource.EqualsCardName("Maquinamon"));
  29. bool CanSelectCardCondition(CardSource cardSource)
  30. => cardSource.IsDigimon
  31. && cardSource.HasText("Maquinamon")
  32. && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass, root: SelectCardEffect.Root.Hand);
  33. IEnumerator ActivateCoroutine(Hashtable hashtable)
  34. {
  35. if (card.Owner.HandCards.Exists(CanSelectCardCondition))
  36. {
  37. yield return ContinuousController.instance.StartCoroutine(
  38. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  39. targetPermanent: card.PermanentOfThisCard(),
  40. cardCondition: CanSelectCardCondition,
  41. payCost: true,
  42. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  43. fixedCostTuple: null,
  44. ignoreDigivolutionRequirementFixedCost: -1,
  45. isHand: true,
  46. activateClass: activateClass,
  47. successProcess: null));
  48. }
  49. }
  50. }
  51. return cardEffects;
  52. }
  53. }
  54. }