Commit cdb22dba authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/IceYGO/windbot

parents 6c890dd9 37c22985
{ {
"welcome": [ "welcome": [
"啊~~让我再睡一会嘛~", "啊~~让我再睡一会嘛~",
"你要加入公会吗?",
"AI功能正在测试中,遇到问题请及时反馈。" "AI功能正在测试中,遇到问题请及时反馈。"
], ],
"deckerror": [ "deckerror": [
...@@ -12,7 +13,7 @@ ...@@ -12,7 +13,7 @@
], ],
"newturn": [ "newturn": [
"我的回合,抽卡!", "我的回合,抽卡!",
"我抽了一张卡。" "魔力补充!"
], ],
"endturn": [ "endturn": [
"不想干活怎么办……", "不想干活怎么办……",
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
"快走开,我要回去睡觉了。", "快走开,我要回去睡觉了。",
], ],
"attack": [ "attack": [
"{0},攻击{1},我来为你加油!", "{0},攻击{1}!",
"{0},替我打倒{1}!" "{0},替我打倒{1}!"
], ],
"ondirectattack": [ "ondirectattack": [
...@@ -35,11 +36,10 @@ ...@@ -35,11 +36,10 @@
], ],
"facedownmonstername": "怪兽", "facedownmonstername": "怪兽",
"activate": [ "activate": [
"我发动{0}的效果。", "{0}的效果发动!"
"{0}效果发动。"
], ],
"summon": [ "summon": [
"我召唤{0}。", "召唤{0}!",
"出来吧,{0}!", "出来吧,{0}!",
"{0},来帮我一下。" "{0},来帮我一下。"
], ],
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
"……" "……"
], ],
"chaining": [ "chaining": [
"我使用{0}的力量。", "发动{0}!",
"等一下,我发动{0}。" "等一下,我发动{0}。",
"要不是有{0},我都快睡着了。"
] ]
} }
...@@ -324,12 +324,7 @@ namespace WindBot.Game.AI.Decks ...@@ -324,12 +324,7 @@ namespace WindBot.Game.AI.Decks
public int SelectSTPlace(ClientCard card=null, bool avoid_Impermanence = false) public int SelectSTPlace(ClientCard card=null, bool avoid_Impermanence = false)
{ {
List<int> list = new List<int>(); List<int> list = new List<int> { 0, 1, 2, 3, 4 };
list.Add(0);
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
int n = list.Count; int n = list.Count;
while (n-- > 1) while (n-- > 1)
{ {
......
...@@ -193,12 +193,7 @@ namespace WindBot.Game.AI.Decks ...@@ -193,12 +193,7 @@ namespace WindBot.Game.AI.Decks
public int SelectSTPlace() public int SelectSTPlace()
{ {
List<int> list = new List<int>(); List<int> list = new List<int> { 0, 1, 2, 3, 4 };
list.Add(0);
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
int n = list.Count; int n = list.Count;
while (n-- > 1) while (n-- > 1)
{ {
......
...@@ -88,6 +88,10 @@ namespace WindBot.Game.AI.Decks ...@@ -88,6 +88,10 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.RelinquishedAnima); AddExecutor(ExecutorType.Activate, CardId.RelinquishedAnima);
// counter & quick effect // counter & quick effect
AddExecutor(ExecutorType.Activate, CardId.Schmietta, DeckSSWitchcraft);
AddExecutor(ExecutorType.Activate, CardId.Pittore, DeckSSWitchcraft);
AddExecutor(ExecutorType.Activate, CardId.Potterie, DeckSSWitchcraft);
AddExecutor(ExecutorType.Activate, CardId.Genni, DeckSSWitchcraft);
AddExecutor(ExecutorType.Activate, CardId.PSYGamma, PSYGammaActivate); AddExecutor(ExecutorType.Activate, CardId.PSYGamma, PSYGammaActivate);
AddExecutor(ExecutorType.Activate, CardId.MaxxC, MaxxCActivate); AddExecutor(ExecutorType.Activate, CardId.MaxxC, MaxxCActivate);
AddExecutor(ExecutorType.Activate, CardId.GolemAruru, GolemAruruActivate); AddExecutor(ExecutorType.Activate, CardId.GolemAruru, GolemAruruActivate);
...@@ -132,10 +136,6 @@ namespace WindBot.Game.AI.Decks ...@@ -132,10 +136,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Patronus, PatronusActivate); AddExecutor(ExecutorType.Activate, CardId.Patronus, PatronusActivate);
AddExecutor(ExecutorType.Activate, CardId.MagiciansRestage, MagiciansRestageActivate); AddExecutor(ExecutorType.Activate, CardId.MagiciansRestage, MagiciansRestageActivate);
AddExecutor(ExecutorType.Activate, CardId.Holiday, HolidayActivate); AddExecutor(ExecutorType.Activate, CardId.Holiday, HolidayActivate);
AddExecutor(ExecutorType.Activate, CardId.Schmietta, DeckSSWitchcraft);
AddExecutor(ExecutorType.Activate, CardId.Pittore, DeckSSWitchcraft);
AddExecutor(ExecutorType.Activate, CardId.Potterie, DeckSSWitchcraft);
AddExecutor(ExecutorType.Activate, CardId.Genni, DeckSSWitchcraft);
// summon // summon
AddExecutor(ExecutorType.Summon, CardId.Schmietta, WitchcraftSummon); AddExecutor(ExecutorType.Summon, CardId.Schmietta, WitchcraftSummon);
...@@ -227,7 +227,7 @@ namespace WindBot.Game.AI.Decks ...@@ -227,7 +227,7 @@ namespace WindBot.Game.AI.Decks
// MagiciansLeftHand / MagicianRightHand // MagiciansLeftHand / MagicianRightHand
if (!MagicianRightHand_used && card.IsSpell() && card.Controller == 1) if (!MagicianRightHand_used && card.IsSpell() && card.Controller == 1)
{ {
if (Bot.MonsterZone.GetFirstMatchingCard(c => (c.Race & (int)CardRace.SpellCaster) != 0) != null if (Bot.MonsterZone.GetFirstMatchingCard(c => c.HasRace(CardRace.SpellCaster)) != null
&& Bot.HasInSpellZone(CardId.MagicianRightHand, true)) && Bot.HasInSpellZone(CardId.MagicianRightHand, true))
{ {
Logger.DebugWriteLine("MagicianRightHand negate: " + card.Name ?? "???"); Logger.DebugWriteLine("MagicianRightHand negate: " + card.Name ?? "???");
...@@ -236,7 +236,7 @@ namespace WindBot.Game.AI.Decks ...@@ -236,7 +236,7 @@ namespace WindBot.Game.AI.Decks
} }
if (!MagiciansLeftHand_used && card.IsTrap() && card.Controller == 1) if (!MagiciansLeftHand_used && card.IsTrap() && card.Controller == 1)
{ {
if (Bot.MonsterZone.GetFirstMatchingCard(c => (c.Race & (int)CardRace.SpellCaster) != 0) != null if (Bot.MonsterZone.GetFirstMatchingCard(c => c.HasRace(CardRace.SpellCaster)) != null
&& Bot.HasInSpellZone(CardId.MagiciansLeftHand, true)) && Bot.HasInSpellZone(CardId.MagiciansLeftHand, true))
{ {
Logger.DebugWriteLine("MagiciansLeftHand negate: " + card.Name ?? "???"); Logger.DebugWriteLine("MagiciansLeftHand negate: " + card.Name ?? "???");
...@@ -422,7 +422,8 @@ namespace WindBot.Game.AI.Decks ...@@ -422,7 +422,8 @@ namespace WindBot.Game.AI.Decks
{ {
return base.OnSelectPosition(cardId, positions); return base.OnSelectPosition(cardId, positions);
} }
if ((Duel.Player == 1 && (cardId == CardId.MadameVerre || if (!Enemy.HasInMonstersZone(_CardId.BlueEyesChaosMAXDragon)
&& (Duel.Player == 1 && (cardId == CardId.MadameVerre ||
Util.GetOneEnemyBetterThanValue(Data.Attack + 1) != null)) Util.GetOneEnemyBetterThanValue(Data.Attack + 1) != null))
|| cardId == CardId.MaxxC || cardId == CardId.AshBlossom_JoyousSpring) || cardId == CardId.MaxxC || cardId == CardId.AshBlossom_JoyousSpring)
{ {
...@@ -490,7 +491,7 @@ namespace WindBot.Game.AI.Decks ...@@ -490,7 +491,7 @@ namespace WindBot.Game.AI.Decks
int discardable_hands = 0; int discardable_hands = 0;
int count_witchcraftspell = Bot.Hand.GetMatchingCardsCount(card => (card.IsSpell() && (card.HasSetcode(Witchcraft_setcode)) && card != except)); int count_witchcraftspell = Bot.Hand.GetMatchingCardsCount(card => (card.IsSpell() && (card.HasSetcode(Witchcraft_setcode)) && card != except));
int count_remainhands = CheckRemainInDeck(CardId.MagiciansLeftHand, CardId.MagicianRightHand); int count_remainhands = CheckRemainInDeck(CardId.MagiciansLeftHand, CardId.MagicianRightHand);
int count_MagiciansRestage = Bot.Hand.GetCardCount(CardId.MagiciansRestage); int count_MagiciansRestage = Bot.Hand.GetMatchingCardsCount(card => card.Id == CardId.MagiciansRestage && card != except);
int count_MetalfoesFusion = Bot.Hand.GetCardCount(CardId.MetalfoesFusion); int count_MetalfoesFusion = Bot.Hand.GetCardCount(CardId.MetalfoesFusion);
int count_WitchcrafterBystreet = Bot.SpellZone.GetMatchingCardsCount(card => card.IsFaceup() && card.Id == CardId.WitchcrafterBystreet && !card.IsDisabled()); int count_WitchcrafterBystreet = Bot.SpellZone.GetMatchingCardsCount(card => card.IsFaceup() && card.Id == CardId.WitchcrafterBystreet && !card.IsDisabled());
if (count_MagiciansRestage > 0) if (count_MagiciansRestage > 0)
...@@ -859,12 +860,7 @@ namespace WindBot.Game.AI.Decks ...@@ -859,12 +860,7 @@ namespace WindBot.Game.AI.Decks
/// <param name="avoid_list">Whether need to avoid set in this place</param> /// <param name="avoid_list">Whether need to avoid set in this place</param>
public void SelectSTPlace(ClientCard card = null, bool avoid_Impermanence = false, List<int> avoid_list=null) public void SelectSTPlace(ClientCard card = null, bool avoid_Impermanence = false, List<int> avoid_list=null)
{ {
List<int> list = new List<int>(); List<int> list = new List<int> { 0, 1, 2, 3, 4 };
list.Add(0);
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
int n = list.Count; int n = list.Count;
while (n-- > 1) while (n-- > 1)
{ {
...@@ -890,6 +886,7 @@ namespace WindBot.Game.AI.Decks ...@@ -890,6 +886,7 @@ namespace WindBot.Game.AI.Decks
// Spell&trap's set // Spell&trap's set
public bool SpellSet(){ public bool SpellSet(){
if (Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster() && Duel.Turn > 1) return false; if (Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster() && Duel.Turn > 1) return false;
if (Card.Id == CardId.CrossoutDesignator && Duel.Turn >= 5) return false;
// set condition // set condition
int[] activate_with_condition = { CardId.Masterpiece, CardId.Draping }; int[] activate_with_condition = { CardId.Masterpiece, CardId.Draping };
...@@ -1118,7 +1115,14 @@ namespace WindBot.Game.AI.Decks ...@@ -1118,7 +1115,14 @@ namespace WindBot.Game.AI.Decks
if (SpellNegatable()) return false; if (SpellNegatable()) return false;
if (CheckDiscardableSpellCount() <= 1) return false; if (CheckDiscardableSpellCount() <= 1) return false;
if ((Card.Id == CardId.ThatGrassLooksGreener || Card.Id == CardId.Reasoning) && CheckWhetherWillbeRemoved()) return false; if ((Card.Id == CardId.ThatGrassLooksGreener || Card.Id == CardId.Reasoning) && CheckWhetherWillbeRemoved()) return false;
if (Card.Id == CardId.MagiciansLeftHand || Card.Id == CardId.MagicianRightHand)
{
if (Bot.MonsterZone.GetFirstMatchingCard(card => card.HasRace(CardRace.SpellCaster)) == null
&& (summoned || Bot.Hand.GetFirstMatchingCard(card => card.HasRace(CardRace.SpellCaster) && card.Level <= 4) == null))
{
return false;
}
}
SelectSTPlace(Card, true); SelectSTPlace(Card, true);
return true; return true;
} }
...@@ -1132,12 +1136,11 @@ namespace WindBot.Game.AI.Decks ...@@ -1132,12 +1136,11 @@ namespace WindBot.Game.AI.Decks
if ((Card.Id == CardId.ThatGrassLooksGreener || Card.Id == CardId.Reasoning) && CheckWhetherWillbeRemoved()) return false; if ((Card.Id == CardId.ThatGrassLooksGreener || Card.Id == CardId.Reasoning) && CheckWhetherWillbeRemoved()) return false;
if (Card.Id == CardId.MagiciansLeftHand || Card.Id == CardId.MagicianRightHand) if (Card.Id == CardId.MagiciansLeftHand || Card.Id == CardId.MagicianRightHand)
{ {
if (Bot.MonsterZone.GetFirstMatchingCard(card => (card.Race & (int)CardRace.SpellCaster) != 0) == null if (Bot.MonsterZone.GetFirstMatchingCard(card => card.HasRace(CardRace.SpellCaster)) == null
&& (summoned || Bot.Hand.GetFirstMatchingCard(card => (card.Race & (int)CardRace.SpellCaster) != 0) == null)) && (summoned || Bot.Hand.GetFirstMatchingCard(card => card.HasRace(CardRace.SpellCaster) && card.Level <= 4) == null))
{ {
return false; return false;
} }
} }
SelectSTPlace(Card, true); SelectSTPlace(Card, true);
return true; return true;
...@@ -1301,6 +1304,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1301,6 +1304,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectNextCard(CardId.Haine, CardId.MadameVerre, CardId.GolemAruru); AI.SelectNextCard(CardId.Haine, CardId.MadameVerre, CardId.GolemAruru);
} }
UseSSEffect.Add(Card.Id);
return true; return true;
} }
...@@ -1919,7 +1923,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1919,7 +1923,7 @@ namespace WindBot.Game.AI.Decks
int code = Util.GetLastChainCard().Id; int code = Util.GetLastChainCard().Id;
if (code == 0) return false; if (code == 0) return false;
if (CheckCalledbytheGrave(code) > 0 || CrossoutDesignatorTarget == code) return false; if (CheckCalledbytheGrave(code) > 0 || CrossoutDesignatorTarget == code) return false;
if (Enemy.Graveyard.GetFirstMatchingCard(card => card.IsMonster() && card.Id == code) != null) if (Enemy.Graveyard.GetFirstMatchingCard(card => card.IsMonster() && card.IsOriginalCode(code)) != null)
{ {
if (!(Card.Location == CardLocation.SpellZone)) if (!(Card.Location == CardLocation.SpellZone))
{ {
...@@ -2011,9 +2015,11 @@ namespace WindBot.Game.AI.Decks ...@@ -2011,9 +2015,11 @@ namespace WindBot.Game.AI.Decks
{ {
if (NegatedCheck(true) || CheckLastChainNegated()) return false; if (NegatedCheck(true) || CheckLastChainNegated()) return false;
// negate // negate
if (Duel.LastChainPlayer == 1) if (Duel.LastChainPlayer == 1 && Util.GetLastChainCard() != null)
{ {
int code = Util.GetLastChainCard().Id; int code = Util.GetLastChainCard().Id;
int alias = Util.GetLastChainCard().Alias;
if (alias != 0 && alias - code < 10) code = alias;
if (code == 0) return false; if (code == 0) return false;
if (CheckCalledbytheGrave(code) > 0 || CrossoutDesignatorTarget == code) return false; if (CheckCalledbytheGrave(code) > 0 || CrossoutDesignatorTarget == code) return false;
if (CheckRemainInDeck(code) > 0) if (CheckRemainInDeck(code) > 0)
...@@ -2065,7 +2071,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2065,7 +2071,7 @@ namespace WindBot.Game.AI.Decks
{ {
return false; return false;
} }
if (Bot.MonsterZone.GetFirstMatchingCard(card => (card.Race & (int)CardRace.SpellCaster) != 0) == null) if (Bot.MonsterZone.GetFirstMatchingCard(card => card.HasRace(CardRace.SpellCaster)) == null)
{ {
return false; return false;
} }
...@@ -2204,7 +2210,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2204,7 +2210,7 @@ namespace WindBot.Game.AI.Decks
// negate monsters // negate monsters
if ((LastChainCard == null || LastChainCard.Controller != 1 || LastChainCard.Location != CardLocation.MonsterZone if ((LastChainCard == null || LastChainCard.Controller != 1 || LastChainCard.Location != CardLocation.MonsterZone
|| LastChainCard.IsDisabled() || LastChainCard.IsShouldNotBeTarget() || LastChainCard.IsShouldNotBeSpellTrapTarget())) || CheckLastChainNegated() || LastChainCard.IsShouldNotBeTarget() || LastChainCard.IsShouldNotBeSpellTrapTarget()))
return false; return false;
if (Card.Location == CardLocation.SpellZone) if (Card.Location == CardLocation.SpellZone)
{ {
...@@ -2468,7 +2474,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2468,7 +2474,7 @@ namespace WindBot.Game.AI.Decks
// banish hands // banish hands
if (Card.Location == CardLocation.MonsterZone) if (Card.Location == CardLocation.MonsterZone)
{ {
if (Duel.Player == 1 || Bot.HasInMonstersZone(CardId.PSYLambda)) if (Duel.Player == 1 || Bot.HasInMonstersZone(CardId.PSYLambda) || (Util.IsChainTarget(Card)) )
{ {
return true; return true;
} else } else
......
...@@ -100,6 +100,12 @@ ...@@ -100,6 +100,12 @@
RedSupernovaDragon = 99585850, RedSupernovaDragon = 99585850,
NumberF0UtopicFutureDragon = 26973555, NumberF0UtopicFutureDragon = 26973555,
InvokedAugoeides = 97300502, InvokedAugoeides = 97300502,
DragonmaidStrahl = 24799107 DragonmaidStrahl = 24799107,
RavenousCrocodragonArchethys = 87188910,
AdamancipatorRisenRaptite = 73079836,
AdamancipatorRisenDragite = 9464441,
TeardroptheRikkaQueen = 33779875,
CeruleanSkyFire = 54828837,
SacredBeastAwakening = 53701259
} }
} }
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
HoarrGeneraiderBossofRumbling = 68199168, HoarrGeneraiderBossofRumbling = 68199168,
RedFamiliar = 8372133, RedFamiliar = 8372133,
AccesscodeTalker = 86066372, AccesscodeTalker = 86066372,
ChaosSummoningBeast = 27439792,
CosmoBrain = 85679527, CosmoBrain = 85679527,
ShiranuiSolitaire = 94801854, ShiranuiSolitaire = 94801854,
......
...@@ -251,6 +251,11 @@ namespace WindBot.Game ...@@ -251,6 +251,11 @@ namespace WindBot.Game
return (Attribute & (int)attribute) != 0; return (Attribute & (int)attribute) != 0;
} }
public bool HasRace(CardRace race)
{
return (Race & (int)race) != 0;
}
public bool HasSetcode(int setcode) public bool HasSetcode(int setcode)
{ {
if (Data == null) return false; if (Data == null) return false;
......
...@@ -522,14 +522,17 @@ namespace WindBot.Game ...@@ -522,14 +522,17 @@ namespace WindBot.Game
int final = _duel.Fields[player].LifePoints - packet.ReadInt32(); int final = _duel.Fields[player].LifePoints - packet.ReadInt32();
if (final < 0) final = 0; if (final < 0) final = 0;
if (_debug) if (_debug)
Logger.WriteLine("(" + player.ToString() + " got damage , LifePoint left= " + final.ToString() + ")"); Logger.WriteLine("(" + player.ToString() + " got damage , LifePoint left = " + final.ToString() + ")");
_duel.Fields[player].LifePoints = final; _duel.Fields[player].LifePoints = final;
} }
private void OnRecover(BinaryReader packet) private void OnRecover(BinaryReader packet)
{ {
int player = GetLocalPlayer(packet.ReadByte()); int player = GetLocalPlayer(packet.ReadByte());
_duel.Fields[player].LifePoints += packet.ReadInt32(); int final = _duel.Fields[player].LifePoints + packet.ReadInt32();
if (_debug)
Logger.WriteLine("(" + player.ToString() + " got healed , LifePoint left = " + final.ToString() + ")");
_duel.Fields[player].LifePoints = final;
} }
private void OnLpUpdate(BinaryReader packet) private void OnLpUpdate(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