| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using Unity.Mathematics;
- // SeitenGokuumon
- namespace DCGO.CardEffects.EX12
- {
- public class EX12_048 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternate Digivolution Requirement
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.HasText("Gokuumon")
- || targetPermanent.TopCard.EqualsTraits("Shambala");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null, level: 5));
- }
- #endregion
- #region Static Keywords
- #region Rush
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
- }
- #endregion
- #region Raid
- if (timing == EffectTiming.OnAllyAttack)
- {
- cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
- }
- #endregion
- #region Piercing
- if (timing == EffectTiming.OnDetermineDoSecurityCheck)
- {
- cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
- }
- #endregion
- #region Security A. +1
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
- }
- #endregion
- #endregion
- #region Shared OP/WD
- string SharedEffectName = "Give 1 enemy Digimon -8K DP + -3K DP per lvl 5 in source, then this may attack";
- CardEffectFactory.ActivateClassesForSharedEffects
- (ref cardEffects, timing, card,
- SharedEffectName,
- SharedActivateCoroutine,
- SharedEffectDescription,
- optional: false,
- onPlay: true,
- whenDigivolving: true);
- string SharedEffectDescription(string tag)
- {
- return $"[{tag}] 1 of your opponent's Digimon gets -8000 DP until their turn ends. It further gets -3000 DP for each of this Digimon's level 5 digivolution cards. Then, this Digimon may attack.";
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- bool DigivolutionCardCondition(CardSource cardSource)
- {
- return cardSource.IsLevel5;
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- int dpMinus = -8000 + card.PermanentOfThisCard().DigivolutionCards.Filter(DigivolutionCardCondition).Count() * -3000;
- Permanent selectedPermament = null;
- #region Select Permanent
- 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);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermament = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon to {dpMinus} DP", $"The opponent is selecting 1 Digimon to {dpMinus} DP");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- #endregion
- if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
- targetPermanent: selectedPermament,
- changeValue: dpMinus,
- effectDuration: EffectDuration.UntilOpponentTurnEnd,
- activateClass: activateClass
- ));
- }
- if (card.PermanentOfThisCard().CanAttack(activateClass))
- {
- SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
- selectAttackEffect.SetUp(
- attacker: card.PermanentOfThisCard(),
- canAttackPlayerCondition: () => true,
- defenderCondition: _ => true,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
- }
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.WhenRemoveField)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("May play 2 [Gokuumon] in text/[SW] trait cards from sources for free", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[All Turns] When this Digimon would leave the battle area other than by your effects, you may play 2 level 5 cards with [Gokuumon] in their texts or the [SW] trait from its digivolution cards without paying the costs.";
- }
- bool CanSelectSourceCardCondition(CardSource cardSource)
- {
- return cardSource.IsLevel5
- && (cardSource.HasText("Gokuumon")
- || cardSource.EqualsTraits("SW"))
- && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
- && CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card)
- && !CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card));
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
- && card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectSourceCardCondition);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- int maxCount = math.min(2, card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectSourceCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectSourceCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select card(s) to play",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.DigivolutionCards,
- customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage(
- "Select [Gokuumon] in text/[SW] trait card(s) to play.",
- "The opponent is selecting [Gokuumon] in text/[SW] trait card(s) to play.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Played Card(s)");
- yield return StartCoroutine(selectCardEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.PlayPermanentCards(
- cardSources: selectedCards,
- activateClass: activateClass,
- payCost: false,
- isTapped: false,
- root: SelectCardEffect.Root.DigivolutionCards,
- activateETB: true));
- }
- }
- #endregion
- #region Assembly
- if (timing == EffectTiming.None)
- {
- AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
- addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card);
- addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
- addAssemblyConditionClass.SetNotShowUI(true);
- cardEffects.Add(addAssemblyConditionClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return true;
- }
- AssemblyCondition GetAssembly(CardSource cardSource)
- {
- if (cardSource == card)
- {
- AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition);
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource != null
- && cardSource.Owner == card.Owner
- && cardSource.IsDigimon
- && (cardSource.EqualsCardName("Gokuumon")
- || cardSource.EqualsCardName("Sagomon")
- || cardSource.EqualsCardName("Cho-Hakkaimon")
- || cardSource.EqualsCardName("Sanzomon"));
- }
- bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
- {
- List<string> cardNames = new List<string>();
- foreach (CardSource cardSource1 in cardSources)
- {
- foreach (string cardName in cardSource1.CardNames)
- {
- if (!cardNames.Contains(cardName))
- {
- cardNames.Add(cardName);
- }
- }
- }
- if (cardSource.CardNames.Count((cardName) => cardNames.Contains(cardName)) >= 1)
- {
- return false;
- }
- return true;
- }
- AssemblyCondition assemblyCondition = new AssemblyCondition(
- element: element,
- CanTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
- selectMessage: "3 [Gokuumon] / [Sagomon] / [Cho - Hakkaimon] / [Sanzomon] w/ different names",
- elementCount: 3,
- reduceCost: 6);
- return assemblyCondition;
- }
- return null;
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|