using System; using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.P { public class P_142 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.CardNames.Contains("Pinamon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend 1 level 6 or lower Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Suspend 1 of your opponent's level 6 or lower Digimon. Then, by placing this Digimon as the bottom digivolution card of 1 of your Digimon with [Ravemon] in its name, that Digimon may attack an opponent's Digimon."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.Level <= 6) { if (permanent.TopCard.HasLevel) { return true; } } } return false; } bool CanSelectOwnPermanentCondition(Permanent targetPermanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card)) { if (targetPermanent.TopCard.name.Contains("Ravemon")) { return true; } } return false; } bool CanSelectOpponentPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(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: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnPermanentCondition)) { Permanent selectedPermanent = null; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOwnPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOwnPermanentCondition, 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 with [Ravemon] in its name 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)); if (selectedPermanent.CanAttack(activateClass) && CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition)) { SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent(); selectAttackEffect.SetUp( attacker: selectedPermanent, canAttackPlayerCondition: () => false, defenderCondition: (permanent) => true, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate()); } } } } } #endregion #region Inherit if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Opponent trashes 1 card from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Deletion] When this Digimon is deleted other than in battle, your opponent trashes 1 card in their hand."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.CanActivateOnDeletion(card, activateClass)) { if (!CardEffectCommons.IsByBattle(hashtable)) { if (card.Owner.Enemy.HandCards.Count >= 1) { return true; } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (card.Owner.Enemy.HandCards.Count >= 1) { int discardCount = Math.Min(1, card.Owner.HandCards.Count); SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner.Enemy, canTargetCondition: (cardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: discardCount, canNoSelect: false, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Discard, cardEffect: activateClass); yield return StartCoroutine(selectHandEffect.Activate()); } } } #endregion return cardEffects; } } }