Commit d5d933e3 authored by mercury233's avatar mercury233

fix atk 0 monster attack

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