|
|
@@ -19,6 +19,44 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
public bool IsEndAttack { get; set; } = false;
|
|
|
|
|
|
public bool UsedBlitz { get; set; } = false;
|
|
|
+ public Hashtable EffectHashtable { get; set; } = null;
|
|
|
+
|
|
|
+ public Hashtable CounterEffectHashtable { get; set; } = null;
|
|
|
+ public AttackState State { get; set; } = AttackState.None;
|
|
|
+ public enum AttackState
|
|
|
+ {
|
|
|
+ None,
|
|
|
+ Counter,
|
|
|
+ Block,
|
|
|
+ Battle,
|
|
|
+ End
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool ActiveAttack()
|
|
|
+ {
|
|
|
+ return State != null && State != AttackState.None;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IEnumerator ProcessNextState()
|
|
|
+ {
|
|
|
+ switch (State)
|
|
|
+ {
|
|
|
+ case AttackState.Counter:
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CounterTiming());
|
|
|
+ break;
|
|
|
+ case AttackState.Block:
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(BlockTiming());
|
|
|
+ break;
|
|
|
+ case AttackState.Battle:
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(DetermineAttackOutcome());
|
|
|
+ break;
|
|
|
+ case AttackState.End:
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(EndAttack());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
void SetAttackerDefender(Permanent attackingPermanent, Permanent defendingPermanent)
|
|
|
{
|
|
|
@@ -50,11 +88,12 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
IsAttacking = false;
|
|
|
HasDefender = false;
|
|
|
IsEndAttack = false;
|
|
|
+ CounterEffectHashtable = null;
|
|
|
|
|
|
SetAttackerDefender(attackingPermanent, defendingPermanent);
|
|
|
|
|
|
- Hashtable effectHashtable = CardEffectCommons.OnAttackCheckHashtableOfPermanent(AttackingPermanent, attackEffect);
|
|
|
- Hashtable counterEffectHashtable = CardEffectCommons.OnAttackCheckHashtableOfPermanent(new Permanent(AttackingPermanent.cardSources), attackEffect);
|
|
|
+ EffectHashtable = CardEffectCommons.OnAttackCheckHashtableOfPermanent(AttackingPermanent, attackEffect);
|
|
|
+ CounterEffectHashtable = CardEffectCommons.OnAttackCheckHashtableOfPermanent(new Permanent(AttackingPermanent.cardSources), attackEffect);
|
|
|
|
|
|
IsAttacking = true;
|
|
|
|
|
|
@@ -66,7 +105,9 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
// force to end attack
|
|
|
if (IsEndAttack)
|
|
|
{
|
|
|
- goto EndAttack;
|
|
|
+ State = AttackState.End;
|
|
|
+
|
|
|
+ yield break;
|
|
|
}
|
|
|
|
|
|
#region Attack Process
|
|
|
@@ -103,17 +144,17 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
if (DefendingPermanent != null)
|
|
|
{
|
|
|
if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
|
|
|
- log += $"\n�«\n{DefendingPermanent.TopCard.BaseENGCardNameFromEntity}({DefendingPermanent.TopCard.CardID})\n";
|
|
|
+ log += $"\n�«\n{DefendingPermanent.TopCard.BaseENGCardNameFromEntity}({DefendingPermanent.TopCard.CardID})\n";
|
|
|
}
|
|
|
|
|
|
else
|
|
|
{
|
|
|
- log += $"\n�«\nSecurity\n";
|
|
|
+ log += $"\n�«\nSecurity\n";
|
|
|
}
|
|
|
|
|
|
PlayLog.OnAddLog?.Invoke(log);
|
|
|
|
|
|
- List<SkillInfo> stackedSkillInfos = new List<SkillInfo>();
|
|
|
+ /*List<SkillInfo> stackedSkillInfos = new List<SkillInfo>();
|
|
|
|
|
|
if (GManager.instance.autoProcessing.executingMultipleSkills != null)
|
|
|
{
|
|
|
@@ -129,7 +170,7 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
{
|
|
|
GManager.instance.autoProcessing.executingMultipleSkills.StackedSkillInfos.Remove(skillInfo);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// suspend
|
|
|
if (!withoutTap)
|
|
|
@@ -165,8 +206,8 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
}
|
|
|
|
|
|
// activate cutin effects
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.RuleProcess());
|
|
|
- //yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, null));
|
|
|
+ // yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.RuleProcess());
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, null));
|
|
|
|
|
|
// callback that is processed before [On Attack]
|
|
|
if (beforeOnAttackCoroutine != null)
|
|
|
@@ -176,20 +217,20 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
|
|
|
// trigger [On Attack] effect
|
|
|
yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.StackSkillInfos(
|
|
|
- effectHashtable,
|
|
|
+ EffectHashtable,
|
|
|
EffectTiming.OnAllyAttack));
|
|
|
|
|
|
// activate cutin effects
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.RuleProcess());
|
|
|
+ // yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.RuleProcess());
|
|
|
yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, null));
|
|
|
|
|
|
- if (stackedSkillInfos.Count >= 1)
|
|
|
+ /*if (stackedSkillInfos.Count >= 1)
|
|
|
{
|
|
|
foreach (SkillInfo skillInfo in stackedSkillInfos)
|
|
|
{
|
|
|
GManager.instance.autoProcessing.PutStackedSkill(skillInfo);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
|
|
|
@@ -209,14 +250,16 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
}
|
|
|
|
|
|
// check timing
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.AutoProcessCheck());
|
|
|
+ // yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.AutoProcessCheck());
|
|
|
|
|
|
GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
|
|
|
// force to end attack
|
|
|
if (IsEndAttack)
|
|
|
{
|
|
|
- goto EndAttack;
|
|
|
+ State = AttackState.End;
|
|
|
+
|
|
|
+ yield break;
|
|
|
}
|
|
|
|
|
|
if (AttackingPermanent.TopCard != null)
|
|
|
@@ -233,235 +276,267 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
}
|
|
|
}
|
|
|
+ State = AttackState.Counter;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (beforeOnAttackCoroutine != null)
|
|
|
+ {
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(beforeOnAttackCoroutine());
|
|
|
+ }
|
|
|
+ State = AttackState.End;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
|
|
|
- // trigger effects when counter timing (except [Counter] effects)
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.StackSkillInfos(
|
|
|
- counterEffectHashtable,
|
|
|
- EffectTiming.OnCounterTiming,
|
|
|
- cardEffect => !cardEffect.IsCounterEffect));
|
|
|
-
|
|
|
- // activate cutin effects
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.RuleProcess());
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, null));
|
|
|
+ IEnumerator CounterTiming()
|
|
|
+ {
|
|
|
+ // force to end attack
|
|
|
+ if (IsEndAttack)
|
|
|
+ {
|
|
|
+ State = AttackState.End;
|
|
|
|
|
|
- GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // trigger effects when counter timing (except [Counter] effects)
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.StackSkillInfos(
|
|
|
+ CounterEffectHashtable,
|
|
|
+ EffectTiming.OnCounterTiming,
|
|
|
+ cardEffect => !cardEffect.IsCounterEffect));
|
|
|
|
|
|
- // force to end attack
|
|
|
- if (IsEndAttack)
|
|
|
- {
|
|
|
- goto EndAttack;
|
|
|
- }
|
|
|
+ // activate cutin effects
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, null));
|
|
|
|
|
|
- // trigger effects when counter timing ([Counter] effects)
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.StackSkillInfos(
|
|
|
- counterEffectHashtable,
|
|
|
- EffectTiming.OnCounterTiming,
|
|
|
- cardEffect => cardEffect.IsCounterEffect));
|
|
|
+ GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
|
|
|
- bool HasCounterEffect(List<SkillInfo> skillInfos, SkillInfo skillInfo)
|
|
|
- {
|
|
|
- return skillInfos.Count((skillInfo1) => skillInfo1.CardEffect.IsCounterEffect) >= 1;
|
|
|
- }
|
|
|
+ // force to end attack
|
|
|
+ if (IsEndAttack)
|
|
|
+ {
|
|
|
+ State = AttackState.End;
|
|
|
|
|
|
- // activate cutin effects
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.RuleProcess());
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, HasCounterEffect));
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
|
|
|
- GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
+ // trigger effects when counter timing ([Counter] effects)
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.StackSkillInfos(
|
|
|
+ CounterEffectHashtable,
|
|
|
+ EffectTiming.OnCounterTiming,
|
|
|
+ cardEffect => cardEffect.IsCounterEffect));
|
|
|
|
|
|
- // force to end attack
|
|
|
- if (IsEndAttack)
|
|
|
- {
|
|
|
- goto EndAttack;
|
|
|
- }
|
|
|
+ bool HasCounterEffect(List<SkillInfo> skillInfos, SkillInfo skillInfo)
|
|
|
+ {
|
|
|
+ return skillInfos.Count((skillInfo1) => skillInfo1.CardEffect.IsCounterEffect) >= 1;
|
|
|
+ }
|
|
|
|
|
|
- if (AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
|
|
|
- {
|
|
|
- goto EndAttack;
|
|
|
- }
|
|
|
+ // activate cutin effects
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, HasCounterEffect));
|
|
|
|
|
|
- AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
- AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
+ GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
|
|
|
- if (DefendingPermanent != null)
|
|
|
- {
|
|
|
- if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
|
|
|
- {
|
|
|
- DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
- DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
- }
|
|
|
- }
|
|
|
+ // force to end attack
|
|
|
+ if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
|
|
|
+ {
|
|
|
+ State = AttackState.End;
|
|
|
|
|
|
- #region select blocker
|
|
|
- bool CanSelectBlockerCondition(Permanent permanent)
|
|
|
- {
|
|
|
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, AttackingPermanent.TopCard))
|
|
|
- {
|
|
|
- if (permanent != DefendingPermanent)
|
|
|
- {
|
|
|
- if (permanent.HasBlocker && permanent.CanBlock(AttackingPermanent))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
|
|
|
- return false;
|
|
|
- }
|
|
|
+ AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
+ AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
|
|
|
- if (AttackingPermanent.TopCard.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectBlockerCondition) >= 1)
|
|
|
+ if (DefendingPermanent != null)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
|
|
|
{
|
|
|
- int maxCount = 1;
|
|
|
-
|
|
|
- Permanent selectedPermanent = null;
|
|
|
+ DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
+ DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ State = AttackState.Block;
|
|
|
+ }
|
|
|
|
|
|
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
+ IEnumerator BlockTiming()
|
|
|
+ {
|
|
|
+ // force to end attack
|
|
|
+ if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
|
|
|
+ {
|
|
|
+ State = AttackState.End;
|
|
|
|
|
|
- selectPermanentEffect.SetUp(
|
|
|
- selectPlayer: AttackingPermanent.TopCard.Owner.Enemy,
|
|
|
- canTargetCondition: CanSelectBlockerCondition,
|
|
|
- canTargetCondition_ByPreSelecetedList: null,
|
|
|
- canEndSelectCondition: null,
|
|
|
- maxCount: maxCount,
|
|
|
- canNoSelect: (!IsBlocking),
|
|
|
- canEndNotMax: false,
|
|
|
- selectPermanentCoroutine: SelectPermanentCoroutine,
|
|
|
- afterSelectPermanentCoroutine: null,
|
|
|
- mode: SelectPermanentEffect.Mode.Custom,
|
|
|
- cardEffect: null);
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
+
|
|
|
+ #region select blocker
|
|
|
+ bool CanSelectBlockerCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, AttackingPermanent.TopCard)
|
|
|
+ && permanent != DefendingPermanent
|
|
|
+ && permanent.HasBlocker
|
|
|
+ && permanent.CanBlock(AttackingPermanent);
|
|
|
+ }
|
|
|
|
|
|
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will block.", "The opponent is selecting 1 Digimon that will block.");
|
|
|
-
|
|
|
- if(!IsBlocking)
|
|
|
- selectPermanentEffect.SetUpCustomBackButtonMessage("Not Block");
|
|
|
+ if (AttackingPermanent.TopCard.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectBlockerCondition) >= 1)
|
|
|
+ {
|
|
|
+ int maxCount = 1;
|
|
|
|
|
|
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+ Permanent selectedPermanent = null;
|
|
|
|
|
|
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
- {
|
|
|
- selectedPermanent = permanent;
|
|
|
+ SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
|
|
|
- yield return null;
|
|
|
- }
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
+ selectPlayer: AttackingPermanent.TopCard.Owner.Enemy,
|
|
|
+ canTargetCondition: CanSelectBlockerCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: maxCount,
|
|
|
+ canNoSelect: (!IsBlocking),
|
|
|
+ canEndNotMax: false,
|
|
|
+ selectPermanentCoroutine: SelectPermanentCoroutine,
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
+ mode: SelectPermanentEffect.Mode.Custom,
|
|
|
+ cardEffect: null);
|
|
|
|
|
|
- if (selectedPermanent != null)
|
|
|
- {
|
|
|
- yield return ContinuousController.instance.StartCoroutine(SwitchDefender(null, true, selectedPermanent));
|
|
|
- }
|
|
|
- }
|
|
|
- #endregion
|
|
|
+ selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will block.", "The opponent is selecting 1 Digimon that will block.");
|
|
|
+
|
|
|
+ if(!IsBlocking)
|
|
|
+ selectPermanentEffect.SetUpCustomBackButtonMessage("Not Block");
|
|
|
|
|
|
- GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
|
|
|
- //end attack
|
|
|
- if (IsEndAttack)
|
|
|
+ IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
{
|
|
|
- goto EndAttack;
|
|
|
+ selectedPermanent = permanent;
|
|
|
+
|
|
|
+ yield return null;
|
|
|
}
|
|
|
|
|
|
- if (AttackingPermanent.TopCard == null)
|
|
|
+ if (selectedPermanent != null)
|
|
|
{
|
|
|
- goto EndAttack;
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(SwitchDefender(null, true, selectedPermanent));
|
|
|
}
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
- AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
- AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
+ GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
|
|
|
- if (DefendingPermanent != null)
|
|
|
+ //end attack
|
|
|
+ if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
|
|
|
+ {
|
|
|
+ State = AttackState.End;
|
|
|
+
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
+
|
|
|
+ AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
+ AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
+
|
|
|
+ if (DefendingPermanent != null)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
|
|
|
{
|
|
|
- if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
|
|
|
- {
|
|
|
- DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
- DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
- }
|
|
|
+ DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
+ DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
}
|
|
|
+ }
|
|
|
+ State = AttackState.Battle;
|
|
|
+ }
|
|
|
|
|
|
- #region there is no Defending Permanent
|
|
|
- if (DefendingPermanent == null)
|
|
|
- {
|
|
|
- if (AttackingPermanent.Strike >= 1)
|
|
|
- {
|
|
|
- //if there is no security, end the game
|
|
|
- if (AttackingPermanent.TopCard.Owner.Enemy.SecurityCards.Count == 0)
|
|
|
- {
|
|
|
- GManager.instance.turnStateMachine.EndGame(AttackingPermanent.TopCard.Owner, false);
|
|
|
- yield break;
|
|
|
- }
|
|
|
- }
|
|
|
+ IEnumerator DetermineAttackOutcome()
|
|
|
+ {
|
|
|
+ //end attack
|
|
|
+ if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
|
|
|
+ {
|
|
|
+ State = AttackState.End;
|
|
|
|
|
|
- DoSecurityCheck = true;
|
|
|
- }
|
|
|
- #endregion
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
|
|
|
- #region there is Defending Permanent
|
|
|
- else
|
|
|
+ #region there is no Defending Permanent
|
|
|
+ if (DefendingPermanent == null)
|
|
|
+ {
|
|
|
+ if (AttackingPermanent.Strike >= 1)
|
|
|
{
|
|
|
- if (!CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent) || !CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(AttackingPermanent))
|
|
|
+ //if there is no security, end the game
|
|
|
+ if (AttackingPermanent.TopCard.Owner.Enemy.SecurityCards.Count == 0)
|
|
|
{
|
|
|
- goto EndAttack;
|
|
|
+ GManager.instance.turnStateMachine.EndGame(AttackingPermanent.TopCard.Owner, false);
|
|
|
+ yield break;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- DefendingPermanent.TopCard.Owner.securityObject.securityBreakGlass.gameObject.SetActive(false);
|
|
|
+ DoSecurityCheck = true;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
- DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
- DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
+ #region there is Defending Permanent
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (!CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent) || !CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(AttackingPermanent))
|
|
|
+ {
|
|
|
+ State = AttackState.End;
|
|
|
|
|
|
- // battle
|
|
|
- IBattle battle = new IBattle(AttackingPermanent: AttackingPermanent, DefendingPermanent: DefendingPermanent, null);
|
|
|
- yield return ContinuousController.instance.StartCoroutine(battle.Battle());
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
|
|
|
- /*#region effect when determine whether to do security check
|
|
|
- Hashtable hashtable = new Hashtable()
|
|
|
- {
|
|
|
- {"battle", battle}
|
|
|
- };
|
|
|
+ DefendingPermanent.TopCard.Owner.securityObject.securityBreakGlass.gameObject.SetActive(false);
|
|
|
|
|
|
- List<SkillInfo> skillInfos_Pierce = AutoProcessing.GetSkillInfos(hashtable, EffectTiming.OnDetermineDoSecurityCheck)
|
|
|
- .Filter(skillInfo => skillInfo.CardEffect != null && skillInfo.CardEffect.CanActivate(skillInfo.Hashtable));
|
|
|
+ DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
|
|
|
+ DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
|
|
|
|
|
|
- if (skillInfos_Pierce.Count >= 1)
|
|
|
- {
|
|
|
- GManager.instance.autoProcessing.PutStackedSkill(skillInfos_Pierce[0]);
|
|
|
- }
|
|
|
- #endregion*/
|
|
|
-
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.TriggeredSkillProcess(true, null));
|
|
|
- GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
- }
|
|
|
- #endregion
|
|
|
+ // battle
|
|
|
+ IBattle battle = new IBattle(AttackingPermanent: AttackingPermanent, DefendingPermanent: DefendingPermanent, null);
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(battle.Battle());
|
|
|
|
|
|
- if (AttackingPermanent.TopCard == null)
|
|
|
+ //TODO: Reimplement the below to ensure full correctness of battle by effect.
|
|
|
+ //Will need bool AttackProcess.WasDigimonDestroyedInBattle and change to piercing to check it
|
|
|
+ /*#region effect when determine whether to do security check
|
|
|
+ Hashtable hashtable = new Hashtable()
|
|
|
{
|
|
|
- goto EndAttack;
|
|
|
- }
|
|
|
+ {"battle", battle}
|
|
|
+ };
|
|
|
+
|
|
|
+ List<SkillInfo> skillInfos_Pierce = AutoProcessing.GetSkillInfos(hashtable, EffectTiming.OnDetermineDoSecurityCheck)
|
|
|
+ .Filter(skillInfo => skillInfo.CardEffect != null && skillInfo.CardEffect.CanActivate(skillInfo.Hashtable));
|
|
|
|
|
|
- #region do security check
|
|
|
- if (DoSecurityCheck && AttackingPermanent.TopCard.Owner.Enemy.SecurityCards.Count >= 1)
|
|
|
+ if (skillInfos_Pierce.Count >= 1)
|
|
|
{
|
|
|
- //security check process
|
|
|
- yield return ContinuousController.instance.StartCoroutine(new ISecurityCheck(
|
|
|
- AttackingPermanent: AttackingPermanent,
|
|
|
- player: GManager.instance.turnStateMachine.gameContext.NonTurnPlayer).SecurityCheck());
|
|
|
+ GManager.instance.autoProcessing.PutStackedSkill(skillInfos_Pierce[0]);
|
|
|
}
|
|
|
- #endregion
|
|
|
+ #endregion*/
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.TriggeredSkillProcess(true, null));
|
|
|
+ GManager.instance.turnStateMachine.IsSelecting = true;
|
|
|
}
|
|
|
+ #endregion
|
|
|
|
|
|
- else
|
|
|
+ if (AttackingPermanent.TopCard == null)
|
|
|
{
|
|
|
- if (beforeOnAttackCoroutine != null)
|
|
|
- {
|
|
|
- yield return ContinuousController.instance.StartCoroutine(beforeOnAttackCoroutine());
|
|
|
- }
|
|
|
+ State = AttackState.End;
|
|
|
+
|
|
|
+ yield break;
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
- #region End Attack
|
|
|
- EndAttack:;
|
|
|
+ #region do security check
|
|
|
+ if (DoSecurityCheck && AttackingPermanent.TopCard.Owner.Enemy.SecurityCards.Count >= 1)
|
|
|
+ {
|
|
|
+ //security check process
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new ISecurityCheck(
|
|
|
+ AttackingPermanent: AttackingPermanent,
|
|
|
+ player: GManager.instance.turnStateMachine.gameContext.NonTurnPlayer).SecurityCheck());
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ State = AttackState.End;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+ #region End Attack
|
|
|
+ IEnumerator EndAttack()
|
|
|
+ {
|
|
|
// [On End Attack] effect
|
|
|
if (AttackingPermanent != null && AttackingPermanent.TopCard != null)
|
|
|
{
|
|
|
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(effectHashtable, EffectTiming.OnEndAttack));
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(EffectHashtable, EffectTiming.OnEndAttack));
|
|
|
}
|
|
|
|
|
|
// activate cutin effects
|
|
|
@@ -485,6 +560,8 @@ public class AttackProcess : MonoBehaviourPunCallbacks
|
|
|
SecurityDigimon = null;
|
|
|
IsAttacking = false;
|
|
|
IsEndAttack = false;
|
|
|
+ CounterEffectHashtable = null;
|
|
|
+ State = AttackState.None;
|
|
|
}
|
|
|
|
|
|
public IEnumerator SwitchDefender(ICardEffect cardEffect, bool isBlock, Permanent newDefendingPermanent)
|