|
|
@@ -9,20 +9,63 @@ using UnityEngine.Events;
|
|
|
|
|
|
public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
- public List<CardSource> selectedDigicrossCards { get; private set; } = new List<CardSource>();
|
|
|
- public List<AddDigivolutionCardsInfo> addDigivolutionCardInfos { get; private set; } = new List<AddDigivolutionCardsInfo>();
|
|
|
- public CardSource playCard { get; private set; } = null;
|
|
|
+ private List<CardSource> selectedDigicrossCards = new List<CardSource>();
|
|
|
+
|
|
|
+ public List<CardSource> PreviouslySelectedDigicrossCards { get; private set; } = new List<CardSource>();
|
|
|
+
|
|
|
+ private List<PlayCardTuple> AllDigiXrosCards = new List<PlayCardTuple>();
|
|
|
+
|
|
|
+ private void AddSelectedCard(CardSource cardSource)
|
|
|
+ {
|
|
|
+ selectedDigicrossCards.Add(cardSource);
|
|
|
+ PreviouslySelectedDigicrossCards.Add(cardSource);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<CardSource> GetPreviouslySelected()
|
|
|
+ {
|
|
|
+ SelectAssemblyClass selectAssemblyClass = GManager.instance.GetComponent<SelectAssemblyClass>();
|
|
|
+ return AllDigiXrosCards.Map(tuple => tuple.SelectedDigicrossCards).Flat().Concat(selectAssemblyClass.PreviouslySelectedAssemblyCards).ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ private class PlayCardTuple
|
|
|
+ {
|
|
|
+ public CardSource PlayCard;
|
|
|
+ public List<CardSource> SelectedDigicrossCards;
|
|
|
+ public List<AddDigivolutionCardsInfo> AddDigivolutionCardInfos;
|
|
|
+ }
|
|
|
+
|
|
|
+ private PlayCardTuple GetTupleForCard(CardSource card)
|
|
|
+ {
|
|
|
+ return AllDigiXrosCards.FirstOrDefault(tuple => tuple.PlayCard == card);
|
|
|
+ }
|
|
|
+
|
|
|
+ private PlayCardTuple GetOrMakeTupleForCard(CardSource card)
|
|
|
+ {
|
|
|
+ PlayCardTuple cardTuple = GetTupleForCard(card);
|
|
|
+ if (cardTuple == null)
|
|
|
+ {
|
|
|
+ cardTuple = new()
|
|
|
+ {
|
|
|
+ PlayCard = card,
|
|
|
+ SelectedDigicrossCards = new List<CardSource>(),
|
|
|
+ AddDigivolutionCardInfos = new List<AddDigivolutionCardsInfo>()
|
|
|
+ };
|
|
|
+ AllDigiXrosCards.Add(cardTuple);
|
|
|
+ }
|
|
|
+ return cardTuple;
|
|
|
+ }
|
|
|
|
|
|
public void ResetSelectDigiXrosClass()
|
|
|
{
|
|
|
+ AllDigiXrosCards = new List<PlayCardTuple>();
|
|
|
selectedDigicrossCards = new List<CardSource>();
|
|
|
- addDigivolutionCardInfos = new List<AddDigivolutionCardsInfo>();
|
|
|
- playCard = null;
|
|
|
+ PreviouslySelectedDigicrossCards = new List<CardSource>();
|
|
|
}
|
|
|
|
|
|
- public void AddDigivolutionCardInfos(AddDigivolutionCardsInfo digivolutionCardsInfo)
|
|
|
+ public void AddDigivolutionCardInfos(CardSource card, AddDigivolutionCardsInfo digivolutionCardsInfo)
|
|
|
{
|
|
|
- addDigivolutionCardInfos.Add(digivolutionCardsInfo);
|
|
|
+ PlayCardTuple cardTuple = GetOrMakeTupleForCard(card);
|
|
|
+ cardTuple.AddDigivolutionCardInfos.Add(digivolutionCardsInfo);
|
|
|
}
|
|
|
|
|
|
#region Max Trash Count
|
|
|
@@ -34,10 +77,10 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
List<int> maxTrashCountList = new List<int>();
|
|
|
|
|
|
- #region 選択可能トラッシュ枚数を変更する効果
|
|
|
+ #region 驕ク謚槫庄閭ス繝医Λ繝�す繝・譫壽焚繧貞、画峩縺吶k蜉ケ譫�
|
|
|
foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
|
|
|
{
|
|
|
- #region 場のパーマネントの効果
|
|
|
+ #region 蝣エ縺ョ繝代�繝槭ロ繝ウ繝医�蜉ケ譫�
|
|
|
foreach (Permanent permanent in player.GetBattleAreaPermanents())
|
|
|
{
|
|
|
foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
|
|
|
@@ -58,7 +101,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- #region プレイヤーの効果
|
|
|
+ #region 繝励Ξ繧、繝、繝シ縺ョ蜉ケ譫�
|
|
|
foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
|
|
|
{
|
|
|
if (cardEffect is IAddMaxTrashCountDigiXrosEffect)
|
|
|
@@ -77,7 +120,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
- #region カード自身の効果
|
|
|
+ #region 繧ォ繝シ繝芽�霄ォ縺ョ蜉ケ譫�
|
|
|
if (card.PermanentOfThisCard() == null)
|
|
|
{
|
|
|
foreach (ICardEffect cardEffect in card.EffectList(EffectTiming.None))
|
|
|
@@ -129,10 +172,10 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
List<int> maxTamerDigivolutionCardsCountList = new List<int>();
|
|
|
|
|
|
- #region 選択可能テイマー進化元枚数を変更する効果
|
|
|
+ #region 驕ク謚槫庄閭ス繝�う繝槭�騾イ蛹門�譫壽焚繧貞、画峩縺吶k蜉ケ譫�
|
|
|
foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
|
|
|
{
|
|
|
- #region 場のパーマネントの効果
|
|
|
+ #region 蝣エ縺ョ繝代�繝槭ロ繝ウ繝医�蜉ケ譫�
|
|
|
foreach (Permanent permanent in player.GetBattleAreaPermanents())
|
|
|
{
|
|
|
foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
|
|
|
@@ -153,7 +196,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- #region プレイヤーの効果
|
|
|
+ #region 繝励Ξ繧、繝、繝シ縺ョ蜉ケ譫�
|
|
|
foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
|
|
|
{
|
|
|
if (cardEffect is IAddMaxUnderTamerCountDigiXrosEffect)
|
|
|
@@ -172,7 +215,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
- #region カード自身の効果
|
|
|
+ #region 繧ォ繝シ繝芽�霄ォ縺ョ蜉ケ譫�
|
|
|
if (card.PermanentOfThisCard() == null)
|
|
|
{
|
|
|
foreach (ICardEffect cardEffect in card.EffectList(EffectTiming.None))
|
|
|
@@ -314,13 +357,14 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
if (!targetCard.IsToken)
|
|
|
{
|
|
|
- if (!selectedDigicrossCards.Contains(targetCard))
|
|
|
+ if (!PreviouslySelectedDigicrossCards.Contains(targetCard))
|
|
|
{
|
|
|
+ List<AddDigivolutionCardsInfo> addDigivolutionCardInfos = GetAddDigivolutionCardInfos(card);
|
|
|
if (addDigivolutionCardInfos.Count((addDigivolutionCardInfo) => addDigivolutionCardInfo.cardSources.Contains(targetCard)) == 0)
|
|
|
{
|
|
|
if (card.digiXrosCondition.CanTargetCondition_ByPreSelecetedList != null)
|
|
|
{
|
|
|
- if (!card.digiXrosCondition.CanTargetCondition_ByPreSelecetedList(selectedDigicrossCards, targetCard))
|
|
|
+ if (!card.digiXrosCondition.CanTargetCondition_ByPreSelecetedList(PreviouslySelectedDigicrossCards, targetCard))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
@@ -360,9 +404,11 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
GManager.instance.turnStateMachine.isSync = true;
|
|
|
|
|
|
- selectedDigicrossCards = new List<CardSource>();
|
|
|
+ PlayCardTuple cardTuple = GetOrMakeTupleForCard(card);
|
|
|
|
|
|
- playCard = card;
|
|
|
+ selectedDigicrossCards = cardTuple.SelectedDigicrossCards;
|
|
|
+
|
|
|
+ PreviouslySelectedDigicrossCards = GetPreviouslySelected();
|
|
|
|
|
|
if (card != null)
|
|
|
{
|
|
|
@@ -518,7 +564,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
GManager.instance.commandText.OpenCommandText($"The opponent is choosing from which area to select {element.selectMessage}.", digiXros: true);
|
|
|
|
|
|
- #region AIモード
|
|
|
+ #region AI繝「繝シ繝�
|
|
|
if (GManager.instance.IsAI)
|
|
|
{
|
|
|
List<int> indexes = new List<int>();
|
|
|
@@ -600,7 +646,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
|
|
|
IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
{
|
|
|
- selectedDigicrossCards.Add(cardSource);
|
|
|
+ AddSelectedCard(cardSource);
|
|
|
|
|
|
yield return null;
|
|
|
}
|
|
|
@@ -624,7 +670,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- #region 輯elect Battle Area Permanent
|
|
|
+ #region Select Battle Area Permanent
|
|
|
IEnumerator SelectBattleAreaPermanent(DigiXrosCondition digiXrosCondition, DigiXrosConditionElement element, CardSource card)
|
|
|
{
|
|
|
bool CanSelectPermanentCondition(Permanent permanent) => permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent) && CanSelectDigiXros(element, permanent.TopCard, card);
|
|
|
@@ -658,7 +704,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
|
|
|
IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
{
|
|
|
- selectedDigicrossCards.Add(permanent.TopCard);
|
|
|
+ AddSelectedCard(permanent.TopCard);
|
|
|
|
|
|
yield return null;
|
|
|
}
|
|
|
@@ -775,7 +821,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
|
|
|
IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
{
|
|
|
- selectedDigicrossCards.Add(cardSource);
|
|
|
+ AddSelectedCard(cardSource);
|
|
|
|
|
|
yield return null;
|
|
|
}
|
|
|
@@ -840,7 +886,7 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
|
|
|
IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
{
|
|
|
- selectedDigicrossCards.Add(cardSource);
|
|
|
+ AddSelectedCard(cardSource);
|
|
|
|
|
|
yield return null;
|
|
|
}
|
|
|
@@ -872,6 +918,33 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+ #region Check if card was DigiXrosed
|
|
|
+ public bool WasDigiXrosed(CardSource card)
|
|
|
+ {
|
|
|
+ return GetTupleForCard(card) != null;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Get Count of Digivolution Cards for Card
|
|
|
+ public int GetSelectedCardCount(CardSource card)
|
|
|
+ {
|
|
|
+ PlayCardTuple cardTuple = GetTupleForCard(card);
|
|
|
+ if (cardTuple != null)
|
|
|
+ {
|
|
|
+ return cardTuple.SelectedDigicrossCards.Count;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Get AddDigivolutionCardInfos
|
|
|
+ public List<AddDigivolutionCardsInfo> GetAddDigivolutionCardInfos(CardSource card)
|
|
|
+ {
|
|
|
+ PlayCardTuple cardTuple = GetOrMakeTupleForCard(card);
|
|
|
+ return cardTuple.AddDigivolutionCardInfos;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region Add Digivolution Cards
|
|
|
public IEnumerator AddDigivolutiuonCards(CardSource card)
|
|
|
{
|
|
|
@@ -879,10 +952,13 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
if (card != null)
|
|
|
{
|
|
|
- if (card == playCard)
|
|
|
+ PlayCardTuple cardTuple = GetTupleForCard(card);
|
|
|
+ if (cardTuple != null)
|
|
|
{
|
|
|
if (card.PermanentOfThisCard() != null)
|
|
|
{
|
|
|
+ selectedDigicrossCards = cardTuple.SelectedDigicrossCards;
|
|
|
+
|
|
|
yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(selectedDigicrossCards, "Digixros Cards", true, true));
|
|
|
|
|
|
foreach (CardSource cardSource in selectedDigicrossCards)
|
|
|
@@ -927,81 +1003,83 @@ public class SelectDigiXrosClass : MonoBehaviourPunCallbacks
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- #region 効果によって進化元を付与(天野ユウ(BT10),シャウトモンX7スペリオルモード(BT12))
|
|
|
+ #region 蜉ケ譫懊↓繧医▲縺ヲ騾イ蛹門�繧剃サ倅ク�(螟ゥ驥弱Θ繧ヲ(BT10),繧キ繝」繧ヲ繝医Δ繝ウX7繧ケ繝壹Μ繧ェ繝ォ繝「繝シ繝�(BT12))
|
|
|
public IEnumerator AddDigivolutiuonCardsByEffect(CardSource card)
|
|
|
{
|
|
|
- if (addDigivolutionCardInfos.Count >= 1)
|
|
|
+ PlayCardTuple cardTuple = GetTupleForCard(card);
|
|
|
+ if (cardTuple != null)
|
|
|
{
|
|
|
- if (card != null)
|
|
|
+ List<AddDigivolutionCardsInfo> addDigivolutionCardInfos = cardTuple.AddDigivolutionCardInfos;
|
|
|
+ if (addDigivolutionCardInfos.Count >= 1)
|
|
|
{
|
|
|
- if (card.PermanentOfThisCard() != null)
|
|
|
+ if (card != null)
|
|
|
{
|
|
|
- List<CardSource> addedCards = new List<CardSource>();
|
|
|
-
|
|
|
- foreach (AddDigivolutionCardsInfo info in addDigivolutionCardInfos)
|
|
|
+ if (card.PermanentOfThisCard() != null)
|
|
|
{
|
|
|
- List<CardSource> underTamerCards = new List<CardSource>();
|
|
|
- List<Permanent> digimonPermanents = new List<Permanent>();
|
|
|
- List<CardSource> trashCards = new List<CardSource>();
|
|
|
- List<CardSource> secuirtyCards = new List<CardSource>();
|
|
|
+ List<CardSource> addedCards = new List<CardSource>();
|
|
|
|
|
|
- foreach (CardSource cardSource in info.cardSources)
|
|
|
+ foreach (AddDigivolutionCardsInfo info in addDigivolutionCardInfos)
|
|
|
{
|
|
|
- if (isTamerDigivolutionCard(cardSource))
|
|
|
+ List<CardSource> underTamerCards = new List<CardSource>();
|
|
|
+ List<Permanent> digimonPermanents = new List<Permanent>();
|
|
|
+ List<CardSource> trashCards = new List<CardSource>();
|
|
|
+ List<CardSource> secuirtyCards = new List<CardSource>();
|
|
|
+
|
|
|
+ foreach (CardSource cardSource in info.cardSources)
|
|
|
{
|
|
|
- underTamerCards.Add(cardSource);
|
|
|
- addedCards.Add(cardSource);
|
|
|
+ if (isTamerDigivolutionCard(cardSource))
|
|
|
+ {
|
|
|
+ underTamerCards.Add(cardSource);
|
|
|
+ addedCards.Add(cardSource);
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (isBattleAreaCard(cardSource))
|
|
|
+ {
|
|
|
+ digimonPermanents.Add(cardSource.PermanentOfThisCard());
|
|
|
+ addedCards.Add(cardSource);
|
|
|
+ }
|
|
|
+ else if (isTrashCard(cardSource))
|
|
|
+ {
|
|
|
+ trashCards.Add(cardSource);
|
|
|
+ addedCards.Add(cardSource);
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (isSecurityCard(cardSource))
|
|
|
+ {
|
|
|
+ secuirtyCards.Add(cardSource);
|
|
|
+ addedCards.Add(cardSource);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- else if (isBattleAreaCard(cardSource))
|
|
|
+ if (underTamerCards.Count >= 1)
|
|
|
{
|
|
|
- digimonPermanents.Add(cardSource.PermanentOfThisCard());
|
|
|
- addedCards.Add(cardSource);
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(underTamerCards, info.cardEffect));
|
|
|
}
|
|
|
- else if (isTrashCard(cardSource))
|
|
|
+
|
|
|
+ if (digimonPermanents.Count >= 1)
|
|
|
{
|
|
|
- trashCards.Add(cardSource);
|
|
|
- addedCards.Add(cardSource);
|
|
|
+ foreach (Permanent digimonPermanent in digimonPermanents)
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { digimonPermanent, card.PermanentOfThisCard() } }, false, info.cardEffect).PlacePermanentToDigivolutionCards());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- else if (isSecurityCard(cardSource))
|
|
|
+ if (trashCards.Count >= 1)
|
|
|
{
|
|
|
- secuirtyCards.Add(cardSource);
|
|
|
- addedCards.Add(cardSource);
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(trashCards, info.cardEffect));
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (underTamerCards.Count >= 1)
|
|
|
- {
|
|
|
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(underTamerCards, info.cardEffect));
|
|
|
- }
|
|
|
-
|
|
|
- if (digimonPermanents.Count >= 1)
|
|
|
- {
|
|
|
- foreach (Permanent digimonPermanent in digimonPermanents)
|
|
|
+ if (secuirtyCards.Count >= 1)
|
|
|
{
|
|
|
- yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { digimonPermanent, card.PermanentOfThisCard() } }, false, info.cardEffect).PlacePermanentToDigivolutionCards());
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(secuirtyCards, info.cardEffect));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (trashCards.Count >= 1)
|
|
|
- {
|
|
|
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(trashCards, info.cardEffect));
|
|
|
- }
|
|
|
-
|
|
|
- if (secuirtyCards.Count >= 1)
|
|
|
- {
|
|
|
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(secuirtyCards, info.cardEffect));
|
|
|
- }
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(addedCards, "Digivolution Cards", true, true));
|
|
|
}
|
|
|
-
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(addedCards, "Digivolution Cards", true, true));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- addDigivolutionCardInfos = new List<AddDigivolutionCardsInfo>();
|
|
|
-
|
|
|
yield return null;
|
|
|
}
|
|
|
#endregion
|