mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Commander - added logic that AI can cast the commander.
This commit is contained in:
parent
7bcae07277
commit
cc35bbcf52
1 changed files with 15 additions and 0 deletions
|
@ -93,6 +93,7 @@ import mage.game.ExileZone;
|
|||
import mage.game.Game;
|
||||
import mage.game.Table;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.command.Commander;
|
||||
import mage.game.events.DamagePlayerEvent;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -1804,6 +1805,20 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
}
|
||||
}
|
||||
}
|
||||
// get cast commander if available
|
||||
if (!(this.getCommanderId() == null)) {
|
||||
Zone zone = game.getState().getZone(this.getCommanderId());
|
||||
if (zone != null && zone.equals(Zone.COMMAND)) {
|
||||
MageObject object = game.getObject(this.getCommanderId());
|
||||
if (object != null) {
|
||||
for (ActivatedAbility ability : ((Commander) object).getAbilities().getActivatedAbilities(Zone.COMMAND)) {
|
||||
if (canPlay(ability, available, game)) {
|
||||
playableActivated.put(ability.toString(), ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
playable.addAll(playableActivated.values());
|
||||
return playable;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue