| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // SymbareAngoramon
- namespace DCGO.CardEffects.EX12
- {
- public class EX12_050 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alt Digivolution
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent permanent)
- {
- return permanent.TopCard.EqualsCardName("Angoramon");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null));
- }
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent permanent)
- {
- return permanent.TopCard.EqualsTraits("NSp");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null, level: 3));
- }
- #endregion
- #region Main
- if (timing == EffectTiming.OnDeclaration)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play/Use 1 [Angoramon] in text/[NSp] from hand for 2 less", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetHashString("EX12_050_Main");
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[Main] [Once Per Turn] You may play or use 1 card with [Angoramon] in its text or the [NSp] trait from your hand with the cost reduced by 2.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return (cardSource.HasText("Angoramon")
- || cardSource.EqualsTraits("NSp"))
- && ((cardSource.IsOption
- && !cardSource.CanNotPlayThisOption)
- || (cardSource.HasPlayCost
- && CardEffectCommons.CanPlayAsNewPermanent(cardSource, true, activateClass, fixedCost: cardSource.GetCostItself - 2)));
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- bool isUsed = false;
- CardSource selectedCard = null;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 card to play/use.", "The opponent is selecting 1 card to play/use.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- if (selectedCard != null)
- {
- isUsed = true;
- #region reduce cost
- int reducecost = 2;
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect($"Play/Use Cost -{reducecost}", CanUseCondition1, card);
- changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: PlayOrUseCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
- Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
- card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
- ICardEffect GetCardEffect(EffectTiming _timing)
- {
- if (_timing == EffectTiming.None)
- {
- return changeCostClass;
- }
- return null;
- }
- bool CanUseCondition1(Hashtable hashtable)
- {
- return true;
- }
- bool PlayOrUseCondition(CardSource cardSource)
- {
- return true;
- }
- int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
- {
- if (PlayOrUseCondition(cardSource)
- && RootCondition(root)
- && PermanentsCondition(targetPermanents))
- {
- Cost -= reducecost;
- }
- return Cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- return targetPermanents == null
- || targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0;
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return true;
- }
- bool isUpDown()
- {
- return true;
- }
- #endregion
- if (selectedCard.IsOption)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayOptionCards(
- cardSources: new List<CardSource> { selectedCard },
- activateClass: activateClass,
- payCost: true,
- root: SelectCardEffect.Root.Hand));
- }
- else
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
- cardSources: new List<CardSource> { selectedCard },
- activateClass: activateClass,
- payCost: true,
- isTapped: false,
- root: SelectCardEffect.Root.Hand,
- activateETB: true));
- }
- #region release reduction
- card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
- #endregion
- isUsed = true;
- }
- if (!isUsed) activateClass.RemoveUse();
- }
- }
- #endregion
- #region All Turns Inherited
- if (timing == EffectTiming.None)
- {
- bool Condition()
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|