Commit 25923ed1 authored by mercury233's avatar mercury233

change Duel.LifePoints[0] to Bot.LifePoints

parent 23ca5d1b
......@@ -855,7 +855,7 @@ namespace WindBot.Game.AI.Decks
int space = 5 - Bot.GetMonstersInMainZone().Count;
if (count < space)
count = space;
if (count < 2 || Duel.LifePoints[0] < count*1000)
if (count < 2 || Bot.LifePoints < count*1000)
return false;
if (Duel.Turn != 1)
{
......@@ -872,7 +872,7 @@ namespace WindBot.Game.AI.Decks
{
defence += monster.GetDefensePower();
}
if (attack - defence > Duel.LifePoints[1])
if (attack - defence > Enemy.LifePoints)
return false;
}
AI.SelectCard(new[]
......
......@@ -90,7 +90,7 @@ namespace WindBot.Game.AI.Decks
private bool SupremacyBerry()
{
return Duel.LifePoints[0] < Duel.LifePoints[1];
return Bot.LifePoints < Enemy.LifePoints;
}
private bool PoisonOfTheOldMan()
......
......@@ -161,7 +161,7 @@ namespace WindBot.Game.AI.Decks
private bool SkillDrainEffect()
{
return (Duel.LifePoints[0] > 1000) && DefaultUniqueTrap();
return (Bot.LifePoints > 1000) && DefaultUniqueTrap();
}
private bool PotOfDualityEffect()
......@@ -315,7 +315,7 @@ namespace WindBot.Game.AI.Decks
{
AI.SelectCard(HighScaleCards);
}
return Duel.LifePoints[0] > 800;
return Bot.LifePoints > 800;
}
private bool StealthEffect()
......
......@@ -267,7 +267,7 @@ namespace WindBot.Game.AI.Decks
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800)
if (Enemy.LifePoints <= 800)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
......
......@@ -117,7 +117,7 @@ namespace WindBot.Game.AI.Decks
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Id == CardId.SkyCavalryCentaurea && !attacker.IsDisabled() && attacker.HasXyzMaterial())
attacker.RealPower = Duel.LifePoints[0] + attacker.Attack;
attacker.RealPower = Bot.LifePoints + attacker.Attack;
}
return base.OnPreBattleBetween(attacker, defender);
}
......@@ -506,7 +506,7 @@ namespace WindBot.Game.AI.Decks
{
defence += monster.GetDefensePower();
}
if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsOneEnemyBetter(true))
if (attack - 2000 - defence > Enemy.LifePoints && !AI.Utils.IsOneEnemyBetter(true))
return true;
}
return false;
......
......@@ -326,7 +326,7 @@ namespace WindBot.Game.AI.Decks
{
if (m.IsAttack() && !m.Attacked) total_atk += m.Attack;
}
if (total_atk >= Duel.LifePoints[0]) return true;
if (total_atk >= Bot.LifePoints) return true;
}
return false;
}
......@@ -349,7 +349,7 @@ namespace WindBot.Game.AI.Decks
stage_locked = null;
return true;
}
else if (Duel.LifePoints[1] <= 1000 && !pink_ss)
else if (Enemy.LifePoints <= 1000 && !pink_ss)
{
AI.SelectCard(new[]
{
......@@ -415,7 +415,7 @@ namespace WindBot.Game.AI.Decks
stage_locked = null;
return true;
}
else if (Duel.LifePoints[1] <= 1000 && !pink_ss)
else if (Enemy.LifePoints <= 1000 && !pink_ss)
{
AI.SelectCard(new[]
{
......@@ -487,15 +487,15 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if ((Duel.LifePoints[1] <= 1000 && Bot.HasInSpellZone(CardId.Stage))
|| Duel.LifePoints[1] <= 800
if ((Enemy.LifePoints <= 1000 && Bot.HasInSpellZone(CardId.Stage))
|| Enemy.LifePoints <= 800
|| (!NormalSummoned && Bot.HasInGraveyard(CardId.Red))
)
{
pink_ss = true;
return true;
}
else if (Enemy.GetMonsterCount() > 0 && (AI.Utils.GetBestEnemyMonster().Attack - 800 >= Duel.LifePoints[0])) return false;
else if (Enemy.GetMonsterCount() > 0 && (AI.Utils.GetBestEnemyMonster().Attack - 800 >= Bot.LifePoints)) return false;
pink_ss = true;
return true;
}
......@@ -692,7 +692,7 @@ namespace WindBot.Game.AI.Decks
CardId.Yellow
});
}
else if (Bot.GetRemainingCount(CardId.White, 2) > 0 && Duel.LifePoints[1] <= 4000)
else if (Bot.GetRemainingCount(CardId.White, 2) > 0 && Enemy.LifePoints <= 4000)
{
AI.SelectCard(new[]
{
......@@ -884,7 +884,7 @@ namespace WindBot.Game.AI.Decks
{
if (hand.IsMonster() && IsTrickstar(hand.Id))
{
if (hand.Attack >= Duel.LifePoints[1]) return true;
if (hand.Attack >= Enemy.LifePoints) return true;
if (hand.Id != CardId.Yellow)
{
if (AI.Utils.GetOneEnemyBetterThanValue(hand.Attack, false) == null) return true;
......@@ -938,7 +938,7 @@ namespace WindBot.Game.AI.Decks
public bool Red_sum()
{
if ((Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1800) || (Duel.Turn == 1 && Bot.HasInHand(CardId.Re)))
if ((Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1800) || (Duel.Turn == 1 && Bot.HasInHand(CardId.Re)))
{
NormalSummoned = true;
return true;
......@@ -948,7 +948,7 @@ namespace WindBot.Game.AI.Decks
public bool Pink_sum()
{
if (Duel.LifePoints[1] <= 1000)
if (Enemy.LifePoints <= 1000)
{
NormalSummoned = true;
return true;
......@@ -1086,7 +1086,7 @@ namespace WindBot.Game.AI.Decks
ClientCard m = AI.Utils.GetProblematicEnemyMonster();
if (m == null)
{
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1100 && Duel.Phase < DuelPhase.Battle)
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1100 && Duel.Phase < DuelPhase.Battle)
{
IList<ClientCard> list = new List<ClientCard>();
foreach(ClientCard monster in Bot.GetMonsters())
......@@ -1123,7 +1123,7 @@ namespace WindBot.Game.AI.Decks
ClientCard m = AI.Utils.GetProblematicEnemySpell();
if (m == null)
{
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1900 && Duel.Phase == DuelPhase.Main1)
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1900 && Duel.Phase == DuelPhase.Main1)
{
IList<ClientCard> m_list = new List<ClientCard>();
foreach(ClientCard monster in Bot.GetMonsters())
......@@ -1172,7 +1172,7 @@ namespace WindBot.Game.AI.Decks
int link_count = 0;
if (m == null)
{
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 2200 && Duel.Phase == DuelPhase.Main1)
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 2200 && Duel.Phase == DuelPhase.Main1)
{
IList<ClientCard> m_list = new List<ClientCard>();
foreach(ClientCard monster in Bot.GetMonsters())
......@@ -1239,7 +1239,7 @@ namespace WindBot.Game.AI.Decks
}
if (targets.Count >= 4)
{
if (Duel.LifePoints[1] <= GetTotalATK(targets) && Enemy.GetMonsterCount() == 0) return false;
if (Enemy.LifePoints <= GetTotalATK(targets) && Enemy.GetMonsterCount() == 0) return false;
AI.SelectMaterials(targets);
AI.SelectYesNo(true);
snake_four_s = true;
......@@ -1315,7 +1315,7 @@ namespace WindBot.Game.AI.Decks
{
bool already_link2 = false;
IList<ClientCard> material_list = new List<ClientCard>();
if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Duel.LifePoints[1] <= 3000))
if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000))
{
foreach(ClientCard e_m in Bot.GetMonstersInExtraZone())
{
......@@ -1342,7 +1342,7 @@ namespace WindBot.Game.AI.Decks
}
if ((already_link2 && material_list.Count == 3) || (!already_link2 && material_list.Count == 4))
{
if (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Duel.LifePoints[1] <= 3000)
if (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000)
{
if (GetTotalATK(material_list) >= 3000) return false;
}
......
......@@ -291,7 +291,7 @@ namespace WindBot.Game.AI.Decks
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800 || (Bot.GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600))
if (Enemy.LifePoints <= 800 || (Bot.GetMonsterCount()>=4 && Enemy.LifePoints <= 1600))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
......
......@@ -184,7 +184,7 @@ namespace WindBot.Game.AI.Decks
private bool InstantFusion()
{
if (Duel.LifePoints[0] <= 1000)
if (Bot.LifePoints <= 1000)
return false;
int count4 = 0;
int count5 = 0;
......@@ -210,7 +210,7 @@ namespace WindBot.Game.AI.Decks
private bool XyzChangeTactics()
{
return Duel.LifePoints[0] > 500;
return Bot.LifePoints > 500;
}
private bool NumberS39UtopiatheLightning()
......
......@@ -131,7 +131,7 @@ namespace WindBot.Game.AI
foreach (ClientCard card in CurrentChain)
if (card.Id == _CardId.CosmicCyclone)
return false;
return (Duel.LifePoints[0] > 1000) && DefaultMysticalSpaceTyphoon();
return (Bot.LifePoints > 1000) && DefaultMysticalSpaceTyphoon();
}
/// <summary>
......@@ -255,7 +255,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultSolemnWarning()
{
return (Duel.LifePoints[0] > 2000) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
return (Bot.LifePoints > 2000) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
}
/// <summary>
......@@ -263,7 +263,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultSolemnStrike()
{
return (Duel.LifePoints[0] > 1500) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
return (Bot.LifePoints > 1500) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
}
/// <summary>
......@@ -450,11 +450,11 @@ namespace WindBot.Game.AI
if (exec.Type == Type && exec.CardId == Card.Id)
count++;
}
if (count > 1 || Duel.LifePoints[0] <= 1000)
if (count > 1 || Bot.LifePoints <= 1000)
return false;
if (Duel.LifePoints[0] <= Duel.LifePoints[1] && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 0))
if (Bot.LifePoints <= Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 0))
return true;
if (Duel.LifePoints[0] > Duel.LifePoints[1] && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 1))
if (Bot.LifePoints > Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 1))
return true;
return false;
}
......
......@@ -13,6 +13,8 @@ namespace WindBot.Game
public IList<ClientCard> Deck { get; private set; }
public IList<ClientCard> ExtraDeck { get; private set; }
public int LifePoints;
public ClientField()
{
}
......
......@@ -8,7 +8,6 @@ namespace WindBot.Game
public bool IsFirst { get; set; }
public bool IsNewRule { get; set; }
public int[] LifePoints { get; private set; }
public ClientField[] Fields { get; private set; }
public int Turn { get; set; }
......@@ -21,7 +20,6 @@ namespace WindBot.Game
public Duel()
{
LifePoints = new int[2];
Fields = new ClientField[2];
Fields[0] = new ClientField();
Fields[1] = new ClientField();
......
......@@ -324,8 +324,8 @@ namespace WindBot.Game
int type = packet.ReadByte();
_duel.IsFirst = (type & 0xF) == 0;
_duel.Turn = 0;
_duel.LifePoints[GetLocalPlayer(0)] = packet.ReadInt32();
_duel.LifePoints[GetLocalPlayer(1)] = packet.ReadInt32();
_duel.Fields[GetLocalPlayer(0)].LifePoints = packet.ReadInt32();
_duel.Fields[GetLocalPlayer(1)].LifePoints = packet.ReadInt32();
int deck = packet.ReadInt16();
int extra = packet.ReadInt16();
_duel.Fields[GetLocalPlayer(0)].Init(deck, extra);
......@@ -427,21 +427,21 @@ namespace WindBot.Game
private void OnDamage(BinaryReader packet)
{
int player = GetLocalPlayer(packet.ReadByte());
int final = _duel.LifePoints[player] - packet.ReadInt32();
int final = _duel.Fields[player].LifePoints - packet.ReadInt32();
if (final < 0) final = 0;
_duel.LifePoints[player] = final;
_duel.Fields[player].LifePoints = final;
}
private void OnRecover(BinaryReader packet)
{
int player = GetLocalPlayer(packet.ReadByte());
_duel.LifePoints[player] += packet.ReadInt32();
_duel.Fields[player].LifePoints += packet.ReadInt32();
}
private void OnLpUpdate(BinaryReader packet)
{
int player = GetLocalPlayer(packet.ReadByte());
_duel.LifePoints[player] = packet.ReadInt32();
_duel.Fields[player].LifePoints = packet.ReadInt32();
}
private void OnMove(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