|
|
@@ -1,10 +1,9 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
-using UnityEngine;
|
|
|
using System.Linq;
|
|
|
-using Photon;
|
|
|
using System;
|
|
|
-using Photon.Pun;
|
|
|
+using System.Reflection;
|
|
|
+using UnityEngine;
|
|
|
|
|
|
public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
{
|
|
|
@@ -12,7 +11,7 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
{
|
|
|
List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
|
|
|
- #region Before Pay Cost
|
|
|
+ #region Before Pay Cost - Condition Effect
|
|
|
if (timing == EffectTiming.BeforePayCost)
|
|
|
{
|
|
|
ActivateClass activateClass = new ActivateClass();
|
|
|
@@ -52,6 +51,19 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ bool CanNoSelect(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource != null)
|
|
|
+ {
|
|
|
+ if (cardSource.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
bool CanUseCondition(Hashtable hashtable)
|
|
|
{
|
|
|
if (CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition))
|
|
|
@@ -64,7 +76,7 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
|
|
|
bool CanActivateCondition(Hashtable hashtable)
|
|
|
{
|
|
|
- if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
+ if (CardEffectCommons.IsExistOnHand(card))
|
|
|
{
|
|
|
if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
|
|
|
{
|
|
|
@@ -81,11 +93,11 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
|
|
|
List<CardSource> digivolutionCards = new List<CardSource>();
|
|
|
|
|
|
- bool CanSelectCardCondition1(CardSource cardSource)
|
|
|
+ bool CanSelectTrashCardCondition(CardSource cardSource)
|
|
|
{
|
|
|
if (CanSelectCardCondition(cardSource))
|
|
|
{
|
|
|
- if (digivolutionCards.Count((cardSource1) => cardSource1.CardID == cardSource.CardID) == 0)
|
|
|
+ if (digivolutionCards.Count((filteredCard) => filteredCard.CardID == cardSource.CardID) == 0)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
@@ -94,21 +106,22 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition1(cardSource)))
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectTrashCardCondition(cardSource)))
|
|
|
{
|
|
|
+ bool noSelect = CanNoSelect(CardEffectCommons.GetCardFromHashtable(_hashtable));
|
|
|
List<CardSource> selectedCards = new List<CardSource>();
|
|
|
|
|
|
- int maxCount = Math.Min(3 - digivolutionCards.Count, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition1(cardSource)));
|
|
|
+ int maxCount = Math.Min(3 - digivolutionCards.Count, card.Owner.TrashCards.Count((cardSource) => CanSelectTrashCardCondition(cardSource)));
|
|
|
|
|
|
if (maxCount >= 1)
|
|
|
{
|
|
|
SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
|
|
|
selectCardEffect.SetUp(
|
|
|
- canTargetCondition: CanSelectCardCondition1,
|
|
|
+ canTargetCondition: CanSelectTrashCardCondition,
|
|
|
canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
|
|
|
canEndSelectCondition: CanEndSelectCondition,
|
|
|
- canNoSelect: () => true,
|
|
|
+ canNoSelect: () => noSelect,
|
|
|
selectCardCoroutine: SelectCardCoroutine,
|
|
|
afterSelectCardCoroutine: null,
|
|
|
message: "Select cards to place in Digivolution cards.",
|
|
|
@@ -273,6 +286,108 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+ #region Reduce Play Cost - Not Shown
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ ChangeCostClass changeCostClass = new ChangeCostClass();
|
|
|
+ changeCostClass.SetUpICardEffect("Play Cost -4", CanUseCondition, card);
|
|
|
+ changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
|
|
|
+ changeCostClass.SetNotShowUI(true);
|
|
|
+ cardEffects.Add(changeCostClass);
|
|
|
+
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource.IsDigimon)
|
|
|
+ {
|
|
|
+ if (cardSource.CardTraits.Contains("Dark Masters") || cardSource.CardTraits.Contains("DarkMasters"))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (card.Owner.HandCards.Contains(card))
|
|
|
+ {
|
|
|
+ ICardEffect activateClass = card.EffectList(EffectTiming.BeforePayCost).Find(cardEffect => cardEffect.EffectName == "Placing 1 [Dark Masters] to get Play Cost -4");
|
|
|
+
|
|
|
+ if (activateClass != null)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
|
|
|
+ {
|
|
|
+ if (CardSourceCondition(cardSource))
|
|
|
+ {
|
|
|
+ if (RootCondition(root))
|
|
|
+ {
|
|
|
+ if (PermanentsCondition(targetPermanents))
|
|
|
+ {
|
|
|
+ List<CardSource> trashSources = card.Owner.TrashCards.Filter(CanSelectCardCondition);
|
|
|
+ int targetCount = (from trashCard in trashSources select trashCard.CardID).Distinct().Count();
|
|
|
+
|
|
|
+ Cost -= targetCount * 4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Cost;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool PermanentsCondition(List<Permanent> targetPermanents)
|
|
|
+ {
|
|
|
+ if (targetPermanents == null)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CardSourceCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource != null)
|
|
|
+ {
|
|
|
+ if (cardSource == card)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool RootCondition(SelectCardEffect.Root root)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool isUpDown()
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region End of Your Turn
|
|
|
if (timing == EffectTiming.OnEndTurn)
|
|
|
{
|
|
|
@@ -292,7 +407,7 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
{
|
|
|
if (cardSource.HasLevel)
|
|
|
{
|
|
|
- if(cardSource.Level == 6)
|
|
|
+ if(cardSource.Level <= 6)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
@@ -332,66 +447,18 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
{
|
|
|
if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
{
|
|
|
- bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
|
|
|
-
|
|
|
- if (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());
|
|
|
-
|
|
|
- bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
|
|
|
-
|
|
|
- List<CardSource> selectedCards = new List<CardSource>();
|
|
|
-
|
|
|
- IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
- {
|
|
|
- selectedCards.Add(cardSource);
|
|
|
-
|
|
|
- yield return null;
|
|
|
- }
|
|
|
-
|
|
|
- if (fromHand)
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
|
|
|
{
|
|
|
- int maxCount = 1;
|
|
|
-
|
|
|
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
|
|
|
-
|
|
|
- selectHandEffect.SetUp(
|
|
|
- selectPlayer: card.Owner,
|
|
|
- canTargetCondition: CanSelectCardCondition,
|
|
|
- canTargetCondition_ByPreSelecetedList: null,
|
|
|
- canEndSelectCondition: null,
|
|
|
- maxCount: maxCount,
|
|
|
- canNoSelect: true,
|
|
|
- canEndNotMax: false,
|
|
|
- isShowOpponent: true,
|
|
|
- selectCardCoroutine: SelectCardCoroutine,
|
|
|
- afterSelectCardCoroutine: null,
|
|
|
- mode: SelectHandEffect.Mode.Custom,
|
|
|
- cardEffect: activateClass);
|
|
|
+ int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
|
|
|
|
|
|
- selectHandEffect.SetUpCustomMessage(
|
|
|
- "Select 1 card to place on bottom of digivolution cards.",
|
|
|
- "The opponent is selecting 1 card to place on bottom of digivolution cards.");
|
|
|
- selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
|
|
|
- yield return StartCoroutine(selectHandEffect.Activate());
|
|
|
- }
|
|
|
+ IEnumerator SelectCardCoroutine(CardSource cardSource)
|
|
|
+ {
|
|
|
+ selectedCards.Add(cardSource);
|
|
|
|
|
|
- else
|
|
|
- {
|
|
|
- int maxCount = 1;
|
|
|
+ yield return null;
|
|
|
+ }
|
|
|
|
|
|
SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
|
|
|
@@ -419,96 +486,96 @@ public class Apocalymon_BT15_102 : CEntity_Effect
|
|
|
selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
|
|
|
|
|
|
yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
|
|
|
- }
|
|
|
|
|
|
- CardSource selectedCard = null;
|
|
|
+ CardSource selectedCard = null;
|
|
|
|
|
|
- if (selectedCards.Count >= 1)
|
|
|
- {
|
|
|
- if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
+ if (selectedCards.Count >= 1)
|
|
|
{
|
|
|
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
|
|
|
- selectedCards,
|
|
|
- activateClass));
|
|
|
+ if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
|
|
|
+ selectedCards,
|
|
|
+ activateClass));
|
|
|
|
|
|
- selectedCard = selectedCards[0];
|
|
|
+ selectedCard = selectedCards[0];
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (selectedCard != null)
|
|
|
- {
|
|
|
- List<ICardEffect> candidateEffects = selectedCard.EffectList_ForCard(EffectTiming.OnEnterFieldAnyone, card)
|
|
|
- .Clone()
|
|
|
- .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsOnPlay);
|
|
|
-
|
|
|
- if (candidateEffects.Count >= 1)
|
|
|
+ if (selectedCard != null)
|
|
|
{
|
|
|
- ICardEffect selectedEffect = null;
|
|
|
+ List<ICardEffect> candidateEffects = selectedCard.EffectList_ForCard(EffectTiming.OnEnterFieldAnyone, card)
|
|
|
+ .Clone()
|
|
|
+ .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsOnPlay);
|
|
|
|
|
|
- if (candidateEffects.Count == 1)
|
|
|
+ if (candidateEffects.Count >= 1)
|
|
|
{
|
|
|
- selectedEffect = candidateEffects[0];
|
|
|
- }
|
|
|
+ ICardEffect selectedEffect = null;
|
|
|
|
|
|
- else
|
|
|
- {
|
|
|
- List<SkillInfo> skillInfos = candidateEffects
|
|
|
- .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
|
|
|
-
|
|
|
- List<CardSource> cardSources = candidateEffects
|
|
|
- .Map(cardEffect => cardEffect.EffectSourceCard);
|
|
|
-
|
|
|
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
-
|
|
|
- selectCardEffect.SetUp(
|
|
|
- canTargetCondition: (cardSource) => true,
|
|
|
- canTargetCondition_ByPreSelecetedList: null,
|
|
|
- canEndSelectCondition: null,
|
|
|
- canNoSelect: () => false,
|
|
|
- selectCardCoroutine: null,
|
|
|
- afterSelectCardCoroutine: null,
|
|
|
- message: "Select 1 effect to activate.",
|
|
|
- maxCount: 1,
|
|
|
- canEndNotMax: false,
|
|
|
- isShowOpponent: false,
|
|
|
- mode: SelectCardEffect.Mode.Custom,
|
|
|
- root: SelectCardEffect.Root.Custom,
|
|
|
- customRootCardList: cardSources,
|
|
|
- canLookReverseCard: true,
|
|
|
- selectPlayer: card.Owner,
|
|
|
- cardEffect: activateClass);
|
|
|
-
|
|
|
- selectCardEffect.SetNotShowCard();
|
|
|
- selectCardEffect.SetUpSkillInfos(skillInfos);
|
|
|
- selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
|
|
|
-
|
|
|
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
|
|
|
-
|
|
|
- IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
|
|
|
+ if (candidateEffects.Count == 1)
|
|
|
{
|
|
|
- if (selectedIndexes.Count == 1)
|
|
|
+ selectedEffect = candidateEffects[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ List<SkillInfo> skillInfos = candidateEffects
|
|
|
+ .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
|
|
|
+
|
|
|
+ List<CardSource> cardSources = candidateEffects
|
|
|
+ .Map(cardEffect => cardEffect.EffectSourceCard);
|
|
|
+
|
|
|
+ SelectCardEffect selectSourceCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
+
|
|
|
+ selectSourceCardEffect.SetUp(
|
|
|
+ canTargetCondition: (cardSource) => true,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ canNoSelect: () => false,
|
|
|
+ selectCardCoroutine: null,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ message: "Select 1 effect to activate.",
|
|
|
+ maxCount: 1,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: false,
|
|
|
+ mode: SelectCardEffect.Mode.Custom,
|
|
|
+ root: SelectCardEffect.Root.Custom,
|
|
|
+ customRootCardList: cardSources,
|
|
|
+ canLookReverseCard: true,
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectSourceCardEffect.SetNotShowCard();
|
|
|
+ selectSourceCardEffect.SetUpSkillInfos(skillInfos);
|
|
|
+ selectSourceCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectSourceCardEffect.Activate());
|
|
|
+
|
|
|
+ IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
|
|
|
{
|
|
|
- selectedEffect = candidateEffects[selectedIndexes[0]];
|
|
|
- yield return null;
|
|
|
+ if (selectedIndexes.Count == 1)
|
|
|
+ {
|
|
|
+ selectedEffect = candidateEffects[selectedIndexes[0]];
|
|
|
+ yield return null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (selectedEffect != null)
|
|
|
- {
|
|
|
- Hashtable effectHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(card);
|
|
|
|
|
|
- if (selectedEffect.CanUse(effectHashtable))
|
|
|
+ if (selectedEffect != null)
|
|
|
{
|
|
|
- yield return ContinuousController.instance.StartCoroutine(
|
|
|
- ((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(effectHashtable));
|
|
|
+ Hashtable effectHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(card);
|
|
|
+
|
|
|
+ if (selectedEffect.CanUse(effectHashtable))
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ ((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(effectHashtable));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- int trashCount = 2 * card.PermanentOfThisCard().cardSources.Count;
|
|
|
+ int trashCount = 2 * card.PermanentOfThisCard().cardSources.Filter(cardSource => cardSource != card && cardSource.HasLevel && cardSource.Level == 6).Count;
|
|
|
|
|
|
yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(trashCount, card.Owner.Enemy, activateClass).AddTrashCardsFromLibraryTop());
|
|
|
}
|