using System.Collections; using System.Collections.Generic; using System; using System.Linq; // Hyogamon namespace DCGO.CardEffects.BT24 { public class BT24_026 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alt Digivolution Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel3 && (targetPermanent.TopCard.EqualsTraits("Demon") || targetPermanent.TopCard.HasTSTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region When this card is trashed if (timing == EffectTiming.OnDiscardHand) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("If you have 5 or less cards, draw 1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "When this card is trashed from the hand, if you have 5 or fewer cards in hand, ."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnTrashSelfHand(hashtable, null, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnTrash(card) && card.Owner.HandCards.Count <= 5; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw()); } } #endregion #region Shared OP/WA string SharedHash() { return "OP_WA_BT24_026"; } string SharedEffectName() { return "Trash a card to give one of your digimon Jamming and Blocker."; } string SharedEffectDescription(string tag) { return $"[{tag}] [Once Per Turn] By trashing 1 card in your hand, 1 of your digimon with the [Demon], [Shaman] or [Titan] trait gains and until your opponent's turn ends."; } bool SharedCanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.HandCards.Count >= 1) { return true; } } return false; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && (permanent.TopCard.EqualsTraits("Demon") || permanent.TopCard.EqualsTraits("Shaman") || permanent.TopCard.EqualsTraits("Titan")); } IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass) { if (card.Owner.HandCards.Count >= 1) { bool discarded = false; int discardCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: (cardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: discardCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, mode: SelectHandEffect.Mode.Discard, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 Card to trash.", "The opponent is selecting 1 card to trash from their hand."); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Count >= 1) { discarded = true; yield return null; } } if (discarded && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, 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 gain Jamming and Blocker.", "The opponent is selecting 1 Digimon that will gain Jamming and Blocker."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainJamming(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass)); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass)); } } } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition,(hash) => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("On Play")); activateClass.SetHashString(SharedHash()); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } } #endregion #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition,(hash) => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Attacking")); activateClass.SetHashString(SharedHash()); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } } #endregion #region ESS if (timing == EffectTiming.OnDiscardHand) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("When your hand is trashed from, digivolve", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("BT24_026_YT_ESS"); cardEffects.Add(activateClass); string EffectDescription() { return "[Your Turn] [Once Per Turn] When your hand is trashed from, this [Demon] or [Titan] trait Digimon may digivolve into [Titamon] or a [Titan] trait Digimon card in the trash with the digivolution cost reduced by 1."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && (cardSource.EqualsCardName("Titamon") || cardSource.EqualsTraits("Titan")) && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnTrashHand(hashtable, null, cardSource => cardSource.Owner == card.Owner) && CardEffectCommons.IsOwnerTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition) && (card.PermanentOfThisCard().TopCard.EqualsTraits("Demon") || card.PermanentOfThisCard().TopCard.EqualsTraits("Titan")); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: card.PermanentOfThisCard(), cardCondition: CanSelectCardCondition, payCost: true, reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null), fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: false, activateClass: activateClass, successProcess: null)); } } #endregion return cardEffects; } } }