Commit b7a1eb1c authored by IceYGO's avatar IceYGO

Initial commit, with two simple decks

parent f99e9e1c
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
#created by ...
#main
43096270
43096270
43096270
11091375
11091375
11091375
79473793
79473793
48229808
11224103
11224103
70095154
70095154
84914462
84914462
84914462
47013502
47013502
47013502
9666558
12580477
26412047
53129443
66788016
66788016
81385346
81385346
81439173
5318639
5318639
87025064
87025064
50913601
50913601
20638610
20638610
44095762
44095762
70342110
70342110
#extra
!side
#created by ...
#main
6631034
6631034
6631034
43096270
43096270
43096270
69247929
69247929
69247929
77542832
77542832
77542832
11091375
11091375
11091375
35052053
35052053
35052053
49881766
83104731
83104731
30190809
30190809
12580477
26412047
26412047
26412047
43422537
43422537
43422537
53129443
66788016
66788016
66788016
72302403
72302403
44095762
44095762
70342110
70342110
#extra
!side
using System.Collections.Generic;
namespace WindBot.Game.AI
{
public class AIFunctions
{
public Duel Duel { get; private set; }
public AIFunctions(Duel duel)
{
Duel = duel;
}
public static int CompareCardAttack(ClientCard cardA, ClientCard cardB)
{
if (cardA.Attack < cardB.Attack)
return -1;
if (cardA.Attack == cardB.Attack)
return 0;
return 1;
}
public static int CompareDefensePower(ClientCard cardA, ClientCard cardB)
{
if (cardA == null && cardB == null)
return 0;
if (cardA == null)
return -1;
if (cardB == null)
return 1;
int powerA = cardA.GetDefensePower();
int powerB = cardB.GetDefensePower();
if (powerA < powerB)
return -1;
if (powerA == powerB)
return 0;
return 1;
}
public bool IsEnnemyBetter(bool onlyatk, bool all)
{
if (Duel.Fields[1].GetMonsterCount() == 0)
return false;
List<ClientCard> monsters = Duel.Fields[0].GetMonsters();
monsters.Sort(CompareCardAttack);
int bestAtk = -1;
if (monsters.Count > 0)
bestAtk = monsters[monsters.Count - 1].Attack;
if (all)
return IsAllEnnemyBetterThanValue(bestAtk, onlyatk);
return IsOneEnnemyBetterThanValue(bestAtk, onlyatk);
}
public bool IsOneEnnemyBetterThanValue(int value, bool onlyatk)
{
int bestValue = -1;
bool nomonster = true;
for (int i = 0; i < 5; ++i)
{
ClientCard card = Duel.Fields[1].MonsterZone[i];
if (card == null) continue;
if (onlyatk && card.IsDefense()) continue;
nomonster = false;
int ennemyValue = card.GetDefensePower();
if (ennemyValue > bestValue)
bestValue = ennemyValue;
}
if (nomonster) return false;
return bestValue > value;
}
public bool IsAllEnnemyBetterThanValue(int value, bool onlyatk)
{
bool nomonster = true;
for (int i = 0; i < 5; ++i)
{
ClientCard card = Duel.Fields[1].MonsterZone[i];
if (card == null || card.Data == null) continue;
if (onlyatk && card.IsDefense()) continue;
nomonster = false;
int ennemyValue = card.GetDefensePower();
if (ennemyValue <= value)
return false;
}
return !nomonster;
}
}
}
\ No newline at end of file
using System.Collections.Generic;
using WindBot.Game.Enums;
namespace WindBot.Game.AI
{
public static class CardContainer
{
public static ClientCard GetHighestAttackMonster(this IEnumerable<ClientCard> cards)
{
int highestAtk = 0;
ClientCard selected = null;
foreach (ClientCard card in cards)
{
if (card == null || card.Data == null) continue;
if (card.HasType(CardType.Monster) && card.Attack > highestAtk)
{
highestAtk = card.Attack;
selected = card;
}
}
return selected;
}
public static ClientCard GetHighestDefenseMonster(this IEnumerable<ClientCard> cards)
{
int highestDef = 0;
ClientCard selected = null;
foreach (ClientCard card in cards)
{
if (card == null || card.Data == null) continue;
if (card.HasType(CardType.Monster) && card.Defense > highestDef)
{
highestDef = card.Defense;
selected = card;
}
}
return selected;
}
public static ClientCard GetLowestAttackMonster(this IEnumerable<ClientCard> cards)
{
int lowestAtk = 0;
ClientCard selected = null;
foreach (ClientCard card in cards)
{
if (card == null || card.Data == null) continue;
if (lowestAtk == 0 && card.HasType(CardType.Monster) ||
card.HasType(CardType.Monster) && card.Attack < lowestAtk)
{
lowestAtk = card.Attack;
selected = card;
}
}
return selected;
}
public static ClientCard GetLowestDefenseMonster(this IEnumerable<ClientCard> cards)
{
int lowestDef = 0;
ClientCard selected = null;
foreach (ClientCard card in cards)
{
if (card == null || card.Data == null) continue;
if (lowestDef == 0 && card.HasType(CardType.Monster) ||
card.HasType(CardType.Monster) && card.Defense < lowestDef)
{
lowestDef = card.Defense;
selected = card;
}
}
return selected;
}
public static bool ContainsMonsterWithLevel(this IEnumerable<ClientCard> cards, int level)
{
foreach (ClientCard card in cards)
{
if (card == null)
continue;
if (!card.HasType(CardType.Xyz) && card.Level == level)
return true;
}
return false;
}
public static bool ContainsMonsterWithRank(this IEnumerable<ClientCard> cards, int rank)
{
foreach (ClientCard card in cards)
{
if (card == null)
continue;
if (card.HasType(CardType.Xyz) && card.Rank == rank)
return true;
}
return false;
}
public static bool ContainsCardWithId(this IEnumerable<ClientCard> cards, int id)
{
foreach (ClientCard card in cards)
{
if (card == null)
continue;
if (card.Id == id)
return true;
}
return false;
}
public static int GetCardCount(this IEnumerable<ClientCard> cards, int id)
{
int count = 0;
foreach (ClientCard card in cards)
{
if (card == null)
continue;
if (card.Id == id)
count++;
}
return count;
}
public static IList<ClientCard> GetMonsters(this IEnumerable<ClientCard> cards)
{
IList<ClientCard> cardlist = new List<ClientCard>();
foreach (ClientCard card in cards)
{
if (card == null)
continue;
if (card.HasType(CardType.Monster))
cardlist.Add(card);
}
return cardlist;
}
public static ClientCard GetInvincibleMonster(this IEnumerable<ClientCard> cards)
{
foreach (ClientCard card in cards)
{
if (card != null && card.IsMonsterInvincible())
return card;
}
return null;
}
public static ClientCard GetNegateAttackSpell(this IEnumerable<ClientCard> cards)
{
foreach (ClientCard card in cards)
{
if (card != null && card.IsSpellNegateAttack())
return card;
}
return null;
}
}
}
\ No newline at end of file
using System;
namespace WindBot.Game.AI
{
public class CardExecutor
{
public int CardId { get; private set; }
public ExecutorType Type { get; private set; }
public Func<bool> Func { get; private set; }
public CardExecutor(ExecutorType type, int cardId, Func<bool> func)
{
CardId = cardId;
Type = type;
Func = func;
}
}
}
\ No newline at end of file
using System;
using WindBot.Game.AI.Enums;
namespace WindBot.Game.AI
{
public static class CardExtension
{
public static bool IsMonsterInvincible(this ClientCard card)
{
return Enum.IsDefined(typeof(InvincibleMonster), card.Id);
}
public static bool IsMonsterDangerous(this ClientCard card)
{
return Enum.IsDefined(typeof(DangerousMonster), card.Id);
}
public static bool IsSpellNegateAttack(this ClientCard card)
{
return Enum.IsDefined(typeof(NegateAttackSpell), card.Id);
}
}
}
\ No newline at end of file
using System.Collections.Generic;
using WindBot.Game.Enums;
namespace WindBot.Game.AI
{
public class CardSelector
{
private enum SelectType
{
Card,
Cards,
Id,
Ids,
Location
}
private SelectType _type;
private ClientCard _card;
private IList<ClientCard> _cards;
private int _id;
private IList<int> _ids;
private CardLocation _location;
public CardSelector(ClientCard card)
{
_type = SelectType.Card;
_card = card;
}
public CardSelector(IList<ClientCard> cards)
{
_type = SelectType.Cards;
_cards = cards;
}
public CardSelector(int cardId)
{
_type = SelectType.Id;
_id = cardId;
}
public CardSelector(IList<int> ids)
{
_type = SelectType.Ids;
_ids = ids;
}
public CardSelector(CardLocation location)
{
_type = SelectType.Location;
_location = location;
}
public IList<ClientCard> Select(IList<ClientCard> cards, int min, int max)
{
IList<ClientCard> result = new List<ClientCard>();
switch (_type)
{
case SelectType.Card:
if (cards.Contains(_card))
result.Add(_card);
break;
case SelectType.Cards:
foreach (ClientCard card in _cards)
if (cards.Contains(card))
result.Add(card);
break;
case SelectType.Id:
foreach (ClientCard card in cards)
if (card.Id == _id)
result.Add(card);
break;
case SelectType.Ids:
foreach (int id in _ids)
foreach (ClientCard card in cards)
if (card.Id == id)
result.Add(card);
break;
case SelectType.Location:
foreach (ClientCard card in cards)
if (card.Location == _location)
result.Add(card);
break;
}
if (result.Count < min)
{
foreach (ClientCard card in cards)
{
if (!result.Contains(card))
result.Add(card);
if (result.Count >= min)
break;
}
}
while (result.Count > max)
result.RemoveAt(result.Count - 1);
return result;
}
}
}
\ No newline at end of file
using System;
namespace WindBot.Game.AI
{
[AttributeUsage(AttributeTargets.Class)]
public class DeckAttribute : Attribute
{
public string Name { get; private set; }
public string File { get; private set; }
public DeckAttribute(string name, string file = null)
{
if (String.IsNullOrEmpty(file))
file = name;
Name = name;
File = file;
}
}
}
using System.Collections.Generic;
using WindBot.Game.Enums;
namespace WindBot.Game.AI.Decks
{
[Deck("Horus", "AI_Horus")]
public class HorusExecutor : DefaultExecutor
{
public enum CardId
{
AlexandriteDragon = 43096270,
LusterDragon = 11091375,
WhiteNightDragon = 79473793,
HorusTheBlackFlameDragonLv8 = 48229808,
HorusTheBlackFlameDragonLv6 = 11224103,
CyberDragon = 70095154,
AxeDragonute = 84914462,
DodgerDragon = 47013502,
GolemDragon = 9666558,
Raigeki = 12580477,
HammerShot = 26412047,
DarkHole = 53129443,
Fissure = 66788016,
StampingDestruction = 81385346,
FoolishBurial = 81439173,
MonsterReborn = 83764718,
MysticalSpaceTyphoon = 5318639,
BellowOfTheSilverDragon = 80600103,
Mountain = 50913601,
DragonsRebirth = 20638610,
MirrorForce = 44095762,
DimensionalPrison = 70342110
}
public HorusExecutor(GameAI ai, Duel duel) : base(ai, duel)
{
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.Activate, (int)CardId.HorusTheBlackFlameDragonLv6);
AddExecutor(ExecutorType.Activate, (int)CardId.StampingDestruction, DefaultStampingDestruction);
AddExecutor(ExecutorType.Activate, (int)CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, (int)CardId.FoolishBurial, FoolishBurial);
AddExecutor(ExecutorType.Activate, (int)CardId.Mountain, DefaultField);
AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
AddExecutor(ExecutorType.Activate, (int)CardId.HammerShot, DefaultHammerShot);
AddExecutor(ExecutorType.Activate, (int)CardId.Fissure);
AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragon);
AddExecutor(ExecutorType.Activate, (int)CardId.BellowOfTheSilverDragon, BellowOfTheSilverDragon);
AddExecutor(ExecutorType.Activate, (int)CardId.MonsterReborn, MonsterReborn);
AddExecutor(ExecutorType.Summon, (int)CardId.WhiteNightDragon, WhiteNightDragon);
AddExecutor(ExecutorType.Summon, (int)CardId.HorusTheBlackFlameDragonLv6, DefaultTributeSummon);
AddExecutor(ExecutorType.Summon, (int)CardId.AlexandriteDragon);
AddExecutor(ExecutorType.SummonOrSet, (int)CardId.AxeDragonute);
AddExecutor(ExecutorType.SummonOrSet, (int)CardId.DodgerDragon);
AddExecutor(ExecutorType.MonsterSet, (int)CardId.GolemDragon);
AddExecutor(ExecutorType.SummonOrSet, (int)CardId.LusterDragon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Activate, (int)CardId.HorusTheBlackFlameDragonLv8, HorusTheBlackFlameDragonLv8);
AddExecutor(ExecutorType.Activate, (int)CardId.MirrorForce, DefaultTrap);
AddExecutor(ExecutorType.Activate, (int)CardId.DimensionalPrison, DefaultTrap);
AddExecutor(ExecutorType.Activate, (int)CardId.DragonsRebirth, DragonsRebirth);
}
private bool FoolishBurial()
{
if (Duel.Fields[0].HasInGraveyard((int)CardId.WhiteNightDragon))
return false;
if (Duel.Fields[0].HasInHand((int)CardId.WhiteNightDragon))
return false;
int remaining = 2;
foreach (ClientCard card in Duel.Fields[0].Banished)
if (card.Id == (int)CardId.WhiteNightDragon)
remaining--;
if (remaining > 0)
{
AI.SelectCard((int)CardId.WhiteNightDragon);
return true;
}
return false;
}
private bool BellowOfTheSilverDragon()
{
if (Duel.Player == 0 && (Duel.Phase == Phase.Draw || Duel.Phase == Phase.Standby))
return false;
if (Duel.Player == 1 && Duel.Phase == Phase.End)
return false;
List<ClientCard> cards = new List<ClientCard>(Duel.Fields[0].Graveyard);
cards.Sort(AIFunctions.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard card = cards[i];
if (card.Attack < 1000)
return false;
if (card.IsMonster() && card.HasType(CardType.Normal))
{
AI.SelectCard(card);
return true;
}
}
return false;
}
private bool MonsterReborn()
{
List<ClientCard> cards = new List<ClientCard>(Duel.Fields[0].Graveyard);
cards.Sort(AIFunctions.CompareCardAttack);
ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard card = cards[i];
if (card.Attack < 1000)
break;
if (card.IsMonster())
{
selectedCard = card;
break;
}
}
cards = new List<ClientCard>(Duel.Fields[1].Graveyard);
cards.Sort(AIFunctions.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard card = cards[i];
if (card.Attack < 1000)
break;
if (card.IsMonster() && card.HasType(CardType.Normal) && (selectedCard == null || card.Attack > selectedCard.Attack))
{
selectedCard = card;
break;
}
}
if (selectedCard != null)
{
AI.SelectCard(selectedCard);
return true;
}
return false;
}
private bool WhiteNightDragon()
{
// We should summon Horus the Black Flame Dragon LV6 if he can lvlup.
if (Duel.Fields[1].GetMonsterCount() != 0 && !AI.Utils.IsAllEnnemyBetterThanValue(2300 - 1, false))
foreach (ClientCard card in Main.SummonableCards)
if (card.Id == 11224103)
return false;
return DefaultTributeSummon();
}
private bool HorusTheBlackFlameDragonLv8()
{
return LastChainPlayer == 1;
}
private bool DragonsRebirth()
{
List<ClientCard> cards = new List<ClientCard>(Duel.Fields[0].GetMonsters());
if (cards.Count == 0)
return false;
cards.Sort(AIFunctions.CompareCardAttack);
ClientCard tributeCard = null;
foreach (ClientCard monster in cards)
{
if (monster.Attack > 2000)
return false;
if (!monster.IsFacedown() && monster.Race == (int)CardRace.Dragon)
{
tributeCard = monster;
break;
}
}
if (tributeCard == null)
return false;
cards = new List<ClientCard>(Duel.Fields[0].Hand);
cards.AddRange(Duel.Fields[0].Graveyard);
if (cards.Count == 0)
return false;
cards.Sort(AIFunctions.CompareCardAttack);
ClientCard summonCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard monster = cards[i];
if (monster.Attack < 2300)
return false;
if (monster.Race == (int)CardRace.Dragon && monster.Id != (int)CardId.HorusTheBlackFlameDragonLv8)
{
summonCard = monster;
break;
}
}
if (summonCard == null)
return false;
AI.SelectCard(tributeCard);
AI.SelectNextCard(summonCard);
return true;
}
}
}
\ No newline at end of file
namespace WindBot.Game.AI.Decks
{
[Deck("OldSchool", "AI_OldSchool")]
public class OldSchoolExecutor : DefaultExecutor
{
public enum CardId
{
Raigeki = 12580477
}
public OldSchoolExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, 19613556, DefaultHeavyStorm);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.Activate, 53129443, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
AddExecutor(ExecutorType.Activate, 26412047, DefaultHammerShot);
AddExecutor(ExecutorType.Activate, 66788016);
AddExecutor(ExecutorType.Activate, 72302403, SwordsOfRevealingLight);
AddExecutor(ExecutorType.Activate, 43422537, DoubleSummon);
AddExecutor(ExecutorType.Summon, 83104731, DefaultTributeSummon);
AddExecutor(ExecutorType.Summon, 6631034, DefaultTributeSummon);
AddExecutor(ExecutorType.SummonOrSet, 43096270);
AddExecutor(ExecutorType.SummonOrSet, 69247929);
AddExecutor(ExecutorType.MonsterSet, 30190809);
AddExecutor(ExecutorType.SummonOrSet, 77542832);
AddExecutor(ExecutorType.SummonOrSet, 11091375);
AddExecutor(ExecutorType.SummonOrSet, 35052053);
AddExecutor(ExecutorType.SummonOrSet, 49881766);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Activate, 44095762, DefaultTrap);
AddExecutor(ExecutorType.Activate, 70342110, DefaultTrap);
}
private int _lastDoubleSummon;
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (defender.IsMonsterInvincible() && !defender.IsMonsterDangerous() && attacker.Id == 83104731)
return true;
return base.OnPreBattleBetween(attacker, defender);
}
private bool DoubleSummon()
{
if (_lastDoubleSummon == Duel.Turn)
return false;
if (Main.SummonableCards.Count == 0)
return false;
if (Main.SummonableCards.Count == 1 && Main.SummonableCards[0].Level < 5)
{
bool canTribute = false;
foreach (ClientCard handCard in Duel.Fields[0].Hand)
{
if (handCard.IsMonster() && handCard.Level > 4 && handCard.Level < 6)
canTribute = true;
}
if (!canTribute)
return false;
}
int monsters = 0;
foreach (ClientCard handCard in Duel.Fields[0].Hand)
{
if (handCard.IsMonster())
monsters++;
}
if (monsters <= 1)
return false;
_lastDoubleSummon = Duel.Turn;
return true;
}
private bool SwordsOfRevealingLight()
{
foreach (ClientCard handCard in Duel.Fields[1].GetMonsters())
{
if (handCard.IsFacedown())
return true;
}
return AI.Utils.IsEnnemyBetter(true, false);
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Reflection;
namespace WindBot.Game.AI
{
public static class DecksManager
{
private class DeckInstance
{
public string Deck { get; private set; }
public Type Type { get; private set; }
public DeckInstance(string deck, Type type)
{
Deck = deck;
Type = type;
}
}
private static Dictionary<string, DeckInstance> _decks;
private static List<DeckInstance> _list;
private static Random _rand;
public static void Init()
{
_decks = new Dictionary<string, DeckInstance>();
_rand = new Random();
Assembly asm = Assembly.GetExecutingAssembly();
Type[] types = asm.GetTypes();
foreach (Type type in types)
{
MemberInfo info = type;
object[] attributes = info.GetCustomAttributes(false);
foreach (object attribute in attributes)
{
if (attribute is DeckAttribute)
{
DeckAttribute deck = (DeckAttribute)attribute;
_decks.Add(deck.Name, new DeckInstance(deck.File, type));
}
}
}
_list = new List<DeckInstance>();
_list.AddRange(_decks.Values);
Logger.WriteLine("Decks initialized, " + _decks.Count + " found.");
}
public static Executor Instantiate(GameAI ai, Duel duel)
{
DeckInstance infos;
string deck = ai.Game.Deck;
if (deck != null && _decks.ContainsKey(deck))
infos = _decks[deck];
else
infos = _list[_rand.Next(_list.Count)];
Executor executor = (Executor)Activator.CreateInstance(infos.Type, ai, duel);
executor.Deck = infos.Deck;
return executor;
}
}
}
using System;
using System.Collections.Generic;
using WindBot.Game.Enums;
namespace WindBot.Game.AI
{
public abstract class DefaultExecutor : Executor
{
protected DefaultExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
}
private enum CardId
{
MysticalSpaceTyphoon = 5318639
}
protected bool DefaultMysticalSpaceTyphoon()
{
foreach (ClientCard card in CurrentChain)
if (card.Id == (int)CardId.MysticalSpaceTyphoon)
return false;
return DefaultStampingDestruction();
}
protected bool DefaultStampingDestruction()
{
List<ClientCard> spells = Duel.Fields[1].GetSpells();
if (spells.Count == 0)
return false;
ClientCard selected = null;
foreach (ClientCard card in spells)
{
if (card.IsSpellNegateAttack())
{
selected = card;
break;
}
}
if (selected == null)
{
foreach (ClientCard card in spells)
{
if (Duel.Player == 1 && !card.HasType(CardType.Continuous))
continue;
selected = card;
if (Duel.Player == 0 && card.IsFacedown())
break;
}
}
if (selected == null)
return false;
AI.SelectCard(selected);
return true;
}
protected bool DefaultBookOfMoon()
{
if (AI.Utils.IsEnnemyBetter(true, true))
{
ClientCard monster = Duel.Fields[1].GetMonsters().GetHighestAttackMonster();
if (monster != null && monster.HasType(CardType.Effect) && (monster.HasType(CardType.Xyz) || monster.Level > 4))
{
AI.SelectCard(monster);
return true;
}
}
return false;
}
protected bool DefaultTorrentialTribute()
{
return (AI.Utils.IsEnnemyBetter(true, true));
}
protected bool DefaultHeavyStorm()
{
return Duel.Fields[0].GetSpellCount() < Duel.Fields[1].GetSpellCount();
}
protected bool DefaultHammerShot()
{
return AI.Utils.IsEnnemyBetter(true, false);
}
protected bool DefaultDarkHole()
{
return AI.Utils.IsEnnemyBetter(false, false);
}
protected bool DefaultRaigeki()
{
return AI.Utils.IsEnnemyBetter(false, false);
}
protected bool DefaultSpellSet()
{
return Card.IsTrap() && Duel.Fields[0].GetSpellCountWithoutField() < 4;
}
protected bool DefaultTributeSummon()
{
int tributecount = (int)Math.Ceiling((Card.Level - 4.0d) / 2.0d);
for (int j = 0; j < 5; ++j)
{
ClientCard tributeCard = Duel.Fields[0].MonsterZone[j];
if (tributeCard == null) continue;
if (tributeCard.Attack < Card.Attack)
tributecount--;
}
return tributecount <= 0;
}
protected bool DefaultField()
{
return Duel.Fields[0].SpellZone[5] == null;
}
protected bool DefaultMonsterRepos()
{
bool ennemyBetter = AI.Utils.IsEnnemyBetter(true, true);
if (Card.IsAttack() && ennemyBetter)
return true;
if (Card.IsDefense() && !ennemyBetter && Card.Attack >= Card.Defense)
return true;
return false;
}
protected bool DefaultTrap()
{
return LastChainPlayer == 1;
}
protected bool DefaultUniqueTrap()
{
if (HasChainedTrap(0))
return false;
foreach (ClientCard card in Duel.Fields[0].SpellZone)
{
if (card != null &&
card.Id == Card.Id &&
card.HasPosition(CardPosition.FaceUp))
return false;
}
return true;
}
}
}
using System.Collections.Generic;
namespace WindBot.Game.AI
{
public class Dialogs
{
private GameClient _game;
private string[] _duelstart;
private string[] _newturn;
private string[] _endturn;
private string[] _directattack;
private string[] _attack;
private string[] _activate;
private string[] _summon;
private string[] _setmonster;
private string[] _chaining;
public Dialogs(GameClient game)
{
_game = game;
_duelstart = new[]
{
"Good luck, have fun."
};
_newturn = new[]
{
"It's my turn, draw.",
"My turn, draw.",
"I draw a card."
};
_endturn = new[]
{
"I end my turn.",
"My turn is over.",
"Your turn."
};
_directattack = new[]
{
"{0}, direct attack!",
"{0}, attack him directly!",
"{0}, he's defenseless, attack!",
"{0}, attack his life points!",
"{0}, attack his life points directly!",
"{0}, attack him through a direct attack!",
"{0}, attack him using a direct attack!",
"{0}, unleash your power through a direct attack!",
"My {0} is going to smash your life points!",
"Show your power to my opponent, {0}!",
"You can't stop me. {0}, attack!"
};
_attack = new[]
{
"{0}, attack this {1}!",
"{0}, destroy this {1}!",
"{0}, charge the {1}!",
"{0}, strike that {1}!",
"{0}, unleash your power on this {1}!"
};
_activate = new[]
{
"I'm activating {0}.",
"I'm using the effect of {0}.",
"I use the power of {0}."
};
_summon = new[]
{
"I'm summoning {0}.",
"Come on, {0}!",
"Appear, {0}!",
"I summon the powerful {0}.",
"I call {0} to the battle!",
"I'm calling {0}.",
"Let's summon {0}."
};
_setmonster = new[]
{
"I'm setting a monster.",
"I set a face-down monster.",
"I place a hidden monster."
};
_chaining = new[]
{
"Look at that! I'm activating {0}.",
"I use the power of {0}.",
"Get ready! I use {0}.",
"I don't think so. {0}, activation!",
"Looks like you forgot my {0}.",
"Did you consider the fact I have {0}?"
};
}
public void SendDuelStart()
{
InternalSendMessage(_duelstart);
}
public void SendNewTurn()
{
InternalSendMessage(_newturn);
}
public void SendEndTurn()
{
InternalSendMessage(_endturn);
}
public void SendDirectAttack(string attacker)
{
InternalSendMessage(_directattack, attacker);
}
public void SendAttack(string attacker, string defender)
{
InternalSendMessage(_attack, attacker, defender);
}
public void SendActivate(string spell)
{
InternalSendMessage(_activate, spell);
}
public void SendSummon(string monster)
{
InternalSendMessage(_summon, monster);
}
public void SendSetMonster()
{
InternalSendMessage(_setmonster);
}
public void SendChaining(string card)
{
InternalSendMessage(_chaining, card);
}
private void InternalSendMessage(IList<string> array, params object[] opts)
{
string message = string.Format(array[Program.Rand.Next(array.Count)], opts);
_game.Chat(message);
}
}
}
\ No newline at end of file
namespace WindBot.Game.AI.Enums
{
public enum DangerousMonster
{
LionHeart = 54366836,
Yubel = 78371393,
YubelIncarnate = 4779091,
YubelNightmare = 31764700,
MetaionTheTimelord = 74530899
}
}
namespace WindBot.Game.AI.Enums
{
public enum InvincibleMonster
{
SpiritReaper = 23205979,
Marshmallon = 31305911,
LionHeart = 54366836,
Yubel = 78371393,
YubelIncarnate = 4779091,
YubelNightmare = 31764700,
MaskedHeroDivineWind = 22093873,
DarknessNeosphere = 60417395,
MetaionTheTimelord = 74530899,
CastleGate = 36931229
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegateAttackSpell
{
MessengerOfPeace = 44656491,
SavageColosseum = 32391631,
GravityBind = 85742772,
LevelLimitAreaB = 3136426
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesEffects
{
SkillDrain = 82732705,
SoulDrain = 73599290
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesSpells
{
HorusLv6 = 11224103,
HorusLv8 = 48229808
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesSummons
{
Necrovalley = 47355498,
ImperialIronWall = 30459350,
ZombieWorld = 4064256,
DnaSurgery = 74701381,
MacroCosmos = 30241314,
DimensionalFissure = 81674782
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesTraps
{
Jinzo = 77585513,
RoyalDecree = 51452091
}
}
using System;
using System.Collections.Generic;
using WindBot.Game.Enums;
namespace WindBot.Game.AI
{
public abstract class Executor
{
public string Deck { get; set; }
public Duel Duel { get; private set; }
public IList<CardExecutor> Executors { get; private set; }
public GameAI AI { get; private set; }
protected MainPhase Main { get; private set; }
protected BattlePhase Battle { get; private set; }
protected ExecutorType Type { get; private set; }
protected ClientCard Card { get; private set; }
protected int ActivateDescription { get; private set; }
protected int LastChainPlayer { get; private set; }
protected IList<ClientCard> CurrentChain { get; private set; }
protected Executor(GameAI ai, Duel duel)
{
Duel = duel;
AI = ai;
Executors = new List<CardExecutor>();
CurrentChain = new List<ClientCard>();
}
public virtual bool OnSelectHand()
{
return true; // I want to begin !
}
public virtual BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
if (attackers.Count == 0)
return AI.ToMainPhase2();
if (defenders.Count == 0)
return AI.Attack(attackers[0], null);
for (int i = defenders.Count - 1; i >= 0; --i)
{
ClientCard defender = defenders[i];
int value = defender.GetDefensePower();
for (int j = 0; j < attackers.Count; ++j)
{
ClientCard attacker = attackers[j];
if (!OnPreBattleBetween(attacker, defender))
continue;
if (attacker.Attack > value || (attacker.Attack >= value && j == attackers.Count - 1))
return AI.Attack(attacker, defender);
}
}
if (!Battle.CanMainPhaseTwo)
return AI.Attack(attackers[attackers.Count - 1], defenders[0]);
return AI.ToMainPhase2();
}
public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (defender.IsMonsterInvincible())
{
if (defender.IsMonsterDangerous() || defender.IsDefense())
return false;
}
return true;
}
public virtual void OnChaining(int player, ClientCard card)
{
CurrentChain.Add(card);
LastChainPlayer = player;
}
public virtual void OnChainEnd()
{
LastChainPlayer = -1;
CurrentChain.Clear();
}
public virtual IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable)
{
return null;
}
public virtual bool OnSelectYesNo(int desc)
{
return true;
}
public bool ChainContainsCard(int id)
{
foreach (ClientCard card in CurrentChain)
{
if (card.Id == id)
return true;
}
return false;
}
public int ChainCountPlayer(int player)
{
int count = 0;
foreach (ClientCard card in CurrentChain)
{
if (card.Controller == player)
count++;
}
return count;
}
public bool HasChainedTrap(int player)
{
foreach (ClientCard card in CurrentChain)
{
if (card.Controller == player && card.HasType(CardType.Trap))
return true;
}
return false;
}
public ClientCard GetLastChainCard()
{
if (CurrentChain.Count > 0)
return CurrentChain[CurrentChain.Count - 1];
return null;
}
public void SetMain(MainPhase main)
{
Main = main;
}
public void SetBattle(BattlePhase battle)
{
Battle = battle;
}
public void SetCard(ExecutorType type, ClientCard card, int description)
{
Type = type;
Card = card;
ActivateDescription = description;
}
public void AddExecutor(ExecutorType type, int cardId, Func<bool> func)
{
Executors.Add(new CardExecutor(type, cardId, func));
}
public void AddExecutor(ExecutorType type, int cardId)
{
Executors.Add(new CardExecutor(type, cardId, null));
}
public void AddExecutor(ExecutorType type, Func<bool> func)
{
Executors.Add(new CardExecutor(type, -1, func));
}
public void AddExecutor(ExecutorType type)
{
Executors.Add(new CardExecutor(type, -1, DefaultNoExecutor));
}
private bool DefaultNoExecutor()
{
foreach (CardExecutor exec in Executors)
{
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return true;
}
}
}
\ No newline at end of file
namespace WindBot.Game.AI
{
public enum ExecutorType
{
Summon,
SpSummon,
Repos,
MonsterSet,
SpellSet,
Activate,
SummonOrSet
}
}
\ No newline at end of file
using System.Collections.Generic;
namespace WindBot.Game
{
public class BattlePhase
{
public IList<ClientCard> AttackableCards { get; private set; }
public IList<ClientCard> ActivableCards { get; private set; }
public IList<int> ActivableDescs { get; private set; }
public bool CanMainPhaseTwo { get; set; }
public bool CanEndPhase { get; set; }
public BattlePhase()
{
AttackableCards = new List<ClientCard>();
ActivableCards = new List<ClientCard>();
ActivableDescs = new List<int>();
}
}
}
\ No newline at end of file
namespace WindBot.Game
{
public class BattlePhaseAction
{
public enum BattleAction
{
Activate = 0,
Attack = 1,
ToMainPhaseTwo = 2,
ToEndPhase = 3
}
public BattleAction Action { get; private set; }
public int Index { get; private set; }
public BattlePhaseAction(BattleAction action)
{
Action = action;
Index = 0;
}
public BattlePhaseAction(BattleAction action, int[] indexes)
{
Action = action;
Index = indexes[(int)action];
}
public int ToValue()
{
return (Index << 16) + (int)Action;
}
}
}
\ No newline at end of file
using System.Collections.Generic;
using WindBot.Game.Data;
using WindBot.Game.Enums;
using WindBot.Game.Network;
namespace WindBot.Game
{
public class ClientCard
{
public int Id { get; private set; }
public CardData Data { get; private set; }
public string Name { get; private set; }
public int Position { get; set; }
public CardLocation Location { get; set; }
public int Alias { get; private set; }
public int Level { get; private set; }
public int Rank { get; private set; }
public int Type { get; private set; }
public int Attribute { get; private set; }
public int Race { get; private set; }
public int Attack { get; private set; }
public int Defense { get; private set; }
public int BaseAttack { get; private set; }
public int BaseDefense { get; private set; }
public List<int> Overlays { get; private set; }
public int Owner { get; private set; }
public int Controller { get; private set; }
public int[] ActionIndex { get; set; }
public IDictionary<int, int> ActionActivateIndex { get; private set; }
public ClientCard(int id, CardLocation loc)
: this(id, loc, 0)
{
}
public ClientCard(int id, CardLocation loc, int position)
{
SetId(id);
Position = position;
Overlays = new List<int>();
ActionIndex = new int[16];
ActionActivateIndex = new Dictionary<int, int>();
Location = loc;
}
public void SetId(int id)
{
if (Id == id) return;
Id = id;
Data = CardsManager.GetCard(Id);
if (Data != null)
Name = Data.Name;
}
public void Update(GameServerPacket packet, Duel duel)
{
int flag = packet.ReadInt32();
if ((flag & (int)Query.Code) != 0)
SetId(packet.ReadInt32());
if ((flag & (int)Query.Position) != 0)
{
Controller = duel.GetLocalPlayer(packet.ReadByte());
packet.ReadByte();
packet.ReadByte();
Position = packet.ReadByte();
}
if ((flag & (int)Query.Alias) != 0)
Alias = packet.ReadInt32();
if ((flag & (int)Query.Type) != 0)
Type = packet.ReadInt32();
if ((flag & (int)Query.Level) != 0)
Level = packet.ReadInt32();
if ((flag & (int)Query.Rank) != 0)
Rank = packet.ReadInt32();
if ((flag & (int)Query.Attribute) != 0)
Attribute = packet.ReadInt32();
if ((flag & (int)Query.Race) != 0)
Race = packet.ReadInt32();
if ((flag & (int)Query.Attack) != 0)
Attack = packet.ReadInt32();
if ((flag & (int)Query.Defence) != 0)
Defense = packet.ReadInt32();
if ((flag & (int)Query.BaseAttack) != 0)
BaseAttack = packet.ReadInt32();
if ((flag & (int)Query.BaseDefence) != 0)
BaseDefense = packet.ReadInt32();
if ((flag & (int)Query.Reason) != 0)
packet.ReadInt32();
if ((flag & (int)Query.ReasonCard) != 0)
packet.ReadInt32(); // Int8 * 4
if ((flag & (int)Query.EquipCard) != 0)
packet.ReadInt32(); // Int8 * 4
if ((flag & (int)Query.TargetCard) != 0)
{
int count = packet.ReadInt32();
for (int i = 0; i < count; ++i)
packet.ReadInt32(); // Int8 * 4
}
if ((flag & (int)Query.OverlayCard) != 0)
{
Overlays.Clear();
int count = packet.ReadInt32();
for (int i = 0; i < count; ++i)
Overlays.Add(packet.ReadInt32());
}
if ((flag & (int)Query.Counters) != 0)
{
int count = packet.ReadInt32();
for (int i = 0; i < count; ++i)
packet.ReadInt32(); // Int16 * 2
}
if ((flag & (int)Query.Owner) != 0)
Owner = duel.GetLocalPlayer(packet.ReadInt32());
if ((flag & (int)Query.IsDisabled) != 0)
packet.ReadInt32();
if ((flag & (int)Query.IsPublic) != 0)
packet.ReadInt32();
if ((flag & (int)Query.LScale) != 0)
packet.ReadInt32();
if ((flag & (int)Query.RScale) != 0)
packet.ReadInt32();
}
public bool HasType(CardType type)
{
return ((Type & (int)type) != 0);
}
public bool HasPosition(CardPosition position)
{
return ((Position & (int)position) != 0);
}
public bool HasAttribute(CardAttribute attribute)
{
return ((Attribute & (int)attribute) != 0);
}
public bool IsMonster()
{
return HasType(CardType.Monster);
}
public bool IsSpell()
{
return HasType(CardType.Spell);
}
public bool IsTrap()
{
return HasType(CardType.Trap);
}
public bool IsExtraCard()
{
return (HasType(CardType.Fusion) || HasType(CardType.Synchro) || HasType(CardType.Xyz));
}
public bool IsFacedown()
{
return HasPosition(CardPosition.FaceDown);
}
public bool IsAttack()
{
return HasPosition(CardPosition.Attack);
}
public bool IsDefense()
{
return HasPosition(CardPosition.Defense);
}
public int GetDefensePower()
{
return IsAttack() ? Attack : Defense;
}
public bool Equals(ClientCard card)
{
return ReferenceEquals(this, card);
}
}
}
\ No newline at end of file
using System.Collections.Generic;
using WindBot.Game.Enums;
namespace WindBot.Game
{
public class ClientField
{
public IList<ClientCard> Hand { get; private set; }
public ClientCard[] MonsterZone { get; private set; }
public ClientCard[] SpellZone { get; private set; }
public IList<ClientCard> Graveyard { get; private set; }
public IList<ClientCard> Banished { get; private set; }
public IList<ClientCard> Deck { get; private set; }
public IList<ClientCard> ExtraDeck { get; private set; }
public ClientField()
{
Hand = new List<ClientCard>();
MonsterZone = new ClientCard[5];
SpellZone = new ClientCard[8];
Graveyard = new List<ClientCard>();
Banished = new List<ClientCard>();
Deck = new List<ClientCard>();
ExtraDeck = new List<ClientCard>();
}
public void Init(int deck, int extra)
{
for (int i = 0; i < deck; ++i)
Deck.Add(new ClientCard(0, CardLocation.Deck));
for (int i = 0; i < extra; ++i)
ExtraDeck.Add(new ClientCard(0, CardLocation.Extra));
}
public int GetMonsterCount()
{
return GetCount(MonsterZone);
}
public int GetSpellCount()
{
return GetCount(SpellZone);
}
public int GetSpellCountWithoutField()
{
int count = 0;
for (int i = 0; i < 5; ++i)
{
if (SpellZone[i] != null)
++count;
}
return count;
}
public bool IsFieldEmpty()
{
return GetMonsters().Count == 0 && GetSpells().Count == 0;
}
public List<ClientCard> GetMonsters()
{
return GetCards(MonsterZone);
}
public List<ClientCard> GetGraveyardMonsters()
{
return GetCards(Graveyard, CardType.Monster);
}
public List<ClientCard> GetGraveyardSpells()
{
return GetCards(Graveyard, CardType.Spell);
}
public List<ClientCard> GetGraveyardTraps()
{
return GetCards(Graveyard, CardType.Trap);
}
public List<ClientCard> GetSpells()
{
return GetCards(SpellZone);
}
public bool HasInHand(int cardId)
{
return HasInCards(Hand, cardId);
}
public bool HasInGraveyard(int cardId)
{
return HasInCards(Graveyard, cardId);
}
public bool HasAttackingMonster()
{
IList<ClientCard> monsters = GetMonsters();
foreach (ClientCard card in monsters)
{
if (card.IsAttack())
return true;
}
return false;
}
public bool HasDefendingMonster()
{
IList<ClientCard> monsters = GetMonsters();
foreach (ClientCard card in monsters)
{
if (card.IsDefense())
return true;
}
return false;
}
public bool HasInMonstersZone(int cardId)
{
return HasInCards(MonsterZone, cardId);
}
public bool HasInSpellZone(int cardId)
{
return HasInCards(SpellZone, cardId);
}
public int GetRemainingCount(int cardId, int initialCount)
{
int remaining = initialCount;
foreach (ClientCard card in Hand)
if (card.Id == cardId)
remaining--;
foreach (ClientCard card in Graveyard)
if (card.Id == cardId)
remaining--;
foreach (ClientCard card in Banished)
if (card.Id == cardId)
remaining--;
return (remaining < 0) ? 0 : remaining;
}
private static int GetCount(IEnumerable<ClientCard> cards)
{
int count = 0;
foreach (ClientCard card in cards)
{
if (card != null)
count++;
}
return count;
}
private static List<ClientCard> GetCards(IEnumerable<ClientCard> cards, CardType type)
{
List<ClientCard> nCards = new List<ClientCard>();
foreach (ClientCard card in cards)
{
if (card != null && card.HasType(type))
nCards.Add(card);
}
return nCards;
}
private static List<ClientCard> GetCards(IEnumerable<ClientCard> cards)
{
List<ClientCard> nCards = new List<ClientCard>();
foreach (ClientCard card in cards)
{
if (card != null)
nCards.Add(card);
}
return nCards;
}
private static bool HasInCards(IEnumerable<ClientCard> cards, int cardId)
{
foreach (ClientCard card in cards)
{
if (card != null && card.Id == cardId)
return true;
}
return false;
}
}
}
\ No newline at end of file
using WindBot.Game.Enums;
namespace WindBot.Game.Data
{
public class CardData
{
public int Id { get; private set; }
public int AliasId { get; set; }
public int Type { get; set; }
public int Level { get; set; }
public int Attribute { get; set; }
public int Race { get; set; }
public int Atk { get; set; }
public int Def { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public CardData(int id)
{
Id = id;
}
public bool HasType(CardType type)
{
return ((Type & (int)type) != 0);
}
public bool IsExtraCard()
{
return (HasType(CardType.Fusion) || HasType(CardType.Synchro) || HasType(CardType.Xyz));
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
using Mono.Data.Sqlite;
namespace WindBot.Game.Data
{
public class CardsManager
{
private static IDictionary<int, CardData> _cards;
public static void Init()
{
try
{
_cards = new Dictionary<int, CardData>();
string currentPath = Assembly.GetExecutingAssembly().Location;
currentPath = Path.GetDirectoryName(currentPath) ?? "";
string absolutePath = Path.Combine(currentPath, "cards.cdb");
if (!File.Exists(absolutePath))
{
throw new Exception("Could not find the cards database.");
}
using (SqliteConnection connection = new SqliteConnection("Data Source=" + absolutePath))
{
connection.Open();
const string select =
"SELECT datas.id, alias, type, level, race, attribute, atk, def, name, desc " +
"FROM datas INNER JOIN texts ON datas.id = texts.id";
using (SqliteCommand command = new SqliteCommand(select, connection))
using (SqliteDataReader reader = command.ExecuteReader())
InitCards(reader);
}
}
catch (Exception ex)
{
throw new Exception("Could not initialize the cards database. Check the inner exception for more details.", ex);
}
}
private static void InitCards(IDataReader reader)
{
while (reader.Read())
{
int id = reader.GetInt32(0);
CardData card = new CardData(id)
{
AliasId = reader.GetInt32(1),
Type = reader.GetInt32(2),
Level = reader.GetInt32(3) & 0xFF,
Race = reader.GetInt32(4),
Attribute = reader.GetInt32(5),
Atk = reader.GetInt32(6),
Def = reader.GetInt32(7),
Name = reader.GetString(8),
Description = reader.GetString(9)
};
_cards.Add(id, card);
}
}
public static int GetCount()
{
return _cards.Count;
}
public static CardData GetCard(int id)
{
if (_cards.ContainsKey(id))
{
return _cards[id];
}
return null;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.IO;
namespace WindBot.Game.Data
{
public class Deck
{
public IList<CardData> Cards { get; private set; }
public IList<CardData> ExtraCards { get; private set; }
public IList<CardData> SideCards { get; private set; }
public Deck()
{
Cards = new List<CardData>();
ExtraCards = new List<CardData>();
SideCards = new List<CardData>();
}
private void AddNewCard(int cardId, bool sideDeck)
{
CardData newCard = CardsManager.GetCard(cardId);
if (newCard == null)
return;
if (!sideDeck)
AddCard(newCard);
else
SideCards.Add(newCard);
}
private void AddCard(CardData card)
{
if (card.IsExtraCard())
ExtraCards.Add(card);
else
Cards.Add(card);
}
public static Deck Load(string name)
{
StreamReader reader = null;
try
{
reader = new StreamReader(new FileStream("Decks/" + name + ".ydk", FileMode.Open, FileAccess.Read));
Deck deck = new Deck();
bool side = false;
while (!reader.EndOfStream)
{
string line = reader.ReadLine();
if (line == null)
continue;
line = line.Trim();
if (line.StartsWith("#"))
continue;
if (line.Equals("!side"))
{
side = true;
continue;
}
int id;
if (!int.TryParse(line, out id))
continue;
deck.AddNewCard(id, side);
}
reader.Close();
if (deck.Cards.Count > 60)
return null;
if (deck.ExtraCards.Count > 15)
return null;
if (deck.SideCards.Count > 15)
return null;
return deck;
}
catch (Exception)
{
if (reader != null)
reader.Close();
return null;
}
}
}
}
\ No newline at end of file
using System.Collections.Generic;
using WindBot.Game.Enums;
namespace WindBot.Game
{
public class Duel
{
public bool IsFirst { get; set; }
public int[] LifePoints { get; private set; }
public ClientField[] Fields { get; private set; }
public int Turn { get; set; }
public int Player { get; set; }
public Phase Phase { get; set; }
public MainPhase MainPhase { get; set; }
public BattlePhase BattlePhase { get; set; }
public Duel()
{
LifePoints = new int[2];
Fields = new ClientField[2];
Fields[0] = new ClientField();
Fields[1] = new ClientField();
}
public ClientCard GetCard(int player, CardLocation loc, int index)
{
return GetCard(player, (int)loc, index, 0);
}
public ClientCard GetCard(int player, int loc, int index, int subindex)
{
if (player < 0 || player > 1)
return null;
bool isXyz = (loc & 0x80) != 0;
CardLocation location = (CardLocation)(loc & 0x7f);
IList<ClientCard> cards = null;
switch (location)
{
case CardLocation.Deck:
cards = Fields[player].Deck;
break;
case CardLocation.Hand:
cards = Fields[player].Hand;
break;
case CardLocation.MonsterZone:
cards = Fields[player].MonsterZone;
break;
case CardLocation.SpellZone:
cards = Fields[player].SpellZone;
break;
case CardLocation.Grave:
cards = Fields[player].Graveyard;
break;
case CardLocation.Removed:
cards = Fields[player].Banished;
break;
case CardLocation.Extra:
cards = Fields[player].ExtraDeck;
break;
}
if (cards == null)
return null;
if (index >= cards.Count)
return null;
if (isXyz)
{
ClientCard card = cards[index];
if (card == null || subindex >= card.Overlays.Count)
return null;
return null; // TODO card.Overlays[subindex]
}
return cards[index];
}
public void AddCard(CardLocation loc, int cardId, int player, int zone, int pos)
{
switch (loc)
{
case CardLocation.Hand:
Fields[player].Hand.Add(new ClientCard(cardId, loc, pos));
break;
case CardLocation.Grave:
Fields[player].Graveyard.Add(new ClientCard(cardId, loc, pos));
break;
case CardLocation.Removed:
Fields[player].Banished.Add(new ClientCard(cardId, loc, pos));
break;
case CardLocation.MonsterZone:
Fields[player].MonsterZone[zone] = new ClientCard(cardId, loc, pos);
break;
case CardLocation.SpellZone:
Fields[player].SpellZone[zone] = new ClientCard(cardId, loc, pos);
break;
case CardLocation.Deck:
Fields[player].Deck.Add(new ClientCard(cardId, loc, pos));
break;
case CardLocation.Extra:
Fields[player].ExtraDeck.Add(new ClientCard(cardId, loc, pos));
break;
}
}
public void RemoveCard(CardLocation loc, ClientCard card, int player, int zone)
{
switch (loc)
{
case CardLocation.Hand:
Fields[player].Hand.Remove(card);
break;
case CardLocation.Grave:
Fields[player].Graveyard.Remove(card);
break;
case CardLocation.Removed:
Fields[player].Banished.Remove(card);
break;
case CardLocation.MonsterZone:
Fields[player].MonsterZone[zone] = null;
break;
case CardLocation.SpellZone:
Fields[player].SpellZone[zone] = null;
break;
case CardLocation.Deck:
Fields[player].Deck.Remove(card);
break;
case CardLocation.Extra:
Fields[player].ExtraDeck.Remove(card);
break;
}
}
public int GetLocalPlayer(int player)
{
return IsFirst ? player : 1 - player;
}
}
}
\ No newline at end of file
namespace WindBot.Game.Enums
{
public enum CardAttribute
{
Earth = 0x01,
Water = 0x02,
Fire = 0x04,
Wind = 0x08,
Light = 0x10,
Dark = 0x20,
Divine = 0x40
}
}
\ No newline at end of file
namespace WindBot.Game.Enums
{
public enum CardLocation
{
Deck = 0x01,
Hand = 0x02,
MonsterZone = 0x04,
SpellZone = 0x08,
Grave = 0x10,
Removed = 0x20,
Extra = 0x40,
Overlay = 0x80,
Onfield = 0x0C
}
}
\ No newline at end of file
namespace WindBot.Game.Enums
{
public enum CardPosition
{
FaceUpAttack = 0x1,
FaceDownAttack = 0x2,
FaceUpDefense = 0x4,
FaceDownDefense = 0x8,
FaceUp = 0x5,
FaceDown = 0xA,
Attack = 0x3,
Defense = 0xC
}
}
\ No newline at end of file
namespace WindBot.Game.Enums
{
public enum CardRace
{
Warrior = 0x1,
SpellCaster = 0x2,
Fairy = 0x4,
Fiend = 0x8,
Zombie = 0x10,
Machine = 0x20,
Aqua = 0x40,
Pyro = 0x80,
Rock = 0x100,
WindBeast = 0x200,
Plant = 0x400,
Insect = 0x800,
Thunder = 0x1000,
Dragon = 0x2000,
Beast = 0x4000,
BestWarrior = 0x8000,
Dinosaur = 0x10000,
Fish = 0x20000,
SeaSerpent = 0x40000,
Reptile = 0x80000,
Psycho = 0x100000,
DivineBeast = 0x200000
}
}
\ No newline at end of file
namespace WindBot.Game.Enums
{
public enum CardType
{
Monster = 0x1,
Spell = 0x2,
Trap = 0x4,
Normal = 0x10,
Effect = 0x20,
Fusion = 0x40,
Ritual = 0x80,
TrapMonster = 0x100,
Spirit = 0x200,
Union = 0x400,
Dual = 0x800,
Tuner = 0x1000,
Synchro = 0x2000,
Token = 0x4000,
QuickPlay = 0x10000,
Continuous = 0x20000,
Equip = 0x40000,
Field = 0x80000,
Counter = 0x100000,
Flip = 0x200000,
Toon = 0x400000,
Xyz = 0x800000
}
}
\ No newline at end of file
namespace WindBot.Game.Enums
{
public enum Phase
{
Draw = 0x01,
Standby = 0x02,
Main1 = 0x04,
Battle = 0x08,
Damage = 0x10,
DamageCal = 0x20,
Main2 = 0x40,
End = 0x80
}
}
\ No newline at end of file
namespace WindBot.Game.Enums
{
public enum Query
{
Code = 0x01,
Position = 0x02,
Alias = 0x04,
Type = 0x08,
Level = 0x10,
Rank = 0x20,
Attribute = 0x40,
Race = 0x80,
Attack = 0x100,
Defence = 0x200,
BaseAttack = 0x400,
BaseDefence = 0x800,
Reason = 0x1000,
ReasonCard = 0x2000,
EquipCard = 0x4000,
TargetCard = 0x8000,
OverlayCard = 0x10000,
Counters = 0x20000,
Owner = 0x40000,
IsDisabled = 0x80000,
IsPublic = 0x100000,
LScale = 0x200000,
RScale = 0x400000
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
using System.Net;
using System.Text;
using WindBot.Game.Network;
using WindBot.Game.Network.Enums;
namespace WindBot.Game
{
public class GameClient
{
public GameConnection Connection { get; private set; }
public string Username;
public string Deck;
private string _serverHost;
private int _serverPort;
private string _roomInfos;
private GameBehavior _behavior;
public GameClient(string username, string deck, string serverHost, int serverPort, string roomInfos)
{
Username = username;
Deck = deck;
_serverHost = serverHost;
_serverPort = serverPort;
_roomInfos = roomInfos;
}
public void Start()
{
Connection = new GameConnection(IPAddress.Parse(_serverHost), _serverPort);
_behavior = new GameBehavior(this);
GameClientPacket packet = new GameClientPacket(CtosMessage.PlayerInfo);
packet.Write(Username, 20);
Connection.Send(packet);
byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 };
packet = new GameClientPacket(CtosMessage.JoinGame);
packet.Write(Program.ProVersion);
packet.Write(junk);
packet.Write(_roomInfos, 30);
Connection.Send(packet);
}
public void Tick()
{
if (!Connection.IsConnected)
{
return;
}
while (Connection.HasPacket())
{
GameServerPacket packet = Connection.Receive();
_behavior.OnPacket(packet);
}
}
public void Chat(string message)
{
byte[] content = Encoding.Unicode.GetBytes(message + "\0");
GameClientPacket chat = new GameClientPacket(CtosMessage.Chat);
chat.Write(content);
Connection.Send(chat);
}
}
}
\ No newline at end of file
using System.Collections.Generic;
namespace WindBot.Game
{
public class MainPhase
{
public IList<ClientCard> SummonableCards { get; private set; }
public IList<ClientCard> SpecialSummonableCards { get; private set; }
public IList<ClientCard> ReposableCards { get; private set; }
public IList<ClientCard> MonsterSetableCards { get; private set; }
public IList<ClientCard> SpellSetableCards { get; private set; }
public IList<ClientCard> ActivableCards { get; private set; }
public IList<int> ActivableDescs { get; private set; }
public bool CanBattlePhase { get; set; }
public bool CanEndPhase { get; set; }
public MainPhase()
{
SummonableCards = new List<ClientCard>();
SpecialSummonableCards = new List<ClientCard>();
ReposableCards = new List<ClientCard>();
MonsterSetableCards = new List<ClientCard>();
SpellSetableCards = new List<ClientCard>();
ActivableCards = new List<ClientCard>();
ActivableDescs = new List<int>();
}
}
}
\ No newline at end of file
namespace WindBot.Game
{
public class MainPhaseAction
{
public enum MainAction
{
Summon = 0,
SpSummon = 1,
Repos = 2,
SetMonster = 3,
SetSpell = 4,
Activate = 5,
ToBattlePhase = 6,
ToEndPhase = 7
}
public MainAction Action { get; private set; }
public int Index { get; private set; }
public MainPhaseAction(MainAction action)
{
Action = action;
Index = 0;
}
public MainPhaseAction(MainAction action, int index)
{
Action = action;
Index = index;
}
public MainPhaseAction(MainAction action, int[] indexes)
{
Action = action;
Index = indexes[(int)action];
}
public int ToValue()
{
return (Index << 16) + (int)Action;
}
}
}
\ No newline at end of file
using System;
using System.IO;
using System.Text;
namespace WindBot.Game.Network
{
public static class BinaryExtensions
{
public static void WriteUnicode(this BinaryWriter writer, string text, int len)
{
byte[] unicode = Encoding.Unicode.GetBytes(text);
byte[] result = new byte[len * 2];
int max = len * 2 - 2;
Array.Copy(unicode, result, unicode.Length > max ? max : unicode.Length);
writer.Write(result);
}
public static string ReadUnicode(this BinaryReader reader, int len)
{
byte[] unicode = reader.ReadBytes(len*2);
string text = Encoding.Unicode.GetString(unicode);
if (text.Contains("\0"))
text = text.Substring(0, text.IndexOf('\0'));
return text;
}
}
}
\ No newline at end of file
namespace WindBot.Game.Network.Enums
{
public enum CtosMessage
{
Response = 0x1,
UpdateDeck = 0x2,
HandResult = 0x3,
TpResult = 0x4,
PlayerInfo = 0x10,
CreateGame = 0x11,
JoinGame = 0x12,
LeaveGame = 0x13,
Surrender = 0x14,
TimeConfirm = 0x15,
Chat = 0x16,
HsToDuelist = 0x20,
HsToObserver = 0x21,
HsReady = 0x22,
HsNotReady = 0x23,
HsKick = 0x24,
HsStart = 0x25
}
}
\ No newline at end of file
namespace WindBot.Game.Network.Enums
{
public enum GameMessage
{
Retry = 1,
Hint = 2,
Waiting = 3,
Start = 4,
Win = 5,
UpdateData = 6,
UpdateCard = 7,
RequestDeck = 8,
SelectBattleCmd = 10,
SelectIdleCmd = 11,
SelectEffectYn = 12,
SelectYesNo = 13,
SelectOption = 14,
SelectCard = 15,
SelectChain = 16,
SelectPlace = 18,
SelectPosition = 19,
SelectTribute = 20,
SortChain = 21,
SelectCounter = 22,
SelectSum = 23,
SelectDisfield = 24,
SortCard = 25,
ConfirmDecktop = 30,
ConfirmCards = 31,
ShuffleDeck = 32,
ShuffleHand = 33,
RefreshDeck = 34,
SwapGraveDeck = 35,
ShuffleSetCard = 36,
ReverseDeck = 37,
DeckTop = 38,
NewTurn = 40,
NewPhase = 41,
Move = 50,
PosChange = 53,
Set = 54,
Swap = 55,
FieldDisabled = 56,
Summoning = 60,
Summoned = 61,
SpSummoning = 62,
SpSummoned = 63,
FlipSummoning = 64,
FlipSummoned = 65,
Chaining = 70,
Chained = 71,
ChainSolving = 72,
ChainSolved = 73,
ChainEnd = 74,
ChainNegated = 75,
ChainDisabled = 76,
CardSelected = 80,
RandomSelected = 81,
BecomeTarget = 83,
Draw = 90,
Damage = 91,
Recover = 92,
Equip = 93,
LpUpdate = 94,
Unequip = 95,
CardTarget = 96,
CancelTarget = 97,
PayLpCost = 100,
AddCounter = 101,
RemoveCounter = 102,
Attack = 110,
Battle = 111,
AttackDisabled = 112,
DamageStepStart = 113,
DamageStepEnd = 114,
MissedEffect = 120,
BeChainTarget = 121,
CreateRelation = 122,
ReleaseRelation = 123,
TossCoin = 130,
TossDice = 131,
AnnounceRace = 140,
AnnounceAttrib = 141,
AnnounceCard = 142,
AnnounceNumber = 143,
CardHint = 160,
TagSwap = 161,
ReloadField = 162,
AiName = 163,
ShowHint = 164,
MatchKill = 170,
CustomMsg = 180
}
}
\ No newline at end of file
namespace WindBot.Game.Network.Enums
{
public enum PlayerChange
{
Observe = 0x8,
Ready = 0x9,
NotReady = 0xA,
Leave = 0xB
}
}
\ No newline at end of file
namespace WindBot.Game.Network.Enums
{
public enum StocMessage
{
GameMsg = 0x1,
ErrorMsg = 0x2,
SelectHand = 0x3,
SelectTp = 0x4,
HandResult = 0x5,
TpResult = 0x6,
ChangeSide = 0x7,
WaitingSide = 0x8,
CreateGame = 0x11,
JoinGame = 0x12,
TypeChange = 0x13,
LeaveGame = 0x14,
DuelStart = 0x15,
DuelEnd = 0x16,
Replay = 0x17,
TimeLimit = 0x18,
Chat = 0x19,
HsPlayerEnter = 0x20,
HsPlayerChange = 0x21,
HsWatchChange = 0x22
}
}
\ No newline at end of file
using System.IO;
using WindBot.Game.Network.Enums;
namespace WindBot.Game.Network
{
public class GameClientPacket
{
private BinaryWriter _writer;
private MemoryStream _stream;
public GameClientPacket(CtosMessage message)
{
_stream = new MemoryStream();
_writer = new BinaryWriter(_stream);
_writer.Write((byte)message);
}
public byte[] GetContent()
{
return _stream.ToArray();
}
public void Write(byte[] array)
{
_writer.Write(array);
}
public void Write(sbyte value)
{
_writer.Write(value);
}
public void Write(byte value)
{
_writer.Write(value);
}
public void Write(short value)
{
_writer.Write(value);
}
public void Write(int value)
{
_writer.Write(value);
}
public void Write(string text, int len)
{
_writer.WriteUnicode(text, len);
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using WindBot.Game.Network.Enums;
namespace WindBot.Game.Network
{
public class GameConnection
{
public bool IsConnected { get; private set; }
private TcpClient _client;
private BinaryReader _reader;
private Thread _thread;
private Queue<GameClientPacket> _sendQueue;
private Queue<GameServerPacket> _receiveQueue;
private DateTime _lastAction;
public GameConnection(IPAddress address, int port)
{
_sendQueue = new Queue<GameClientPacket>();
_receiveQueue = new Queue<GameServerPacket>();
_lastAction = DateTime.Now;
_client = new TcpClient(address.ToString(), port);
IsConnected = true;
_reader = new BinaryReader(_client.GetStream());
_thread = new Thread(NetworkTick);
_thread.Start();
}
public void Send(GameClientPacket packet)
{
lock (_sendQueue)
_sendQueue.Enqueue(packet);
}
public void Send(CtosMessage message)
{
Send(new GameClientPacket(message));
}
public void Send(CtosMessage message, byte value)
{
GameClientPacket packet = new GameClientPacket(message);
packet.Write(value);
Send(packet);
}
public void Send(CtosMessage message, int value)
{
GameClientPacket packet = new GameClientPacket(message);
packet.Write(value);
Send(packet);
}
public bool HasPacket()
{
lock (_receiveQueue)
return _receiveQueue.Count > 0;
}
public GameServerPacket Receive()
{
lock (_receiveQueue)
{
if (_receiveQueue.Count == 0)
return null;
return _receiveQueue.Dequeue();
}
}
public void Close()
{
if (!IsConnected) return;
IsConnected = false;
_client.Close();
_thread.Join();
}
private void NetworkTick()
{
try
{
int connectionCheckTick = 100;
while (IsConnected)
{
InternalTick();
if (--connectionCheckTick <= 0)
{
connectionCheckTick = 100;
if (!CheckIsConnected())
Close();
}
Thread.Sleep(1);
}
}
catch (Exception)
{
Close();
}
}
private void InternalTick()
{
lock (_sendQueue)
{
while (_sendQueue.Count > 0)
InternalSend(_sendQueue.Dequeue());
}
while (_client.Available > 1)
{
GameServerPacket packet = InternalReceive();
lock (_receiveQueue)
{
_receiveQueue.Enqueue(packet);
}
}
}
private void InternalSend(GameClientPacket packet)
{
_lastAction = DateTime.Now;
MemoryStream ms = new MemoryStream();
BinaryWriter writer = new BinaryWriter(ms);
byte[] content = packet.GetContent();
writer.Write((short)content.Length);
if (content.Length > 0)
writer.Write(content);
byte[] data = ms.ToArray();
_client.Client.Send(data);
}
private GameServerPacket InternalReceive()
{
_lastAction = DateTime.Now;
int len = _reader.ReadInt16();
GameServerPacket packet = new GameServerPacket(_reader.ReadBytes(len));
return packet;
}
private bool CheckIsConnected()
{
TimeSpan diff = DateTime.Now - _lastAction;
if (diff.TotalMinutes > 5)
return false;
return true;
}
}
}
\ No newline at end of file
using System.IO;
using WindBot.Game.Network.Enums;
namespace WindBot.Game.Network
{
public class GameServerPacket
{
public byte[] Content { get; private set; }
private BinaryReader _reader;
public GameServerPacket(byte[] content)
{
Content = content;
_reader = new BinaryReader(new MemoryStream(Content));
}
public StocMessage ReadStoc()
{
return (StocMessage)_reader.ReadByte();
}
public GameMessage ReadGameMsg()
{
return (GameMessage)_reader.ReadByte();
}
public byte ReadByte()
{
return _reader.ReadByte();
}
public byte[] ReadToEnd()
{
return _reader.ReadBytes((int)_reader.BaseStream.Length - (int)_reader.BaseStream.Position);
}
public sbyte ReadSByte()
{
return _reader.ReadSByte();
}
public short ReadInt16()
{
return _reader.ReadInt16();
}
public int ReadInt32()
{
return _reader.ReadInt32();
}
public string ReadUnicode(int len)
{
return _reader.ReadUnicode(len);
}
public long GetPosition()
{
return _reader.BaseStream.Position;
}
public void SetPosition(long pos)
{
_reader.BaseStream.Position = pos;
}
}
}
\ No newline at end of file
namespace WindBot.Game
{
public class Room
{
public bool IsHost { get; set; }
public string[] Names { get; set; }
public bool[] IsReady { get; set; }
public Room()
{
Names = new string[8];
IsReady = new bool[8];
}
}
}
\ No newline at end of file
using System;
namespace WindBot
{
public static class Logger
{
public static void WriteLine(string message)
{
Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + message);
}
}
}
\ No newline at end of file
using System;
using System.Threading;
using WindBot.Game;
using WindBot.Game.AI;
using WindBot.Game.Data;
namespace WindBot
{
public class Program
{
public const short ProVersion = 0x1335;
public static Random Rand;
public static void Main()
{
#if !DEBUG
try
{
Run();
}
catch (Exception ex)
{
Console.Error.WriteLine("Error: " + ex);
}
#else
Run();
#endif
}
private static void Run()
{
Rand = new Random();
CardsManager.Init();
DecksManager.Init();
// Start two clients and connect them to the same room. Which deck is gonna win?
GameClient clientA = new GameClient("Wind", "Horus", "127.0.0.1", 13254, "000");
GameClient clientB = new GameClient("Fire", "OldSchool", "127.0.0.1", 13254, "000");
clientA.Start();
clientB.Start();
while (clientA.Connection.IsConnected || clientB.Connection.IsConnected)
{
clientA.Tick();
clientB.Tick();
Thread.Sleep(1);
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WindBot")]
[assembly: AssemblyDescription("A C# bot for ygopro, compatible with ygosharp.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ice")]
[assembly: AssemblyProduct("WindBot")]
[assembly: AssemblyCopyright("Copyright © Ice 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("eb88cec8-62f7-4839-9fa4-1732b9d06f87")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
# windbot
# WindBot
A C# bot for ygopro, compatible with the ygosharp server.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3E7FAF67-A27D-4A61-B161-93AD4414183E}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WindBot</RootNamespace>
<AssemblyName>WindBot</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Data.Sqlite">
<HintPath>.\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="Game\AI\AIFunctions.cs" />
<Compile Include="Game\AI\CardContainer.cs" />
<Compile Include="Game\AI\CardExecutor.cs" />
<Compile Include="Game\AI\CardExtension.cs" />
<Compile Include="Game\AI\CardSelector.cs" />
<Compile Include="Game\AI\DeckAttribute.cs" />
<Compile Include="Game\AI\DecksManager.cs" />
<Compile Include="Game\AI\Decks\HorusExecutor.cs" />
<Compile Include="Game\AI\Decks\OldSchoolExecutor.cs" />
<Compile Include="Game\AI\DefaultExecutor.cs" />
<Compile Include="Game\AI\Dialogs.cs" />
<Compile Include="Game\AI\Enums\DangerousMonster.cs" />
<Compile Include="Game\AI\Enums\InvincibleMonster.cs" />
<Compile Include="Game\AI\Enums\NegateAttackSpell.cs" />
<Compile Include="Game\AI\Enums\NegatesEffects.cs" />
<Compile Include="Game\AI\Enums\NegatesSpells.cs" />
<Compile Include="Game\AI\Enums\NegatesSummons.cs" />
<Compile Include="Game\AI\Enums\NegatesTraps.cs" />
<Compile Include="Game\AI\Executor.cs" />
<Compile Include="Game\AI\ExecutorType.cs" />
<Compile Include="Game\BattlePhase.cs" />
<Compile Include="Game\BattlePhaseAction.cs" />
<Compile Include="Game\ClientCard.cs" />
<Compile Include="Game\ClientField.cs" />
<Compile Include="Game\Data\CardData.cs" />
<Compile Include="Game\Data\CardsManager.cs" />
<Compile Include="Game\Data\Deck.cs" />
<Compile Include="Game\Duel.cs" />
<Compile Include="Game\Enums\CardAttribute.cs" />
<Compile Include="Game\Enums\CardLocation.cs" />
<Compile Include="Game\Enums\CardPosition.cs" />
<Compile Include="Game\Enums\CardRace.cs" />
<Compile Include="Game\Enums\CardType.cs" />
<Compile Include="Game\Enums\Phase.cs" />
<Compile Include="Game\Enums\Query.cs" />
<Compile Include="Game\GameAI.cs" />
<Compile Include="Game\GameBehavior.cs" />
<Compile Include="Game\GameClient.cs" />
<Compile Include="Game\MainPhase.cs" />
<Compile Include="Game\MainPhaseAction.cs" />
<Compile Include="Game\Network\BinaryExtensions.cs" />
<Compile Include="Game\Network\Enums\CtosMessage.cs" />
<Compile Include="Game\Network\Enums\GameMessage.cs" />
<Compile Include="Game\Network\Enums\PlayerChange.cs" />
<Compile Include="Game\Network\Enums\StocMessage.cs" />
<Compile Include="Game\Network\GameClientPacket.cs" />
<Compile Include="Game\Network\GameConnection.cs" />
<Compile Include="Game\Network\GameServerPacket.cs" />
<Compile Include="Game\Room.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Decks\AI_Horus.ydk">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Decks\AI_OldSchool.ydk">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="sqlite3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindBot", "WindBot.csproj", "{3E7FAF67-A27D-4A61-B161-93AD4414183E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3E7FAF67-A27D-4A61-B161-93AD4414183E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E7FAF67-A27D-4A61-B161-93AD4414183E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E7FAF67-A27D-4A61-B161-93AD4414183E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E7FAF67-A27D-4A61-B161-93AD4414183E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
File added
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