using System.Collections; using System.Collections.Generic; using System.Linq; // Digital Translator namespace DCGO.CardEffects.EX4 { public class EX4_072 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Rule if (timing == EffectTiming.None) { ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass(); changeCardNamesClass.SetUpICardEffect("Also treated as having [Plug-In] in its name", CanUseCondition, card); changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames); cardEffects.Add(changeCardNamesClass); bool CanUseCondition(Hashtable hashtable) { return true; } List changeCardNames(CardSource cardSource, List cardNames) { if (cardSource == card) { for (int i = 0; i < cardNames.Count; i++) { if (!cardNames[i].Contains("Plug-In")) { cardNames[i] = $"Plug-In {cardNames[i]}"; } } } return cardNames; } } #endregion #region Ignore Color Requirement if (timing == EffectTiming.None) { IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass(); ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card); ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition); cardEffects.Add(ignoreColorConditionClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer); } bool CardCondition(CardSource cardSource) { return cardSource == card; } } #endregion #region Main if (timing == EffectTiming.OptionSkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[Main] Choose 1 of your [Gallantmon], [Sakuyamon] or [MegaGargomon].From your hand, ignoring digivolution requirements and without paying the cost, it may digivolve into a level 6 Digimon card with a different name that includes the chosen Digimon's name."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && (permanent.TopCard.EqualsCardName("Gallantmon") || permanent.TopCard.EqualsCardName("Sakuyamon") || permanent.TopCard.EqualsCardName("MegaGargomon"))) { foreach (CardSource cardSource in card.Owner.HandCards) { if (CanSelectCardCondition(cardSource, permanent) && !cardSource.CanNotEvolve(permanent)) return true; } } return false; } bool CanSelectCardCondition(CardSource cardSource, Permanent permanent) { return permanent.TopCard.CardNames.Any((cardName) => cardSource.ContainsCardName(cardName) && !cardSource.EqualsCardName(cardName)) && cardSource.HasLevel && cardSource.Level == 6; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { Permanent selectedPermanent = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, 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 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: selectedPermanent, cardCondition: (cardSource) => CanSelectCardCondition(cardSource, selectedPermanent), payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: 0, isHand: true, activateClass: activateClass, successProcess: null)); } } } } #endregion #region Security if (timing == EffectTiming.SecuritySkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return 1 card from trash to hand and add this card to hand", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription()); activateClass.SetIsSecurityEffect(true); cardEffects.Add(activateClass); string EffectDescription() { return "[Security] Return 1 Digimon card from your trash to your hand, and add this card to your hand."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource != null && cardSource.IsDigimon && cardSource.Owner == card.Owner; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: null, afterSelectCardCoroutine: null, message: "Select 1 card to add to your hand.", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.AddHand, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass)); } } #endregion return cardEffects; } } }