using System.Collections; using System.Collections.Generic; using System.Linq; // Beowolfmon namespace DCGO.CardEffects.AD1 { public class AD1_015 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Koji Minamoto") && targetPermanent.DigivolutionCards.Count(cardSource => cardSource.EqualsTraits("Hybrid")) >= 2; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region Jamming if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region DPReduction WD / WA / WA ESS string DPReductionEffectName = "Give 1 Opponent's digimon -4k DP"; CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, DPReductionEffectName, DPReductionActivateCoroutine, DPReductionEffectDescription, optional: false, whenDigivolving: true, whenAttacking: true); string DPReductionEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon gets -4000 DP for the turn."; bool IsEnemyDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); IEnumerator DPReductionActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { if (CardEffectCommons.HasMatchConditionPermanent(IsEnemyDigimon)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsEnemyDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -4000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass)); } } } #endregion #region When Attacking - ESS if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(DPReductionEffectName, CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hash => DPReductionActivateCoroutine(hash, activateClass), -1, false, DPReductionEffectDescription("When Attacking")); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card); } } #endregion #region PlayTamer EoA / OD string PlayTamerEffectName = "You may play 1 Yellow / Black / Purple Tamer with inherited effects, then by placing a hybrid card under a tamer: draw 2"; CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, PlayTamerEffectName, PlayTamerActivateCoroutine, PlayTamerEffectDescription, additionalActivateCondition: PlayTamerCanActivateCondition, optional: false, endOfAttack: true, onDeletion: true); string PlayTamerEffectDescription(string tag) => $"[{tag}] You may play 1 yellow, black or purple Tamer card with inherited effects from your hand or trash without paying the cost. Then, by placing 1 [Hybrid] or [Ten Warriors] trait card from your hand under this Digimon or your Tamers, ."; bool CanPlayTamerCondition(CardSource cardSource) { return cardSource.IsTamer && (cardSource.HasCardColor(CardColor.Yellow) || cardSource.HasCardColor(CardColor.Black) || cardSource.HasCardColor(CardColor.Purple)) && cardSource.HasInheritedEffect; } bool CanPlaceCardCondition(CardSource cardSource) => cardSource.HasHybridTenWarriorsTraits; bool CanPlaceUnderTamerCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && permanent.IsTamer; } bool PlayTamerCanActivateCondition(Hashtable hashtable, ActivateClass activateClass) { return CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlayTamerCondition) || CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlayTamerCondition) || CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlaceCardCondition); } IEnumerator PlayTamerActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { bool validHandCard = CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlayTamerCondition); bool validTrashCard = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlayTamerCondition); if (validHandCard || validTrashCard) { List> selectionElements = new List>(); if (validHandCard) { selectionElements.Add(new (message: $"Play Tamer from hand", value : 1, spriteIndex: 0)); } if (validTrashCard) { selectionElements.Add(new (message: $"Play Tamer from trash", value : 2, spriteIndex: 0)); }; selectionElements.Add( new (message: $"Don't play", value: 3, spriteIndex: 1)); string selectPlayerMessage = "From where will you play a Tamer?"; string notSelectPlayerMessage = "The opponent is choosing from which area to select a card."; GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool doPlay = GManager.instance.userSelectionManager.SelectedIntValue != 3; SelectCardEffect.Root root = GManager.instance.userSelectionManager.SelectedIntValue == 1 ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash; if (doPlay) { #region Hand/Trash Card Selection & Play yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect( canTargetCondition: CanPlayTamerCondition, root, activateClass, payCost: false )); #endregion } } if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlaceCardCondition)) { List> selectionElements = new List>(); selectionElements.Add(new (message: $"Place under this Digimon", value : 1, spriteIndex: 0)); if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanPlaceUnderTamerCondition)) { selectionElements.Add(new (message: $"Place under a Tamer", value : 2, spriteIndex: 0)); }; selectionElements.Add( new (message: $"Don't place", value: 3, spriteIndex: 1)); string selectPlayerMessage = "Will you place a card under this Digimon or a tamer?"; string notSelectPlayerMessage = "The opponent is choosing to place a card."; GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool doPlace = GManager.instance.userSelectionManager.SelectedIntValue != 3; bool underThis = GManager.instance.userSelectionManager.SelectedIntValue == 1; if (doPlace) { Permanent selectedPermanent = null; if (underThis) { selectedPermanent = card.PermanentOfThisCard(); } else { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanPlaceUnderTamerCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 tamer to place a card under.", "The opponent is selecting 1 tamer to place a card under."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } } if (selectedPermanent != null) { List selectedCards1 = new List(); SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanPlaceCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards1.Add(cardSource); yield return null; } selectHandEffect.SetUpCustomMessage("Select 1 card to place.", "Opponent is selecting 1 card to place under."); yield return StartCoroutine(selectHandEffect.Activate()); if (selectedCards1.Count > 0) { yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards1, activateClass)); yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw()); } } } } } #endregion return cardEffects; } } }