Commit 7e8bc837 authored by Tang Xinwei's avatar Tang Xinwei

发牌姬第二期AI智力修复:盖谜题、时间魔术师、链接召唤过滤、宝箱怪逻辑

+ 检测宝箱怪是否要攻击
parent 8b859976
Pipeline #29862 failed with stages
in 45 seconds
This diff is collapsed.
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using WindBot.Game.AI;
using YGOSharp.OCGWrapper.Enums;
using System;
using System.Threading;
namespace WindBot.Game
{
......@@ -49,9 +50,6 @@ namespace WindBot.Game
public void OnDeckError(string card)
{
_dialogs.SendDeckSorry(card);
Thread.Sleep(1000);
_dialogs.SendSurrender();
Game.Connection.Close();
}
/// <summary>
......@@ -237,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];
......@@ -248,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();
......@@ -756,7 +754,7 @@ namespace WindBot.Game
sorted.Sort(CardContainer.CompareCardAttack);
IList<ClientCard> selected = new List<ClientCard>();
for (int i = 0; i < min && i < sorted.Count; ++i)
selected.Add(sorted[i]);
......@@ -1174,10 +1172,15 @@ namespace WindBot.Game
if (!Executor.OnPreActivate(card))
return false;
}
bool result = card != null && exec.Type == type &&
(exec.CardId == -1 || exec.CardId == card.Id) &&
(exec.Func == null || exec.Func());
if (card.Id != 0 && type == ExecutorType.Activate && result)
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) && Func();
if (card.Id != 0 && type == ExecutorType.Activate && result)
{
int count = card.IsDisabled() ? 3 : 1;
if (!_activatedCards.ContainsKey(card.Id))
......
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