Commit d5d933e3 authored by mercury233's avatar mercury233

fix atk 0 monster attack

parent 605c2839
...@@ -231,11 +231,6 @@ namespace WindBot.Game.AI.Decks ...@@ -231,11 +231,6 @@ namespace WindBot.Game.AI.Decks
return null; return null;
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
return attacker.Attack > 0 && base.OnPreBattleBetween(attacker, defender);
}
private bool DragonShrineEffect() private bool DragonShrineEffect()
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
......
...@@ -33,10 +33,5 @@ namespace WindBot.Game.AI.Decks ...@@ -33,10 +33,5 @@ namespace WindBot.Game.AI.Decks
else else
return base.OnRockPaperScissors(); return base.OnRockPaperScissors();
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
return attacker.Attack > 0 && base.OnPreBattleBetween(attacker, defender);
}
} }
} }
\ No newline at end of file
...@@ -50,6 +50,8 @@ namespace WindBot.Game.AI ...@@ -50,6 +50,8 @@ namespace WindBot.Game.AI
/// <returns>true if the attack can be done.</returns> /// <returns>true if the attack can be done.</returns>
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (attacker.RealPower <= 0)
return false;
if (!attacker.IsMonsterHasPreventActivationEffectInBattle()) if (!attacker.IsMonsterHasPreventActivationEffectInBattle())
{ {
......
...@@ -62,32 +62,41 @@ namespace WindBot.Game.AI ...@@ -62,32 +62,41 @@ namespace WindBot.Game.AI
return AI.ToMainPhase2(); return AI.ToMainPhase2();
if (defenders.Count == 0) if (defenders.Count == 0)
return AI.Attack(attackers[0], null);
for (int i = defenders.Count - 1; i >= 0; --i)
{ {
ClientCard defender = defenders[i]; for (int i = attackers.Count - 1; i >= 0; --i)
for (int j = 0; j < attackers.Count; ++j)
{ {
ClientCard attacker = attackers[j]; ClientCard attacker = attackers[i];
attacker.RealPower = attacker.Attack; if (attacker.Attack > 0)
defender.RealPower = defender.GetDefensePower(); return AI.Attack(attacker, null);
if (!OnPreBattleBetween(attacker, defender))
continue;
if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && j == attackers.Count - 1))
return AI.Attack(attacker, defender);
} }
} }
else
for (int i = attackers.Count - 1; i >= 0; --i)
{ {
ClientCard attacker = attackers[i]; for (int i = defenders.Count - 1; i >= 0; --i)
if (attacker.CanDirectAttack) {
return AI.Attack(attacker, null); ClientCard defender = defenders[i];
for (int j = 0; j < attackers.Count; ++j)
{
ClientCard attacker = attackers[j];
attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender))
continue;
if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && j == attackers.Count - 1))
return AI.Attack(attacker, defender);
}
}
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.CanDirectAttack)
return AI.Attack(attacker, null);
}
} }
if (!Battle.CanMainPhaseTwo) if (!Battle.CanMainPhaseTwo)
return AI.Attack(attackers[attackers.Count - 1], defenders[0]); return AI.Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]);
return AI.ToMainPhase2(); return AI.ToMainPhase2();
} }
......
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