1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-10 09:11:04 -09:00

- Attempt to fix the AI attacking with your creatures. Small enchancements to AI attacking.

This commit is contained in:
jeffwadsworth 2012-11-08 11:57:13 -06:00
parent 8942a2a00b
commit 8dcfead462
2 changed files with 6 additions and 3 deletions
Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai
Mage/src/mage/players

View file

@ -1099,7 +1099,10 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|| blocker.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId()) || blocker.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId())
|| blocker.getAbilities().contains(new ExaltedAbility()) || blocker.getAbilities().contains(new ExaltedAbility())
|| blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId()) || blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())
|| blocker.getAbilities().contains(new IndestructibleAbility())) { || blocker.getAbilities().contains(new IndestructibleAbility())
|| !attacker.getAbilities().containsKey(FirstStrikeAbility.getInstance().getId())
|| !attacker.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId())
|| !attacker.getAbilities().contains(new ExaltedAbility())) {
safeToAttack = false; safeToAttack = false;
} }
} }

View file

@ -1111,7 +1111,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
@Override @Override
public void declareAttacker(UUID attackerId, UUID defenderId, Game game) { public void declareAttacker(UUID attackerId, UUID defenderId, Game game) {
Permanent attacker = game.getPermanent(attackerId); Permanent attacker = game.getPermanent(attackerId);
if (attacker != null && attacker.canAttack(game)) { if (attacker != null && attacker.canAttack(game) && attacker.getControllerId().equals(playerId)) {
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, defenderId, attackerId, playerId))) { if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, defenderId, attackerId, playerId))) {
game.getCombat().declareAttacker(attackerId, defenderId, game); game.getCombat().declareAttacker(attackerId, defenderId, game);
} }
@ -1122,7 +1122,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
public void declareBlocker(UUID blockerId, UUID attackerId, Game game) { public void declareBlocker(UUID blockerId, UUID attackerId, Game game) {
Permanent blocker = game.getPermanent(blockerId); Permanent blocker = game.getPermanent(blockerId);
CombatGroup group = game.getCombat().findGroup(attackerId); CombatGroup group = game.getCombat().findGroup(attackerId);
if (blocker != null && group != null && group.canBlock(blocker, game)) { if (blocker != null && group != null && group.canBlock(blocker, game) && blocker.getControllerId().equals(playerId)) {
group.addBlocker(blockerId, playerId, game); group.addBlocker(blockerId, playerId, game);
game.getCombat().addBlockingGroup(blockerId, attackerId, playerId, game); game.getCombat().addBlockingGroup(blockerId, attackerId, playerId, game);
} }