| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- // SkullBaluchimon
- namespace DCGO.CardEffects.BT24
- {
- public class BT24_075 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alt Digivolution Condition
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.IsLevel4
- && (targetPermanent.TopCard.EqualsTraits("Demon")
- || targetPermanent.TopCard.HasTSTraits);
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
- }
- #endregion
- #region Shared OP/WD
- string SharedEffectName() => "By trashing 1, delete 1 each of opponent's lvl 3 and 4";
- string SharedEffectDescription(string tag) => $"[{tag}] By trashing 1 card in your hand, delete 1 each of your opponent's level 3 and level 4 Digimon.";
- bool SharedCanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && card.Owner.HandCards.Count >= 1;
- }
- bool CanSelectLevel3Condition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && permanent.TopCard.IsLevel3;
- }
- bool CanSelectLevel4Condition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && permanent.TopCard.IsLevel4;
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- bool discarded = false;
- int discardCount = 1;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: (cardSource) => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: discardCount,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- mode: SelectHandEffect.Mode.Discard,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 Card to trash.", "The opponent is selecting 1 card to trash from their hand.");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- if (cardSources.Count >= 1)
- {
- discarded = true;
- yield return null;
- }
- }
- if (discarded)
- {
- List<Permanent> selectedPermanents = new List<Permanent>();
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel3Condition))
- {
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel3Condition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectLevel3Condition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectDeletionCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 level 3 Digimon to delete.", "The opponent is selecting 1 level 3 Digimon to delete.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel4Condition))
- {
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel4Condition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectLevel4Condition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectDeletionCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 Digimon to delete.", "The opponent is selecting 1 level 4 Digimon to delete.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- IEnumerator SelectDeletionCoroutine(Permanent permanent)
- {
- selectedPermanents.Add(permanent);
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
- selectedPermanents,
- CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
- }
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, true, SharedEffectDescription("On Play"));
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, true, SharedEffectDescription("When Digivolving"));
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- }
- #endregion
- #region Inherited
- if (timing == EffectTiming.None)
- {
- bool Condition()
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.IsOwnerTurn(card)
- && (card.PermanentOfThisCard().TopCard.EqualsCardName("Titamon")
- || card.PermanentOfThisCard().TopCard.EqualsTraits("Titan"));
- }
- cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|