using System.Collections; using System.Collections.Generic; // DoGatchmon namespace DCGO.CardEffects.BT21 { public class BT21_018 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Static effects #region Alternative Digivolution Condition - Stnd. if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsTraits("Stnd."); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Raid if (timing == EffectTiming.OnAllyAttack) { cardEffects.Add(CardEffectFactory.RaidSelfEffect(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 Link Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasAppmonTraits; } cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card)); } #endregion #region App Fusion (Gatchmon, Navimon, Tweetmon) if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List() { "Gatchmon", "Navimon", "Tweetmon" }, card)); } #endregion #region Link if (timing == EffectTiming.OnDeclaration) { /// /// Used to link a card /// /// Reference to this card /// OPTIONAL - Function to check for effect conditions /// Mike Bunch cardEffects.Add(CardEffectFactory.LinkEffect(card)); } #endregion #endregion #region Your Turn if (timing == EffectTiming.WhenLinked) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("This digimon may attack", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("WhenLinked_BT21_018"); cardEffects.Add(activateClass); string EffectDiscription() => "[Your Turn] [Once Per Turn] When this Digimon gets linked, it may attack."; bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerWhenLinked(hashtable, LinkPermanentCondition, null)) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (card.PermanentOfThisCard().CanAttack(activateClass)) { return true; } } } return false; } bool LinkPermanentCondition(Permanent permanent) { return permanent == card.PermanentOfThisCard(); } IEnumerator ActivateCoroutine(Hashtable hashtable) { SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent(); selectAttackEffect.SetUp( attacker: card.PermanentOfThisCard(), canAttackPlayerCondition: () => true, defenderCondition: (permanent) => true, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate()); } } #endregion #region When Linked if (timing == EffectTiming.WhenLinked) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("This digimon may attack", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); activateClass.SetIsLinkedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() => "[When Linking] this Digimon may attack."; bool CanUseCondition(Hashtable hashtable) { UnityEngine.Debug.Log($"CAN USE: {CardEffectCommons.IsExistOnBattleAreaDigimon(card)}, {CardEffectCommons.CanTriggerWhenLinking(hashtable, PermanentCondition, card)}"); if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerWhenLinking(hashtable, PermanentCondition, card)) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { UnityEngine.Debug.Log($"CAN ACTIVATE: {CardEffectCommons.IsExistOnBattleAreaDigimon(card)}, {card.PermanentOfThisCard().CanAttack(activateClass)}"); if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (card.PermanentOfThisCard().CanAttack(activateClass)) { return true; } } return false; } bool PermanentCondition(Permanent permanent) { return permanent == card.PermanentOfThisCard(); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().TopCard.PermanentOfThisCard().CanAttack(activateClass)) { SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent(); selectAttackEffect.SetUp( attacker: card.PermanentOfThisCard().TopCard.PermanentOfThisCard(), canAttackPlayerCondition: () => true, defenderCondition: (permanent) => true, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate()); } } } } #endregion return cardEffects; } } }