Commit a16c0fbf authored by wind2009's avatar wind2009 Committed by GitHub

Update TrickstarExecutor.cs

Scapegoat won't be set when another was set.
Fix やぶ蛇(Maybe).
Trickstar Light Stage will choose card randomly (not from left to right).
Eater of Millions won't ss when no place can be use.
Trickstar Lycoris's special position.
parent 318cb4b2
......@@ -61,7 +61,7 @@ namespace WindBot.Game.AI.Decks
public int getLinkMarker(int id)
{
if (id == CardId.borrel || id == CardId.snake) return 4;
else if (id == CardId.Abyss || id == CardId.Beelze || id == CardId.Exterio || id == CardId.Ultimate) return 5;
else if (id == CardId.Abyss || id == CardId.Beelze || id == CardId.Exterio || id == CardId.Ultimate || id == CardId.Cardian) return 5;
else if (id == CardId.unicorn) return 3;
else if (id == CardId.Crystal || id == CardId.phoneix || id == CardId.SafeDra || id == CardId.Missus) return 2;
return 1;
......@@ -114,6 +114,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, CardId.snake, Snake_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Crystal, Crystal_ss);
AddExecutor(ExecutorType.SpSummon, CardId.SafeDra, Safedragon_ss);
AddExecutor(ExecutorType.Activate, CardId.SafeDra, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.Linkuri, Linkuri_eff);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuri, Linkuri_ss);
AddExecutor(ExecutorType.SpSummon, CardId.unicorn, Unicorn_ss);
......@@ -123,7 +124,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Beelze);
AddExecutor(ExecutorType.Activate, CardId.Missus, Missus_eff);
AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff);
AddExecutor(ExecutorType.Activate, CardId.SafeDra, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.phoneix, Phoneix_eff);
AddExecutor(ExecutorType.Activate, CardId.unicorn, Unicorn_eff);
AddExecutor(ExecutorType.Activate, CardId.snake, Snake_eff);
......@@ -157,7 +157,13 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Repos, MonsterRepos);
AddExecutor(ExecutorType.SummonOrSet, CardId.Red);
AddExecutor(ExecutorType.SummonOrSet, CardId.Pink);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.SpellSet, SpellSet);
}
public bool SpellSet()
{
if (Card.Id == CardId.Sheep && Bot.HasInSpellZone(CardId.Sheep)) return false;
return DefaultSpellSet();
}
public bool Has_down_arrow(int id)
......@@ -212,19 +218,50 @@ namespace WindBot.Game.AI.Decks
public bool Grass_ss()
{
if (Bot.ExtraDeck.Count > 0)
// judge whether can ss from exdeck
bool judge = (Bot.ExtraDeck.Count > 0);
if (Enemy.GetMonstersExtraZoneCount() > 1) judge = false; // exlink
if (Bot.GetMonstersExtraZoneCount() >= 1)
{
foreach(ClientCard card in Bot.GetMonstersInExtraZone())
{
if (getLinkMarker(card.Id) == 5) judge = false;
}
}
// can ss from exdeck
if (judge)
{
bool fornextss = AI.Utils.ChainContainsCard(CardId.Grass);
IList<ClientCard> ex = Bot.ExtraDeck;
ClientCard ex_best = null;
foreach (ClientCard ex_card in ex)
{
if (ex_best == null || ex_card.Attack > ex_best.Attack) ex_best = ex_card;
if (!fornextss) {
if (ex_best == null || ex_card.Attack > ex_best.Attack) ex_best = ex_card;
} else
{
if (getLinkMarker(ex_card.Id) != 5 && (ex_best == null || ex_card.Attack > ex_best.Attack)) ex_best = ex_card;
}
}
if (ex_best != null) {
AI.SelectCard(ex_best);
return true;
}
}
// cannot ss from exdeck
if (Bot.GetRemainingCount(CardId.Ghost,2) > 0)
{
AI.SelectCard(CardId.Ghost);
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
AI.SelectCard(new[]
{
CardId.White,
CardId.Red,
CardId.Yellow,
CardId.Pink
});
return true;
}
......@@ -264,10 +301,23 @@ namespace WindBot.Game.AI.Decks
return false;
}
public void RandomSort(List<ClientCard> list) {
int n = list.Count;
while(n-- > 1)
{
int index = Program.Rand.Next(n + 1);
ClientCard temp = list[index];
list[index] = list[n];
list[n] = temp;
}
}
public bool Stage_Lock()
{
if (Card.Location != CardLocation.SpellZone) return false;
List<ClientCard> spells = Enemy.GetSpells();
RandomSort(spells);
if (spells.Count == 0) return false;
foreach (ClientCard card in spells)
{
......@@ -545,6 +595,7 @@ namespace WindBot.Game.AI.Decks
public bool Eater_ss()
{
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (Bot.GetMonstersInMainZone().Count >= 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> targets = new List<ClientCard>();
......@@ -584,6 +635,32 @@ namespace WindBot.Game.AI.Decks
return true;
}
public void Red_SelectPos(ClientCard return_card = null)
{
int self_power = (Bot.HasInHand(CardId.White) && !white_eff_used) ? 3200 : 1600;
if (Duel.Player == 0)
{
List<ClientCard> monster_list = Bot.GetMonsters();
monster_list.Sort(AIFunctions.CompareCardAttack);
monster_list.Reverse();
ClientCard self_best = null;
foreach(ClientCard card in monster_list)
{
if (IsTrickstar(card.Id) && card != return_card && card.HasPosition(CardPosition.Attack))
{
self_best = card;
break;
}
}
if (self_best != null) self_power = (Bot.HasInHand(CardId.White)) ? (self_best.Attack + self_best.RealPower) : self_best.Attack;
}
ClientCard bestenemy = AI.Utils.GetOneEnemyBetterThanValue(self_power, true);
if (bestenemy != null) AI.SelectPosition(CardPosition.FaceUpDefence);
else AI.SelectPosition(CardPosition.FaceUpAttack);
return;
}
public bool Red_ss()
{
if (red_ss_count >= 6) return false;
......@@ -596,6 +673,7 @@ namespace WindBot.Game.AI.Decks
{
red_ss_count += 1;
AI.SelectCard(m);
Red_SelectPos();
return true;
}
}
......@@ -615,6 +693,7 @@ namespace WindBot.Game.AI.Decks
if (c.Attacked)
{
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
......@@ -625,12 +704,14 @@ namespace WindBot.Game.AI.Decks
{
if (tosolve_enemy.Attack > 3200) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
if (!Bot.HasInHand(CardId.White) && tosolve_enemy.Attack <= 3200 && c.Id == CardId.White)
{
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
......@@ -647,6 +728,7 @@ namespace WindBot.Game.AI.Decks
}
if (tosolve_enemy.Attack > 1600) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
......@@ -658,18 +740,20 @@ namespace WindBot.Game.AI.Decks
{
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{
if (!Bot.HasInHand(CardId.White) && AI.Utils.IsOneEnemyBetterThanValue(1600, true))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
}
else if (Bot.HasInHand(CardId.White) && AI.Utils.IsOneEnemyBetterThanValue(3200, true))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
}
if (AI.Utils.GetOneEnemyBetterThanMyBest() != null)
{
red_ss_count += 1;
return true;
List<ClientCard> self_monster = Bot.GetMonsters();
self_monster.Sort(AIFunctions.CompareDefensePower);
foreach(ClientCard card in self_monster)
{
if (IsTrickstar(card.Id) && card.Id != CardId.Red)
{
AI.SelectCard(card);
Red_SelectPos(card);
red_ss_count += 1;
return true;
}
}
}
}
}
......@@ -1570,7 +1654,7 @@ namespace WindBot.Game.AI.Decks
public bool MonsterRepos()
{
if (Card.Id == CardId.Eater && Card.IsAttack()) return false;
if (Card.Id == CardId.Eater && Card.HasPosition(CardPosition.Attack)) return false;
if (IsTrickstar(Card.Id) && !white_eff_used && Bot.HasInHand(CardId.White) && Card.IsAttack() && Duel.Phase == DuelPhase.Main1) return false;
......
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