|
|
@@ -28,7 +28,9 @@ namespace DCGO.CardEffects.BT21
|
|
|
{
|
|
|
if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
|
|
|
{
|
|
|
- if (permanent.cardSources.Find(source => source.EqualsCardName("Agunimon") || source.EqualsCardName("BurningGreymon")) != null)
|
|
|
+ if (permanent.cardSources.Find(source =>
|
|
|
+ (source.EqualsCardName("Agunimon") || source.EqualsCardName("BurningGreymon")) &&
|
|
|
+ source.CanPlayCardTargetFrame(permanent.PermanentFrame, true, activateClass)))
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
@@ -64,83 +66,80 @@ namespace DCGO.CardEffects.BT21
|
|
|
|
|
|
IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
{
|
|
|
- if (CardEffectCommons.IsExistOnHand(card))
|
|
|
- {
|
|
|
- Hashtable hashtable = new Hashtable();
|
|
|
- hashtable.Add("CardEffect", activateClass);
|
|
|
+ Hashtable hashtable = new Hashtable();
|
|
|
+ hashtable.Add("CardEffect", activateClass);
|
|
|
|
|
|
- ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
|
|
|
+ ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
|
|
|
|
|
|
- ChangeCostClass changeCostClass = new ChangeCostClass();
|
|
|
- changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
|
|
|
- changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
|
|
|
- card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
|
|
|
+ ChangeCostClass changeCostClass = new ChangeCostClass();
|
|
|
+ changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
|
|
|
+ changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
|
|
|
+ card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
|
|
|
|
|
|
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
|
|
|
|
|
|
- bool CanUseCondition1(Hashtable hashtable)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
+ bool CanUseCondition1(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
|
|
|
+ int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
|
|
|
+ {
|
|
|
+ if (CardSourceCondition(cardSource))
|
|
|
{
|
|
|
- if (CardSourceCondition(cardSource))
|
|
|
+ if (RootCondition(root))
|
|
|
{
|
|
|
- if (RootCondition(root))
|
|
|
+ if (PermanentsCondition(targetPermanents))
|
|
|
{
|
|
|
- if (PermanentsCondition(targetPermanents))
|
|
|
- {
|
|
|
- Cost -= 1;
|
|
|
- }
|
|
|
+ Cost -= 1;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return Cost;
|
|
|
}
|
|
|
|
|
|
- bool PermanentsCondition(List<Permanent> targetPermanents)
|
|
|
- {
|
|
|
- if (targetPermanents != null)
|
|
|
- {
|
|
|
- if (targetPermanents.Exists(PermanentCondition))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return Cost;
|
|
|
+ }
|
|
|
|
|
|
- bool PermanentCondition(Permanent targetPermanent)
|
|
|
+ bool PermanentsCondition(List<Permanent> targetPermanents)
|
|
|
+ {
|
|
|
+ if (targetPermanents != null)
|
|
|
{
|
|
|
- if (targetPermanent.TopCard != null)
|
|
|
+ if (targetPermanents.Exists(PermanentCondition))
|
|
|
{
|
|
|
- return PermanentCondition(targetPermanent);
|
|
|
+ return true;
|
|
|
}
|
|
|
-
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
- bool CardSourceCondition(CardSource cardSource)
|
|
|
- {
|
|
|
- if (cardSource != null)
|
|
|
- {
|
|
|
- return CardCondition(cardSource);
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- bool RootCondition(SelectCardEffect.Root root)
|
|
|
+ bool PermanentCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ if (targetPermanent.TopCard != null)
|
|
|
{
|
|
|
- return true;
|
|
|
+ return PermanentCondition(targetPermanent);
|
|
|
}
|
|
|
|
|
|
- bool isUpDown()
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CardSourceCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource != null)
|
|
|
{
|
|
|
- return true;
|
|
|
+ return CardCondition(cardSource);
|
|
|
}
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool RootCondition(SelectCardEffect.Root root)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool isUpDown()
|
|
|
+ {
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -164,24 +163,39 @@ namespace DCGO.CardEffects.BT21
|
|
|
|
|
|
#region On Deletion / ESS Shared
|
|
|
|
|
|
- ActivateClass SharedActivateClass()
|
|
|
+ string OnDeletionEffectDiscription()
|
|
|
{
|
|
|
- ActivateClass activateClass = new ActivateClass();
|
|
|
- activateClass.SetUpICardEffect("Play a Red tamer from hand or trash", CanUseCondition, card);
|
|
|
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
|
|
|
+ return "[On Deletion] You may play 1 red Tamer card with inherited effects from your hand or trash without paying the cost.";
|
|
|
+ }
|
|
|
|
|
|
- string EffectDiscription()
|
|
|
- {
|
|
|
- return "[On Deletion] You may play 1 red Tamer card with inherited effects from your hand or trash without paying the cost.";
|
|
|
- }
|
|
|
+ bool CanUseOnDeletionCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
|
|
|
+ }
|
|
|
|
|
|
- bool CanUseCondition(Hashtable hashtable)
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region On Deletion
|
|
|
+ if (timing == EffectTiming.OnDestroyedAnyone)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Play a Red tamer from hand or trash", CanUseOnDeletionCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, OnDeletionActivateCoroutine, -1, true, OnDeletionEffectDiscription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ bool CanSelectCard(CardSource source)
|
|
|
{
|
|
|
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
|
|
|
+ if (source.IsTamer)
|
|
|
{
|
|
|
- if (CardEffectCommons.CanTriggerOnDeletion(hashtable, card))
|
|
|
+ if (source.CardColors.Contains(CardColor.Red))
|
|
|
{
|
|
|
- return true;
|
|
|
+ if (source.HasInheritedEffect)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass, SelectCardEffect.Root.Hand) || CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass, SelectCardEffect.Root.Trash))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
@@ -189,7 +203,7 @@ namespace DCGO.CardEffects.BT21
|
|
|
|
|
|
bool CanActivateCondition(Hashtable hashtable)
|
|
|
{
|
|
|
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
|
|
|
+ if (CardEffectCommons.CanActivateOnDeletion(card))
|
|
|
{
|
|
|
if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCard) || CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCard))
|
|
|
{
|
|
|
@@ -199,6 +213,82 @@ namespace DCGO.CardEffects.BT21
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ IEnumerator OnDeletionActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ SelectCardEffect.Root? rootmode = null!;
|
|
|
+ bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCard);
|
|
|
+ bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCard);
|
|
|
+
|
|
|
+ if (canSelectHand && !canSelectTrash) rootmode = SelectCardEffect.Root.Hand;
|
|
|
+
|
|
|
+ if (!canSelectHand && canSelectTrash) rootmode = SelectCardEffect.Root.Trash;
|
|
|
+
|
|
|
+ if (canSelectHand && canSelectTrash)
|
|
|
+ {
|
|
|
+ List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
|
|
|
+ {
|
|
|
+ new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
|
|
|
+ new SelectionElement<bool>(message: $"From trash", value : false, 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.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
|
|
|
+ rootmode = GManager.instance.userSelectionManager.SelectedBoolValue ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rootmode != null)
|
|
|
+ {
|
|
|
+ CardSource selectedCard = null;
|
|
|
+ SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
+
|
|
|
+ selectCardEffect.SetUp(
|
|
|
+ canTargetCondition: CanSelectCard,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ canNoSelect: () => true,
|
|
|
+ selectCardCoroutine: SelectCardCoroutine,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ message: "Select 1 tamer.",
|
|
|
+ maxCount: 1,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: true,
|
|
|
+ mode: SelectCardEffect.Mode.Custom,
|
|
|
+ root: (SelectCardEffect.Root)rootmode!,
|
|
|
+ customRootCardList: null,
|
|
|
+ canLookReverseCard: true,
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectCardEffect.SetUpCustomMessage("Select 1 tamer.", "The opponent is selecting 1 tamer.");
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
|
|
|
+
|
|
|
+ IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
+ {
|
|
|
+ selectedCard = cardSource;
|
|
|
+ yield return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (selectedCard)
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: (SelectCardEffect.Root)rootmode, activateETB: true));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region On Deletion - ESS
|
|
|
+ if (timing == EffectTiming.OnDestroyedAnyone)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Play a Red tamer from hand or trash", CanUseOnDeletionCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, OnDeletionActivateCoroutine, -1, true, OnDeletionEffectDiscription());
|
|
|
+ activateClass.SetIsInheritedEffect(true);
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
bool CanSelectCard(CardSource source)
|
|
|
{
|
|
|
if (source.IsTamer)
|
|
|
@@ -217,7 +307,19 @@ namespace DCGO.CardEffects.BT21
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCard) || CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCard))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator OnDeletionActivateCoroutine(Hashtable hashtable)
|
|
|
{
|
|
|
SelectCardEffect.Root? rootmode = null!;
|
|
|
bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCard);
|
|
|
@@ -281,24 +383,9 @@ namespace DCGO.CardEffects.BT21
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return activateClass;
|
|
|
}
|
|
|
-
|
|
|
#endregion
|
|
|
|
|
|
- if (timing == EffectTiming.OnDestroyedAnyone)
|
|
|
- {
|
|
|
- ActivateClass activateClass = SharedActivateClass();
|
|
|
- cardEffects.Add(activateClass);
|
|
|
- }
|
|
|
-
|
|
|
- if (timing == EffectTiming.OnDestroyedAnyone)
|
|
|
- {
|
|
|
- ActivateClass activateClass = SharedActivateClass();
|
|
|
- activateClass.SetIsInheritedEffect(true);
|
|
|
- cardEffects.Add(activateClass);
|
|
|
- }
|
|
|
-
|
|
|
return cardEffects;
|
|
|
}
|
|
|
}
|