using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Gallantmon namespace DCGO.CardEffects.P { public class P_186 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Static Effects #region Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { if (targetPermanent.TopCard.IsLevel5) { if (targetPermanent.TopCard.ContainsCardName("WarGrowlmon")) { return true; } } return false; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region Blocker if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect( isInheritedEffect: false, card: card, condition: null)); } #endregion #region Rush if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region Reduce Play Cost if (timing == EffectTiming.None) { bool Condition() { return CardEffectCommons.HasMatchConditionPermanent(PermanentCondition); } bool PermanentCondition(Permanent Permanent) { return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(Permanent) && Permanent.IsDigimon && Permanent.HasDP && Permanent.DP >= 13000; } int changeCost() { return 2 * ((card.Owner.TrashCards.Count + card.Owner.Enemy.TrashCards.Count) / 5); } cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction>(changeCost, card, Condition)); } #endregion #endregion #region Shared OP/WD IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)) { if (permanent.DP >= 13000) { return true; } } return false; } Permanent selectedPermanent = null; bool permanentDeleted = false; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: PermanentCondition, 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 to delete", "The opponent is selecting 1 Digimon to delete."); 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.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List() { selectedPermanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null)); IEnumerator SuccessProcess() { permanentDeleted = true; yield return null; } } if (!permanentDeleted) { if (card.Owner.CanAddSecurity(activateClass)) { yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery()); } } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete a digimon, if you didn't ", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Delete 1 Digimon with 13000 DP or more. If this effect didn't delete, (Place the top card of your deck on top of your security stack)."; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerOnPlay(hashtable, card)) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete a digimon, if you didn't ", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Delete 1 Digimon with 13000 DP or more. If this effect didn't delete, (Place the top card of your deck on top of your security stack)."; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } } #endregion return cardEffects; } } }