|
|
@@ -1,5 +1,6 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace DCGO.CardEffects.BT20
|
|
|
{
|
|
|
@@ -9,34 +10,307 @@ namespace DCGO.CardEffects.BT20
|
|
|
{
|
|
|
List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
|
|
|
- if (timing == EffectTiming.None)
|
|
|
+ #region Main Effect
|
|
|
+
|
|
|
+ if (timing == EffectTiming.OptionSkill)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return
|
|
|
+ "[Main] Reveal the top 3 cards of your deck. Add 1 [Chronicle] trait card among them to the hand. Return the rest to the top or bottom of the deck. Then, place this card in the battle area.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectChronicleCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return cardSource.ContainsTraits("Chronicle");
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
|
|
|
+ revealCount: 3,
|
|
|
+ simplifiedSelectCardConditions:
|
|
|
+ new SimplifiedSelectCardConditionClass[]
|
|
|
+ {
|
|
|
+ new(
|
|
|
+ canTargetCondition: CanSelectChronicleCondition,
|
|
|
+ message: "Select 1 card with the [Chronicle] trait.",
|
|
|
+ mode: SelectCardEffect.Mode.AddHand,
|
|
|
+ maxCount: 1,
|
|
|
+ selectCardCoroutine: null)
|
|
|
+ },
|
|
|
+ remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
|
|
|
+ activateClass: activateClass
|
|
|
+ ));
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Delay
|
|
|
+
|
|
|
+ if (timing == EffectTiming.OnDestroyedAnyone)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Play 1 Digimon", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDescription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return
|
|
|
+ "[All Turns] When any of your [Chronicle] trait Digimon are deleted, <Delay>.\n・By moving your level 3 or higher [Chronicle] trait Digimon from the breeding area to the battle area, it may digivolve into a [Chronicle] trait Digimon card in the hand or trash without paying the cost.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool PermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
|
|
|
+ permanent.TopCard.ContainsTraits("Chronicle");
|
|
|
+ }
|
|
|
+
|
|
|
+ bool BreedingAreaPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return permanent.IsDigimon &&
|
|
|
+ permanent.TopCard.ContainsTraits("Chronicle") &&
|
|
|
+ permanent.TopCard.HasLevel && permanent.Level >= 3 &&
|
|
|
+ permanent.CanMove;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanDeclareOptionDelayEffect(card) &&
|
|
|
+ CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (card.Owner.GetBreedingAreaPermanents().Count(BreedingAreaPermanentCondition) >= 1 &&
|
|
|
+ card.Owner.fieldCardFrames.Count(frame => frame.IsEmptyFrame()) >= 1)
|
|
|
+ {
|
|
|
+ Permanent selectedPermanent = card.Owner.GetBreedingAreaPermanents()[0];
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardObjectController.MovePermanent(selectedPermanent.PermanentFrame));
|
|
|
+
|
|
|
+ bool CanSelectDigivolveCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return cardSource.EqualsTraits("Chronicle") &&
|
|
|
+ cardSource.CanPlayCardTargetFrame(
|
|
|
+ selectedPermanent.PermanentFrame, false, activateClass);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDigivolveCardCondition);
|
|
|
+ bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectDigivolveCardCondition);
|
|
|
+
|
|
|
+ if (canSelectHand || canSelectTrash)
|
|
|
+ {
|
|
|
+ List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
|
|
|
+ {
|
|
|
+ new(message: "Digivolve", value: true, spriteIndex: 0),
|
|
|
+ new(message: "Do not digivolve", value: false, spriteIndex: 1),
|
|
|
+ };
|
|
|
+
|
|
|
+ string selectPlayerMessage = "Digivolve?";
|
|
|
+ string notSelectPlayerMessage = "The opponent is choosing whether to digivolve.";
|
|
|
+
|
|
|
+ GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
|
|
|
+ selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
|
|
|
+ notSelectPlayerMessage: notSelectPlayerMessage);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
|
|
|
+ .WaitForEndSelect());
|
|
|
+
|
|
|
+ if (GManager.instance.userSelectionManager.SelectedBoolValue)
|
|
|
+ {
|
|
|
+ if (canSelectHand && canSelectTrash)
|
|
|
+ {
|
|
|
+ selectionElements = new List<SelectionElement<bool>>()
|
|
|
+ {
|
|
|
+ new(message: "From hand", value: true, spriteIndex: 0),
|
|
|
+ new(message: "From trash", value: false, spriteIndex: 1),
|
|
|
+ };
|
|
|
+
|
|
|
+ selectPlayerMessage = "From which area do you play a card?";
|
|
|
+ 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(canSelectHand);
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
|
|
|
+ .WaitForEndSelect());
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardEffectCommons.DigivolveIntoHandOrTrashCard(
|
|
|
+ targetPermanent: selectedPermanent,
|
|
|
+ cardCondition: CanSelectDigivolveCardCondition,
|
|
|
+ payCost: false,
|
|
|
+ reduceCostTuple: null,
|
|
|
+ fixedCostTuple: null,
|
|
|
+ ignoreDigivolutionRequirementFixedCost: -1,
|
|
|
+ isHand: GManager.instance.userSelectionManager.SelectedBoolValue,
|
|
|
+ activateClass: activateClass,
|
|
|
+ successProcess: null));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Security Effect
|
|
|
+
|
|
|
+ if (timing == EffectTiming.SecuritySkill)
|
|
|
{
|
|
|
ActivateClass activateClass = new ActivateClass();
|
|
|
- activateClass.SetUpICardEffect("", CanUseCondition, card);
|
|
|
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
|
|
|
+ activateClass.SetUpICardEffect("Play 1 [Chronicle] trait card from hand or trash", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
+ activateClass.SetIsSecurityEffect(true);
|
|
|
cardEffects.Add(activateClass);
|
|
|
|
|
|
- string EffectDiscription()
|
|
|
+ string EffectDescription()
|
|
|
{
|
|
|
- return "";
|
|
|
+ return
|
|
|
+ "[Security] You may play 1 [Chronicle] trait card with a play cost of 5 or less from your hand or trash without paying the cost. Then, place this card in the battle area.";
|
|
|
}
|
|
|
|
|
|
bool CanUseCondition(Hashtable hashtable)
|
|
|
{
|
|
|
- return true;
|
|
|
+ return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
|
|
|
}
|
|
|
|
|
|
- bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
{
|
|
|
- return true;
|
|
|
+ return cardSource.ContainsTraits("Chronicle") &&
|
|
|
+ cardSource.HasPlayCost && cardSource.GetCostItself <= 5 &&
|
|
|
+ CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
|
|
|
}
|
|
|
|
|
|
IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
{
|
|
|
- yield return null;
|
|
|
+ bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
|
|
|
+ bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
|
|
|
+
|
|
|
+ if (canSelectHand || canSelectTrash)
|
|
|
+ {
|
|
|
+ if (canSelectHand && canSelectTrash)
|
|
|
+ {
|
|
|
+ List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>
|
|
|
+ {
|
|
|
+ new(message: "From hand", value: true, spriteIndex: 0),
|
|
|
+ new(message: "From trash", 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(canSelectHand);
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
|
|
|
+ .WaitForEndSelect());
|
|
|
+
|
|
|
+ bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
|
|
|
+
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
+ {
|
|
|
+ selectedCards.Add(cardSource);
|
|
|
+ yield return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fromHand)
|
|
|
+ {
|
|
|
+ SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
|
|
|
+
|
|
|
+ selectHandEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: CanSelectCardCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: 1,
|
|
|
+ canNoSelect: true,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: true,
|
|
|
+ selectCardCoroutine: SelectCardCoroutine,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ mode: SelectHandEffect.Mode.Custom,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
|
|
|
+ selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
|
|
|
+
|
|
|
+ yield return StartCoroutine(selectHandEffect.Activate());
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
|
|
|
+ cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
|
|
|
+ root: fromHand ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash, activateETB: true));
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
return cardEffects;
|
|
|
}
|
|
|
}
|