using System; using System.Collections; using System.Collections.Generic; // Iron Slash namespace DCGO.CardEffects.BT25 { public class BT25_100 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Static Effects #region Link Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.IsDigimon && targetPermanent.TopCard.HasTSTraits; } cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card)); } #endregion #region Link if (timing == EffectTiming.OnDeclaration) { cardEffects.Add(CardEffectFactory.LinkEffect(card)); } #endregion #region Use Requirement if (timing == EffectTiming.None) { bool CardCondition(CardSource cardSource) => cardSource.HasTSTraits; cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition)); } #endregion #region Link Inherit #region Collision if (timing == EffectTiming.OnCounterTiming) { cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(false, card, null, true)); } #endregion #region Piercing if (timing == EffectTiming.OnDetermineDoSecurityCheck) { cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null, isLinkedEffect: true)); } #endregion #endregion #endregion #region Main if (timing == EffectTiming.OptionSkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("De-Digi(2) 1 opponent digimon, then may link to 1 of your digimon on the field", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() => "[Main] 1 of your opponent's Digimon. Then, you may link this card to 1 of your Digimon on the field without paying the cost."; bool CanUseCondition(Hashtable hashtable) => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card); bool CanSelectOwnerPermamentCondition(Permanent permanent) { return CardEffectCommons.IsOwnerPermanent(permanent, card) && permanent.IsDigimon && card.CanLinkToTargetPermanent(permanent, false, true); } bool CanSelectEnemyPermamentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); IEnumerator ActivateCoroutine(Hashtable _hashtable) { // De-Digi(2) 1 opponent digimon if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectEnemyPermamentCondition)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectEnemyPermamentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectEnemyPermamentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Degenerate, cardEffect: activateClass); selectPermanentEffect.SetDegenerationCount(2); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digi(2)", "The opponent is selecting 1 Digimon to De-Digi(2)."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } // Link to 1 Owner digimon on the field if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermamentCondition, true)) { Permanent selectedPermament = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOwnerPermamentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermament = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link this card to", "The opponent is selecting 1 Digimon to link this card to."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(selectedPermament.AddLinkCard( addedLinkCard: card, cardEffect: activateClass)); } } } #endregion #region Security if (timing == EffectTiming.SecuritySkill) { string EffectDiscription() => "[Security] Activate this card's [Main] effect."; CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"De-Digi(2) 1 opponent digimon, then may link to 1 digimon on the field", effectDiscription: EffectDiscription()); } #endregion return cardEffects; } } }