| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Dynasmon
- namespace DCGO.CardEffects.AD1
- {
- public class AD1_017 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Reduce Play Cost
- if (timing == EffectTiming.None)
- {
- bool Condition()
- {
- return CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, WouldPlayCondition) >= 4;
- }
- bool WouldPlayCondition(CardSource cardSource)
- {
- return cardSource.HasText("Lucemon")
- || cardSource.HasText("Witchelny");
- }
- cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
- }
- #endregion
- #region Shared OP/WD
- string SharedEffectName() => "Trash sec to -6K DP enemy board for turn";
- string SharedEffectDescription(string tag) => $"[{tag}] By trashing your top or bottom security card, all of your opponent's Digimon get -6000 DP for the turn.";
- bool SharedCanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && card.Owner.SecurityCards.Count >= 1;
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
- selectionElements.Add(new(message: $"From top", value: 1, spriteIndex: 0));
- selectionElements.Add(new(message: $"From bottom", value: 2, spriteIndex: 0));
- selectionElements.Add(new(message: $"Do not trash", value: 3, spriteIndex: 1));
- string selectPlayerMessage = "From which area do you select a card?";
- string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
- GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
- bool doTrash = GManager.instance.userSelectionManager.SelectedIntValue != 3;
- bool fromTop = GManager.instance.userSelectionManager.SelectedIntValue == 1;
- if (doTrash)
- {
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner,
- destroySecurityCount: 1,
- cardEffect: activateClass,
- fromTop: fromTop).DestroySecurity());
- bool PermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
- permanentCondition: PermanentCondition,
- changeValue: -6000,
- effectDuration: EffectDuration.UntilEachTurnEnd,
- activateClass: activateClass));
- }
- }
- #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, false, 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, false, SharedEffectDescription("When Digivolving"));
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.OnLoseSecurity)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("May delete 1 enemy's lowest DP", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
- activateClass.SetHashString("AD1_017_AT");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[All Turns] [Once Per Turn] When your security stack is removed from, you may delete 1 of your opponent's lowest DP Digimon.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- #endregion
- #region Security
- if (timing == EffectTiming.SecuritySkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Give 1 enemy Digimon <Sec A. -1>, -3K DP 1 enemy Digimon until end of your turn", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- activateClass.SetIsSecurityEffect(true);
- activateClass.SetIsDigimonEffect(true);
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[Security] Give 1 of your opponent's Digimon <Security A. -1> for the turn. Then, 1 of their Digimon gets -3000 DP until your turn ends.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return card.Owner.ExecutingCards.Contains(card);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get <Security A. -1>.", "The opponent is selecting 1 Digimon that will get <Security A. -1>.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
- targetPermanent: permanent,
- changeValue: -1,
- effectDuration: EffectDuration.UntilEachTurnEnd,
- activateClass: activateClass));
- }
- SelectPermanentEffect selectPermanentEffect2 = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect2.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine2,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get -3000 DP.", "The opponent is selecting 1 Digimon that will get -3000 DP.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine2(Permanent permanent)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
- targetPermanent: permanent,
- changeValue: -3000,
- effectDuration: EffectDuration.UntilOwnerTurnEnd,
- activateClass: activateClass));
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|