using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.P { public class P_146 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #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 HasTamer(Permanent permanent) { return permanent.IsTamer; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasTamer); } bool CardCondition(CardSource cardSource) { return cardSource == card; } } #endregion #region Security Skill if (timing == EffectTiming.SecuritySkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("1 opponent's digimon gains for the turn", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsSecurityEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[Security] 1 of your opponent's Digimon gains for the turn."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get .", "The opponent is selecting 1 Digimon that will get ."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { Permanent selectedPermanent = permanent; if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack( targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass)); } } } } } #endregion #region Main if (timing == EffectTiming.OptionSkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place as bottom Digivolution source", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Main] Place this card as 1 of your non-white Digimon's bottom digivolution card."; } bool IsNonWhiteDigimon(Permanent targetPermanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card)) { if (!targetPermanent.TopCard.CardColors.Contains(CardColor.White)) return true; } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card)) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsNonWhiteDigimon)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { Permanent selectedPermanent = null; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsNonWhiteDigimon)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsNonWhiteDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to add bottom digivolution source.", "The opponent is selecting 1 Digimon to add bottom digivolution source."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom( new List() { card }, activateClass)); } } } #endregion #region All Turns- When would be destoryed - ESS if (timing == EffectTiming.WhenPermanentWouldBeDeleted) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place card from digivolution sources to security, to prevent deletion by battle", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] When this Digimon would be deleted by battle, by placing 1 [Reload Plug-In Q] from this Digimon's digivolution cards at the bottom of your security stack, prevent that deletion."; } bool CanSelectCardCondition(CardSource cardSource) { if (card.PermanentOfThisCard().cardSources.Contains(cardSource)) { return cardSource.CardNames.Contains(card.BaseENGCardNameFromEntity); } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card)) { if(CardEffectCommons.IsByBattle(hashtable)) return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: () => true, canEndNotMax: false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to put in security.", isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.DigivolutionCards, customRootCardList: card.PermanentOfThisCard().DigivolutionCards, canLookReverseCard: false, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 card to put in security.", "The opponent is selecting 1 card to put in security."); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { Permanent thisCardPermanent = card.PermanentOfThisCard(); yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(cardSource, toTop: false)); thisCardPermanent.willBeRemoveField = false; thisCardPermanent.HideDeleteEffect(); } } } #endregion return cardEffects; } } }