using System; using System.Collections; using System.Collections.Generic; //EX10 Deusmon namespace DCGO.CardEffects.EX10 { public class EX10_073 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Static effects #region Alternative Digivolution Cost if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasUltimateAppTraits; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Link +1 if (timing == EffectTiming.None) cardEffects.Add(CardEffectFactory.ChangeSelfLinkMaxStaticEffect(1, false, card, null)); #endregion #region Security Atk +1 if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null)); } #endregion #region App Fusion (Warudamon & Cometmon) if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List() { "Warudamon", "Cometmon" }, card)); } #endregion #endregion #region When Digivolving/EoOT shared bool CanActivateConditionShared(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectLinkCard) || CardEffectCommons.HasMatchConditionOwnersPermanent(card, ThisPermamentCondition)); } bool CanSelectLinkCard(CardSource cardSource) { return cardSource.IsDigimon && cardSource.CanLinkToTargetPermanent(card.PermanentOfThisCard(), false); } bool ThisPermamentCondition(Permanent permanent) { return permanent == card.PermanentOfThisCard() && permanent.DigivolutionCards.Exists(CanSelectLinkCard); } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { bool hasInHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectLinkCard); bool hasInSources = card.PermanentOfThisCard().DigivolutionCards.Exists(CanSelectLinkCard); CardSource selectedCard = null; IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } if (hasInHand) { SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectLinkCard, 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 link", "The opponent is selecting 1 card to link"); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); if (selectedCard != null) { yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddLinkCard(selectedCard, activateClass)); selectedCard = null; } } if (hasInSources) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectLinkCard, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to link.", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.DigivolutionCards, customRootCardList: card.PermanentOfThisCard().DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 card to link", "The opponent is selecting 1 card to link"); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddLinkCard(selectedCard, activateClass)); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Add new links to this digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateConditionShared, (hashtable) => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() => "[When Digivolving] You may link 1 Digimon card from your hand to this Digimon without paying the cost. Then, you may link 1 Digimon card from this Digimon's digivolution cards to this Digimon without paying the cost."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } } #endregion #region End Of Opponent's Turn if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Add new links to this digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateConditionShared, (hashtable) => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() => "[End Of Opponent's Turn] You may link 1 Digimon card from your hand to this Digimon without paying the cost. Then, you may link 1 Digimon card from this Digimon's digivolution cards to this Digimon without paying the cost."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOpponentTurn(card); } } #endregion #region All Turns if (timing == EffectTiming.OnLinkCardDiscarded) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete when trash", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription()); activateClass.SetHashString("EX10-073AllTurns"); cardEffects.Add(activateClass); string EffectDescription() => "[All Turns] [Once Per Turn] When effects trash any of this Digimon's link cards, delete 1 of your opponent's Digimon with the lowest play cost."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnTrashLinkedCard(hashtable, perm => perm == card.PermanentOfThisCard(), cardEffect => cardEffect != null, source => source != null); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon); } bool IsOpponentsDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true, null); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon)) { #region Delete Lowest Play Cost Digimon int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentsDigimon)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsOpponentsDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); #endregion } } } #endregion return cardEffects; } } }