using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class ST12_12 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Trash 1 card from hand to Draw 2", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] By trashing 1 card in your hand, . (Draw 2 cards from your deck.)"; } bool CanSelectCardCondition(CardSource cardSource) { return true; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.HandCards.Count >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1) { bool discarded = false; int discardCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: discardCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, mode: SelectHandEffect.Mode.Discard, cardEffect: activateClass); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Count >= 1) { discarded = true; yield return null; } } if (discarded) { yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw()); } } } } if (timing == EffectTiming.WhenPermanentWouldBeDeleted) { bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { if (permanent != card.PermanentOfThisCard()) { if (permanent.TopCard.CardColors.Contains(CardColor.Red) || permanent.TopCard.CardColors.Contains(CardColor.Black)) { if (permanent.willBeRemoveField) { return true; } } } } return false; } string EffectDiscription() { return ".(When one of your other red or black Digimon would be deleted by an opponent's effect, you may delete this Digimon to prevent that deletion.)"; } bool Condition() { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.GetBattleAreaDigimons().Count(permanent => permanent.TopCard.ContainsCardName("Huckmon") || permanent.TopCard.HasRoyalKnightTraits) >= 1) { return true; } } return false; } cardEffects.Add(CardEffectFactory.DecoySelfEffect(isInheritedEffect: false, card: card, condition: Condition, permanentCondition: CanSelectPermanentCondition, effectName: "Decoy (Red/Black)", effectDiscription: EffectDiscription())); } return cardEffects; } }