Commit f4cbb511 authored by mercury233's avatar mercury233 Committed by GitHub

remove Executor.SetMain and SetBattle (#213)

* remove Executor.SetMain and SetBattle

can use Duel.MainPhase directly

* init default MainPhase for duel to fix calling to this before the first Main Phase
parent 813239c5
...@@ -153,7 +153,7 @@ namespace WindBot.Game.AI.Decks ...@@ -153,7 +153,7 @@ namespace WindBot.Game.AI.Decks
{ {
// We should summon Horus the Black Flame Dragon LV6 if he can lvlup. // We should summon Horus the Black Flame Dragon LV6 if he can lvlup.
if (Enemy.GetMonsterCount() != 0 && !Util.IsAllEnemyBetterThanValue(2300 - 1, false)) if (Enemy.GetMonsterCount() != 0 && !Util.IsAllEnemyBetterThanValue(2300 - 1, false))
foreach (ClientCard card in Main.SummonableCards) foreach (ClientCard card in Duel.MainPhase.SummonableCards)
if (card.IsCode(11224103)) if (card.IsCode(11224103))
return false; return false;
......
...@@ -69,10 +69,10 @@ namespace WindBot.Game.AI.Decks ...@@ -69,10 +69,10 @@ namespace WindBot.Game.AI.Decks
if (_lastDoubleSummon == Duel.Turn) if (_lastDoubleSummon == Duel.Turn)
return false; return false;
if (Main.SummonableCards.Count == 0) if (Duel.MainPhase.SummonableCards.Count == 0)
return false; return false;
if (Main.SummonableCards.Count == 1 && Main.SummonableCards[0].Level < 5) if (Duel.MainPhase.SummonableCards.Count == 1 && Duel.MainPhase.SummonableCards[0].Level < 5)
{ {
bool canTribute = false; bool canTribute = false;
foreach (ClientCard handCard in Bot.Hand) foreach (ClientCard handCard in Bot.Hand)
......
...@@ -16,9 +16,6 @@ namespace WindBot.Game.AI ...@@ -16,9 +16,6 @@ namespace WindBot.Game.AI
public GameAI AI { get; private set; } public GameAI AI { get; private set; }
public AIUtil Util { get; private set; } public AIUtil Util { get; private set; }
protected MainPhase Main { get; private set; }
protected BattlePhase Battle { get; private set; }
protected ExecutorType Type { get; private set; } protected ExecutorType Type { get; private set; }
protected ClientCard Card { get; private set; } protected ClientCard Card { get; private set; }
protected int ActivateDescription { get; private set; } protected int ActivateDescription { get; private set; }
...@@ -247,16 +244,6 @@ namespace WindBot.Game.AI ...@@ -247,16 +244,6 @@ namespace WindBot.Game.AI
return; return;
} }
public void SetMain(MainPhase main)
{
Main = main;
}
public void SetBattle(BattlePhase battle)
{
Battle = battle;
}
/// <summary> /// <summary>
/// Set global variables Type, Card, ActivateDescription for Executor /// Set global variables Type, Card, ActivateDescription for Executor
/// </summary> /// </summary>
......
...@@ -47,6 +47,8 @@ namespace WindBot.Game ...@@ -47,6 +47,8 @@ namespace WindBot.Game
LastSummonedCards = new List<ClientCard>(); LastSummonedCards = new List<ClientCard>();
SolvingChainIndex = 0; SolvingChainIndex = 0;
NegatedChainIndexList = new List<int>(); NegatedChainIndexList = new List<int>();
MainPhase = new MainPhase();
BattlePhase = new BattlePhase();
} }
public ClientCard GetCard(int player, CardLocation loc, int seq) public ClientCard GetCard(int player, CardLocation loc, int seq)
......
...@@ -202,7 +202,6 @@ namespace WindBot.Game ...@@ -202,7 +202,6 @@ namespace WindBot.Game
/// <returns>A new BattlePhaseAction containing the action to do.</returns> /// <returns>A new BattlePhaseAction containing the action to do.</returns>
public BattlePhaseAction OnSelectBattleCmd(BattlePhase battle) public BattlePhaseAction OnSelectBattleCmd(BattlePhase battle)
{ {
Executor.SetBattle(battle);
foreach (CardExecutor exec in Executor.Executors) foreach (CardExecutor exec in Executor.Executors)
{ {
if (exec.Type == ExecutorType.GoToMainPhase2 && battle.CanMainPhaseTwo && exec.Func()) // check if should enter main phase 2 directly if (exec.Type == ExecutorType.GoToMainPhase2 && battle.CanMainPhaseTwo && exec.Func()) // check if should enter main phase 2 directly
...@@ -449,7 +448,6 @@ namespace WindBot.Game ...@@ -449,7 +448,6 @@ namespace WindBot.Game
/// <returns>A new MainPhaseAction containing the action to do.</returns> /// <returns>A new MainPhaseAction containing the action to do.</returns>
public MainPhaseAction OnSelectIdleCmd(MainPhase main) public MainPhaseAction OnSelectIdleCmd(MainPhase main)
{ {
Executor.SetMain(main);
CheckSurrender(); CheckSurrender();
foreach (CardExecutor exec in Executor.Executors) foreach (CardExecutor exec in Executor.Executors)
{ {
......
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