Commit a859dd54 authored by wind2009's avatar wind2009

Add OnHintZone

parent b9f20076
...@@ -255,6 +255,8 @@ namespace WindBot.Game.AI ...@@ -255,6 +255,8 @@ namespace WindBot.Game.AI
protected int lightningStormOption = -1; protected int lightningStormOption = -1;
Dictionary<int, int> calledbytheGraveIdCountMap = new Dictionary<int, int>(); Dictionary<int, int> calledbytheGraveIdCountMap = new Dictionary<int, int>();
List<int> crossoutDesignatorIdList = new List<int>(); List<int> crossoutDesignatorIdList = new List<int>();
/// <summary>Columns 0-4 on Bot's field negated by Infinite Impermanence (enemy's col converted to ours: 4-col). Cleared at turn start.</summary>
protected List<int> infiniteImpermanenceNegatedColumns = new List<int>();
/// <summary> /// <summary>
/// Defined: /// Defined:
...@@ -590,6 +592,30 @@ namespace WindBot.Game.AI ...@@ -590,6 +592,30 @@ namespace WindBot.Game.AI
field.HintDescriptions.Remove(description); field.HintDescriptions.Remove(description);
} }
public override void OnHintZone(int player, int zone)
{
base.OnHintZone(player, zone);
ChainInfo currentChainInfo = Duel.GetCurrentSolvingChainInfo();
if (currentChainInfo != null) {
if (currentChainInfo.IsCode(_CardId.InfiniteImpermanence)) {
// Zone bit mapping: 0x100=col0, 0x200=col1, 0x400=col2, 0x800=col3, 0x1000=col4.
for (int i = 0; i <= 4; i++)
{
if ((zone & (0x100 << i)) == 0)
continue;
if (currentChainInfo.ActivatePlayer == 0)
{
infiniteImpermanenceNegatedColumns.Add(i);
}
else
{
infiniteImpermanenceNegatedColumns.Add(4 - i);
}
}
}
}
}
public override void OnReceivingAnnouce(int player, int data) public override void OnReceivingAnnouce(int player, int data)
{ {
if (player == 1 && data == Util.GetStringId(_CardId.LightningStorm, 0) || data == Util.GetStringId(_CardId.LightningStorm, 1)) if (player == 1 && data == Util.GetStringId(_CardId.LightningStorm, 0) || data == Util.GetStringId(_CardId.LightningStorm, 1))
...@@ -611,6 +637,7 @@ namespace WindBot.Game.AI ...@@ -611,6 +637,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
public override void OnNewTurn() public override void OnNewTurn()
{ {
infiniteImpermanenceNegatedColumns.Clear();
if (Duel.Turn <= 1) calledbytheGraveIdCountMap.Clear(); if (Duel.Turn <= 1) calledbytheGraveIdCountMap.Clear();
List<int> keyList = calledbytheGraveIdCountMap.Keys.ToList(); List<int> keyList = calledbytheGraveIdCountMap.Keys.ToList();
foreach (int dic in keyList) foreach (int dic in keyList)
......
...@@ -132,6 +132,16 @@ namespace WindBot.Game.AI ...@@ -132,6 +132,16 @@ namespace WindBot.Game.AI
// For overriding // For overriding
} }
/// <summary>
/// Called when a zone hint is received.
/// </summary>
/// <param name="player">Player index.</param>
/// <param name="zone">Zone data (hinted zones, bit field).</param>
public virtual void OnHintZone(int player, int zone)
{
// For overriding
}
public virtual void OnMove(ClientCard card, int previousControler, int previousLocation, int currentControler, int currentLocation) public virtual void OnMove(ClientCard card, int previousControler, int previousLocation, int currentControler, int currentLocation)
{ {
// Some AI need do something on card's moving // Some AI need do something on card's moving
......
...@@ -196,6 +196,16 @@ namespace WindBot.Game ...@@ -196,6 +196,16 @@ namespace WindBot.Game
Executor.OnPlayerHint(player, hintType, description); Executor.OnPlayerHint(player, hintType, description);
} }
/// <summary>
/// Called when a zone hint is received.
/// </summary>
/// <param name="player">Player index.</param>
/// <param name="zone">Zone data (hinted zones, bit field).</param>
public void OnHintZone(int player, int zone)
{
Executor.OnHintZone(player, zone);
}
/// <summary> /// <summary>
/// Called when receiving annouce /// Called when receiving annouce
/// </summary> /// </summary>
......
...@@ -364,6 +364,11 @@ namespace WindBot.Game ...@@ -364,6 +364,11 @@ namespace WindBot.Game
{ {
_ai.OnReceivingAnnouce(player, data); _ai.OnReceivingAnnouce(player, data);
} }
if (type == 11) // HINT_ZONE
{
Logger.DebugWriteLine("HINT_ZONE received: player=" + player + ", zone=" + data);
_ai.OnHintZone(player, data);
}
} }
private void OnStart(BinaryReader packet) private void OnStart(BinaryReader packet)
......
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