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 CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #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.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 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 targetPermanents) { if (PlayOrUseCondition(cardSource) && RootCondition(root) && PermanentsCondition(targetPermanents)) { Cost -= reducecost; } return Cost; } bool PermanentsCondition(List 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 { selectedCard }, activateClass: activateClass, payCost: true, root: SelectCardEffect.Root.Hand)); } else { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: new List { 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; } } }