Commit 975e8b54 authored by xiaoye's avatar xiaoye

帮神数不神代提交的修复内容

parent 345b2be1
Pipeline #29829 failed with stage
in 31 seconds
This diff is collapsed.
......@@ -2,6 +2,8 @@
using System.Collections.Generic;
using WindBot.Game.AI;
using YGOSharp.OCGWrapper.Enums;
using System;
using System.Threading;
namespace WindBot.Game
{
......@@ -233,10 +235,10 @@ namespace WindBot.Game
if (result != null)
return result;
if (attackers.Count == 0)
if (attackers.Count == 0) //如果自己场上没有可以攻击的怪兽直接返回
return ToMainPhase2();
if (defenders.Count == 0)
if (defenders.Count == 0) //如果对方场上没有怪兽则直接攻击
{
// Attack with the monster with the lowest attack first
ClientCard attacker = attackers[attackers.Count - 1];
......@@ -244,17 +246,17 @@ namespace WindBot.Game
}
else
{
for (int k = 0; k < attackers.Count; ++k)
for (int k = 0; k < attackers.Count; ++k) //如果对方场上有怪兽
{
ClientCard attacker = attackers[k];
attacker.IsLastAttacker = (k == attackers.Count - 1);
result = Executor.OnSelectAttackTarget(attacker, defenders);
result = Executor.OnSelectAttackTarget(attacker, defenders);//这个函数决定是否要攻击
if (result != null)
return result;
}
}
if (!battle.CanMainPhaseTwo)
if (!battle.CanMainPhaseTwo) //如果不能进战阶强制攻击
return Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]);
return ToMainPhase2();
......@@ -1162,6 +1164,7 @@ namespace WindBot.Game
private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1, int timing = -1)
{
Executor.SetCard(type, card, desc, timing);
if (card.Id != 0 && type == ExecutorType.Activate)
{
if (_activatedCards.ContainsKey(card.Id) && _activatedCards[card.Id] >= 9)
......@@ -1169,10 +1172,14 @@ namespace WindBot.Game
if (!Executor.OnPreActivate(card))
return false;
}
Executor.SetCard(type, card, desc, timing);
Func<bool> Func = () =>
{
if (Executor.FuncFilters.ContainsKey(exec.Type) && Executor.FuncFilters[exec.Type] != null
&& !Executor.FuncFilters[exec.Type]()) return false;
return exec.Func == null || exec.Func();
};
bool result = card != null && exec.Type == type &&
(exec.CardId == -1 || exec.CardId == card.Id) &&
(exec.Func == null || exec.Func());
(exec.CardId == -1 || exec.CardId == card.Id) && Func();
if (card.Id != 0 && type == ExecutorType.Activate && result)
{
int count = card.IsDisabled() ? 3 : 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment