Skip to content

Commit

Permalink
Merge pull request IceYGO#12 from IceYGO/master
Browse files Browse the repository at this point in the history
merged
  • Loading branch information
OhnkytaBlabdey authored Jul 13, 2018
2 parents 1333cb8 + 3601861 commit 462c4c4
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 15 deletions.
5 changes: 5 additions & 0 deletions BotWrapper/bot.conf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ Name=奇異果 Deck=LightswornShaddoldinosour Dialog=kiwi.zh-TW
光道影依恐龙卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE

!奇魔果
Name=奇魔果 Deck=DarkMagician Dialog=kiwi.zh-TW
黑魔术师卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE

!燃血鬥士
Name=燃血鬥士 Deck=ChainBurn Dialog=kiwi.zh-TW
连锁烧卡组。
Expand Down
15 changes: 9 additions & 6 deletions Decks/AI_ChainBurn.ydk
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#created by ...
#main
33015627
33015627
33015627
7733560
7733560
7733560
41386308
3549275
45812361
Expand Down Expand Up @@ -50,19 +56,16 @@
75249652
75249652
83555666
98444741
#extra
41999284
41999284
41999284
!side
33508719
36468556
67095270
67095270
67095270
98444741
100227025
100227025
100227025
36468556
98444741
98444741
98444741
4 changes: 2 additions & 2 deletions Game/AI/Decks/ChainBurnExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class ChainBurnExecutor : DefaultExecutor
{
public class CardId
{
public const int SandaionTheTimelord = 100227025;
public const int MichionTimelord = 100227021;
public const int SandaionTheTimelord = 33015627;
public const int MichionTimelord = 7733560;
public const int Mathematician = 41386308;
public const int DiceJar = 3549275;
public const int CardcarD = 45812361;
Expand Down
46 changes: 43 additions & 3 deletions Game/GameBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private void RegisterPackets()
_messages.Add(GameMessage.ShuffleDeck, OnShuffleDeck);
_messages.Add(GameMessage.ShuffleHand, OnShuffleHand);
_messages.Add(GameMessage.ShuffleExtra, OnShuffleExtra);
_messages.Add(GameMessage.ShuffleSetCard, OnShuffleSetCard);
_messages.Add(GameMessage.TagSwap, OnTagSwap);
_messages.Add(GameMessage.NewTurn, OnNewTurn);
_messages.Add(GameMessage.NewPhase, OnNewPhase);
Expand All @@ -109,7 +110,7 @@ private void RegisterPackets()
_messages.Add(GameMessage.BecomeTarget, OnBecomeTarget);
_messages.Add(GameMessage.SelectBattleCmd, OnSelectBattleCmd);
_messages.Add(GameMessage.SelectCard, OnSelectCard);
_messages.Add(GameMessage.SelectUnselectCard, OnSelectUnselectCard);
_messages.Add(GameMessage.SelectUnselect, OnSelectUnselectCard);
_messages.Add(GameMessage.SelectChain, OnSelectChain);
_messages.Add(GameMessage.SelectCounter, OnSelectCounter);
_messages.Add(GameMessage.SelectDisfield, OnSelectDisfield);
Expand Down Expand Up @@ -389,6 +390,35 @@ private void OnShuffleExtra(BinaryReader packet)
}
}

private void OnShuffleSetCard(BinaryReader packet)
{
int location = packet.ReadByte();
int count = packet.ReadByte();
ClientCard[] list = new ClientCard[5];
for (int i = 0; i < count; ++i)
{
int player = GetLocalPlayer(packet.ReadByte());
int loc = packet.ReadByte();
int seq = packet.ReadByte();
/*int sseq = */packet.ReadByte();
ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq);
if (card == null) continue;
list[i] = card;
card.SetId(0);
}
for (int i = 0; i < count; ++i)
{
int player = GetLocalPlayer(packet.ReadByte());
int loc = packet.ReadByte();
int seq = packet.ReadByte();
/*int sseq = */packet.ReadByte();
ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq);
if (card == null) continue;
ClientCard[] zone = (loc == (int)CardLocation.MonsterZone) ? _duel.Fields[player].MonsterZone : _duel.Fields[player].SpellZone;
zone[seq] = list[i];
}
}

private void OnTagSwap(BinaryReader packet)
{
int player = GetLocalPlayer(packet.ReadByte());
Expand Down Expand Up @@ -433,8 +463,18 @@ private void OnNewPhase(BinaryReader packet)
{
Logger.WriteLine(card.Name);
}
Logger.WriteLine("*********Bot Hand*********");
}
Logger.WriteLine("*********Bot Spell*********");
foreach (ClientCard card in _duel.Fields[0].SpellZone)
{
Logger.WriteLine(card?.Name);
}
Logger.WriteLine("*********Bot Monster*********");
foreach (ClientCard card in _duel.Fields[0].MonsterZone)
{
Logger.WriteLine(card?.Name);
}
Logger.WriteLine("*********Finish*********");
}
if (_debug)
Logger.WriteLine("(Go to " + (_duel.Phase.ToString()) + ")");
_duel.LastSummonPlayer = -1;
Expand Down
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ The version of YGOPro.
`Hand`
If you are testing deck, you may want to make sure the bot go first or second. `Hand=1` will make the bot always show Scissors, 2 for Rock, 3 for Paper.

`Chat`
False to turn the chat of bot off.

`Debug`
Print verbose log of card movement info. False at default. (May be updated in future)

`ServerMode` and `ServerPort`
WindBot can run as a "server", provide a http interface to create bot.

Expand All @@ -61,6 +67,10 @@ WindBot can run as a "server", provide a http interface to create bot.

* Blue-Eyes

* ChainBurn

* DarkMagician

* Dragunity

* Qliphort
Expand All @@ -69,6 +79,8 @@ WindBot can run as a "server", provide a http interface to create bot.

* Rank V

* SkyStriker

* ST1732

* Toadally Awesome (old lflist, master rule 3 only)
Expand All @@ -85,8 +97,6 @@ WindBot can run as a "server", provide a http interface to create bot.

* Blackwing

* ChainBurn

* CyberDragon

* Evilswarm
Expand Down Expand Up @@ -117,6 +127,23 @@ The parameters are same as commandlines, but low cased.

### Changelog

#### v0x1344 (2018-06-05)

- Update YGOPro protrol to 0x1344
- New decks: DarkMagician, SkyStriker
- Add param to turn chat off
- Add param to print verbose log
- Add part of `Zones` enum and `AI.SelectPlace`
- Add `ClientCard.IsTuner`, `ClientCard.LinkMarker`, `ClientCard.HasLinkMarker`
- Add `ShouldNotBeTarget` and `ShouldBeDisabledBeforeItUseEffectMonster` enum
- Add `AI.Utils.GetBestBotMonster`, `AI.Utils.GetWorstBotMonster` and `AI.Utils.ChainContainPlayer`
- Add `Executor.OnCardSorting` and `Executor.OnDraw`
- Add `ClientField.GetColumnCount` and `ClientField.HasInHandOrInSpellZone` etc.
- Misc updates to LightswornShaddoldinosour and ChainBurn deck
- Misc updates to default executors
- Fix OnSelectUnselectCard
- Fix OnMove to keep card data when moving

#### v0x1343 (2018-04-11)

- Update YGOPro protrol to 0x1343
Expand Down Expand Up @@ -185,7 +212,7 @@ The parameters are same as commandlines, but low cased.

* Documents for creating AI

* `AI.SelectZone`
* `AI.SelectPlace` for linked zones or not linked zones

* `AI.SelectTribute`

Expand Down
2 changes: 1 addition & 1 deletion WindBotInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public WindBotInfo()
Host = "127.0.0.1";
Port = 7911;
HostInfo = "";
Version = 0x1343;
Version = 0x1344;
Hand = 0;
Debug = false;
Chat = true;
Expand Down
Binary file modified YGOSharp.Network.dll
Binary file not shown.
Binary file modified YGOSharp.OCGWrapper.Enums.dll
Binary file not shown.
Binary file modified YGOSharp.OCGWrapper.dll
Binary file not shown.

0 comments on commit 462c4c4

Please sign in to comment.