using System; using System.Collections; using System.Collections.Generic; //ST20 Angewomon namespace DCGO.CardEffects.ST20 { public class ST20_06 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution Requirement if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasAdventureTraits && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region On Play/When Digivolving shared #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolve for free", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[On Play] 1 of your other Digimon may digivolve into a Digimon card with the [ADVENTURE] trait in the hand without paying the cost."; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition); } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if(permanent != card.PermanentOfThisCard()) { foreach (CardSource cardSource in card.Owner.HandCards) { if (cardSource.HasAdventureTraits) { if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass)) { return true; } } } } } return false; } bool ValidDigivolveIntoHand(CardSource source) { return source.HasAdventureTraits; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition)) { if (CardEffectCommons.HasMatchConditionOwnersHand(card, ValidDigivolveIntoHand)) { Permanent selectedPermanent = null; 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: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve into a Digimon with the [ADVENTURE] trait.", "The opponent is selecting 1 Digimon to digivolve into a Digimon with the [ADVENTURE] trait."); 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: ValidDigivolveIntoHand, payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null)); } } } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolve for free", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[When Digivolving] 1 of your other Digimon may digivolve into a Digimon card with the [ADVENTURE] trait in the hand without paying the cost."; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition); } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent != card.PermanentOfThisCard()) { foreach (CardSource cardSource in card.Owner.HandCards) { if (cardSource.HasAdventureTraits) { if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass)) { return true; } } } } } return false; } bool ValidDigivolveIntoHand(CardSource source) { return source.HasAdventureTraits; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition)) { if (CardEffectCommons.HasMatchConditionOwnersHand(card, ValidDigivolveIntoHand)) { Permanent selectedPermanent = null; 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: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve into a Digimon with the [ADVENTURE] trait.", "The opponent is selecting 1 Digimon to digivolve into a Digimon with the [ADVENTURE] trait."); 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: ValidDigivolveIntoHand, payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null)); } } } } } #endregion #region Your Turn if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Gain alliance then attack", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription()); activateClass.SetIsSkippableFunction(IsSkippable); activateClass.SetHashString("alliance-attack-ST20_06"); cardEffects.Add(activateClass); string EffectDescription() { return "[Your Turn][Once Per Turn] When your other Digimon are played or digivolve, if any of them have the [ADVENTURE] trait, 1 of your Digimon gains for the turn. Then, 1 of your Digimon may attack."; } bool IsSkippable(Hashtable hashtable) { List hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable); if (hashtables != null) { foreach (Hashtable hashtable1 in hashtables) { Permanent permanent = CardEffectCommons.GetPermanentFromHashtable(hashtable1); if (permanent != null && MyDigimonAdventurePlayedDigid(permanent)) return false; } } return true; } bool MyDigimonAdventurePlayedDigid(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent != card.PermanentOfThisCard() && permanent.TopCard.EqualsTraits("ADVENTURE"); } bool MyDigimonPlayedDigid(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent != card.PermanentOfThisCard(); } bool MyDigimonAlliance(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool MyDigimonAttacking(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.CanAttack(activateClass); } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, MyDigimonPlayedDigid)) return true; if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, MyDigimonPlayedDigid)) return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return true; } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool Used = false; List etbPermanents = new List(); List hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable); if (hashtables != null) { foreach (Hashtable hashtable1 in hashtables) { Permanent permanent = CardEffectCommons.GetPermanentFromHashtable(hashtable1); if (permanent != null) etbPermanents.Add(permanent); } etbPermanents = etbPermanents.Filter(MyDigimonAdventurePlayedDigid); } if (etbPermanents.Count > 0) { if (CardEffectCommons.HasMatchConditionPermanent(MyDigimonAlliance)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: MyDigimonAlliance, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectBoostedDigimon, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain ", "The opponent is selecting 1 Digimon to gain "); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectBoostedDigimon(Permanent target) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: target, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass)); } Used = true; } } if (CardEffectCommons.HasMatchConditionPermanent(MyDigimonAttacking)) { Permanent selectedPermanent = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: MyDigimonAttacking, 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 to attack.", "The opponent is selecting 1 Digimon to attack."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent(); selectAttackEffect.SetUp( attacker: selectedPermanent, canAttackPlayerCondition: () => true, defenderCondition: _ => true, cardEffect: activateClass); selectAttackEffect.SetAfterOnAttackCoroutine(AfterOnAttackCoroutine); yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate()); } IEnumerator AfterOnAttackCoroutine() { Used = true; yield return null; } } if (!Used) { activateClass.RemoveUse(); } } } #endregion #region Alliance Inherit if (timing == EffectTiming.OnAllyAttack) { bool Condition() { return CardEffectCommons.IsExistOnBattleArea(card); } cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: true, card: card, condition: Condition)); } #endregion return cardEffects; } } }