|
|
@@ -0,0 +1,372 @@
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System;
|
|
|
+using System.Linq;
|
|
|
+
|
|
|
+namespace DCGO.CardEffects.BT17
|
|
|
+{
|
|
|
+ public class CerberusmonWerewolfMode_BT17_025 : CEntity_Effect
|
|
|
+ {
|
|
|
+ public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
|
|
|
+ {
|
|
|
+ List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
+
|
|
|
+ #region Alternate Digivolution/ Rule Trait
|
|
|
+
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ // Alternate Digivolution
|
|
|
+ bool PermanentCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ return targetPermanent.TopCard.CardNames.Contains("Cerberusmon");
|
|
|
+ }
|
|
|
+
|
|
|
+ cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
|
|
|
+ permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: true,
|
|
|
+ card: card, condition: null));
|
|
|
+
|
|
|
+ // Rule Trait
|
|
|
+ ChangeTraitsClass changeTraitsClass = new ChangeTraitsClass();
|
|
|
+ changeTraitsClass.SetUpICardEffect("Trait: Has [Dark Animal] Type", CanUseCondition, card);
|
|
|
+ changeTraitsClass.SetUpChangeTraitsClass(changeeTraits: ChangeTraits);
|
|
|
+ cardEffects.Add(changeTraitsClass);
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<string> ChangeTraits(CardSource cardSource, List<string> cardTraits)
|
|
|
+ {
|
|
|
+ if (cardSource == card)
|
|
|
+ {
|
|
|
+ cardTraits.Add("Dark Animal");
|
|
|
+ }
|
|
|
+
|
|
|
+ return cardTraits;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region When Digivolving
|
|
|
+
|
|
|
+ if (timing == EffectTiming.OnEnterFieldAnyone)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Play 1 level 3 blue or purple Digimon card from your trash or digivolution cards",
|
|
|
+ CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return
|
|
|
+ "[When Digivolving] You may play 1 level 3 blue or purple Digimon card from your trash or from one of your Digimon's digivolution cards without paying the cost. At the next end of your opponent's turn, return it to the hand.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass) &&
|
|
|
+ cardSource.IsDigimon &&
|
|
|
+ cardSource.IsLevel3 &&
|
|
|
+ (cardSource.CardColors.Contains(CardColor.Blue) || cardSource.CardColors.Contains(CardColor.Purple));
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
|
|
|
+ permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
+ {
|
|
|
+ return CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition) ||
|
|
|
+ CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
|
|
|
+ bool canSelectDigivolutionCards = CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
|
|
|
+
|
|
|
+ if (canSelectTrash || canSelectDigivolutionCards)
|
|
|
+ {
|
|
|
+ if (canSelectTrash && canSelectDigivolutionCards)
|
|
|
+ {
|
|
|
+ List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>
|
|
|
+ {
|
|
|
+ new(message: "From trash", value: true, spriteIndex: 0),
|
|
|
+ new(message: "From digivolution cards", value: false, spriteIndex: 1),
|
|
|
+ };
|
|
|
+
|
|
|
+ string selectPlayerMessage = "From which area do you play a card?";
|
|
|
+ string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
|
|
|
+
|
|
|
+ GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
|
|
|
+ selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
|
|
|
+ notSelectPlayerMessage: notSelectPlayerMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ GManager.instance.userSelectionManager.SetBool(canSelectTrash);
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
|
|
|
+ .WaitForEndSelect());
|
|
|
+
|
|
|
+ bool fromTrash = GManager.instance.userSelectionManager.SelectedBoolValue;
|
|
|
+
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
+ {
|
|
|
+ selectedCards.Add(cardSource);
|
|
|
+ yield return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fromTrash)
|
|
|
+ {
|
|
|
+ SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
+
|
|
|
+ selectCardEffect.SetUp(
|
|
|
+ canTargetCondition: CanSelectCardCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ canNoSelect: () => true,
|
|
|
+ selectCardCoroutine: SelectCardCoroutine,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ message: "Select 1 card to play.",
|
|
|
+ maxCount: 1,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: true,
|
|
|
+ mode: SelectCardEffect.Mode.Custom,
|
|
|
+ root: SelectCardEffect.Root.Trash,
|
|
|
+ customRootCardList: null,
|
|
|
+ canLookReverseCard: true,
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
|
|
|
+ selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int maxCount = Math.Min(1,
|
|
|
+ CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
|
|
|
+
|
|
|
+ SelectPermanentEffect selectPermanentEffect =
|
|
|
+ GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: CanSelectPermanentCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: maxCount,
|
|
|
+ canNoSelect: true,
|
|
|
+ canEndNotMax: false,
|
|
|
+ selectPermanentCoroutine: SelectPermanentCoroutine,
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
+ mode: SelectPermanentEffect.Mode.Custom,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUpCustomMessage(
|
|
|
+ "Select 1 Digimon which has digivolution cards.",
|
|
|
+ "The opponent is selecting 1 Digimon which has digivolution cards.");
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
+ {
|
|
|
+ if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
|
|
|
+ {
|
|
|
+ maxCount = Math.Min(1,
|
|
|
+ permanent.DigivolutionCards.Count(CanSelectCardCondition));
|
|
|
+
|
|
|
+ SelectCardEffect selectCardEffect =
|
|
|
+ GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
+
|
|
|
+ selectCardEffect.SetUp(
|
|
|
+ canTargetCondition: CanSelectCardCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ canNoSelect: () => true,
|
|
|
+ selectCardCoroutine: SelectCardCoroutine,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ message: "Select 1 digivolution card to play.",
|
|
|
+ maxCount: maxCount,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: true,
|
|
|
+ mode: SelectCardEffect.Mode.Custom,
|
|
|
+ root: SelectCardEffect.Root.Custom,
|
|
|
+ customRootCardList: permanent.DigivolutionCards,
|
|
|
+ canLookReverseCard: true,
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectCardEffect.SetUpCustomMessage(
|
|
|
+ "Select 1 digivolution card to play.",
|
|
|
+ "The opponent is selecting 1 digivolution card to play.");
|
|
|
+ selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
|
|
|
+
|
|
|
+ yield return StartCoroutine(selectCardEffect.Activate());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
|
|
|
+ cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
|
|
|
+ root: (fromTrash) ? SelectCardEffect.Root.Trash : SelectCardEffect.Root.DigivolutionCards,
|
|
|
+ activateETB: true));
|
|
|
+
|
|
|
+ if (selectedCards.Count > 0)
|
|
|
+ {
|
|
|
+ Permanent selectedPermanent = selectedCards[0].PermanentOfThisCard();
|
|
|
+
|
|
|
+ ActivateClass activateDebuffClass = new ActivateClass();
|
|
|
+ activateDebuffClass.SetUpICardEffect("Return this Digimon to the hand", CanUseDebuffCondition,
|
|
|
+ selectedPermanent.TopCard);
|
|
|
+ activateDebuffClass.SetUpActivateClass(CanActivateDebuffCondition, ActivateDebuffCoroutine, -1, false,
|
|
|
+ EffectDebuffDescription());
|
|
|
+ activateDebuffClass.SetEffectSourcePermanent(selectedPermanent);
|
|
|
+ selectedPermanent.UntilOpponentTurnEndEffects.Add(GetCardEffect);
|
|
|
+
|
|
|
+ if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
|
|
|
+ .CreateDebuffEffect(selectedPermanent));
|
|
|
+ }
|
|
|
+
|
|
|
+ string EffectDebuffDescription()
|
|
|
+ {
|
|
|
+ return "[End of Opponent's Turn] Return this Digimon to the hand.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseDebuffCondition(Hashtable debuffHashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent) &&
|
|
|
+ GManager.instance.turnStateMachine.gameContext.TurnPlayer != selectedPermanent.TopCard.Owner;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateDebuffCondition(Hashtable debuffHashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent) &&
|
|
|
+ !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateDebuffCoroutine(Hashtable debuffHashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
|
|
|
+ targetPermanents: new List<Permanent>() { selectedPermanent },
|
|
|
+ activateClass: activateDebuffClass,
|
|
|
+ successProcess: null,
|
|
|
+ failureProcess: null));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ICardEffect GetCardEffect(EffectTiming debuffTiming)
|
|
|
+ {
|
|
|
+ if (debuffTiming == EffectTiming.OnEndTurn)
|
|
|
+ {
|
|
|
+ return activateDebuffClass;
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region All Turns - ESS
|
|
|
+
|
|
|
+ if (timing == EffectTiming.OnEnterFieldAnyone)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Return 1 of your opponent's level 3 Digimon to the hand", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
|
|
|
+ activateClass.SetIsInheritedEffect(true);
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return
|
|
|
+ "[All Turns] When an effect plays or digivolves an opponent's Digimon, if you have a Tamer, this Digimon may digivolve into [Imperialdramon: Fighter Mode] in your hand without paying the cost.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool IsOwnDigimon(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectOpponentPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
|
|
|
+ permanent.TopCard.HasLevel &&
|
|
|
+ permanent.TopCard.IsLevel3;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsOwnDigimon) &&
|
|
|
+ CardEffectCommons.IsByEffect(hashtable, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
|
|
|
+ CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
|
|
|
+ {
|
|
|
+ int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
|
|
|
+
|
|
|
+ SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: CanSelectOpponentPermanentCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: maxCount,
|
|
|
+ canNoSelect: false,
|
|
|
+ canEndNotMax: false,
|
|
|
+ selectPermanentCoroutine: null,
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
+ mode: SelectPermanentEffect.Mode.Bounce,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ return cardEffects;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|