mirror of
https://github.com/correl/mage.git
synced 2025-04-03 01:08:59 -09:00
Fixed LKI and change controller interaction. +1 test passed.
This commit is contained in:
parent
cf8fa2b773
commit
27d4997545
4 changed files with 15 additions and 4 deletions
Mage.Tests/src/test/java/org/mage/test
Mage/src/mage/abilities
|
@ -57,7 +57,10 @@ public class SorinLordOfInnistradTest extends CardTestPlayerBase {
|
|||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "-6: ", "Craw Wurm^Angel of Mercy");
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertPermanentCount(playerA, "Craw Wurm", 1);
|
||||
assertPermanentCount(playerA, "Angel of Mercy", 1);
|
||||
|
||||
assertLife(playerA, 23);
|
||||
assertLife(playerB, 20);
|
||||
assertPermanentCount(playerA, "Sorin, Lord of Innistrad", 0);
|
||||
|
|
|
@ -256,6 +256,9 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
||||
MageObject object = game.getObject(id);
|
||||
if (object != null && object.getName().equals(t)) {
|
||||
if (index >= ability.getTargets().size()) {
|
||||
index--;
|
||||
}
|
||||
if (ability.getTargets().get(index).getNumberOfTargets() == 1) {
|
||||
ability.getTargets().get(index).clearChosen();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import mage.cards.Card;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.Choices;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -458,8 +459,9 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
|||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, boolean checkLKI) {
|
||||
// try LKI first
|
||||
Permanent permanent = game.getPermanent(getSourceId());
|
||||
|
||||
// try LKI first
|
||||
if (checkLKI) {
|
||||
MageObject lkiTest = game.getLastKnownInformation(getSourceId(), zone);
|
||||
if (lkiTest != null) {
|
||||
|
|
|
@ -54,9 +54,12 @@ public class TriggeredAbilities extends HashMap<UUID, TriggeredAbility> {
|
|||
public void checkTriggers(GameEvent event, Game game) {
|
||||
for (TriggeredAbility ability: this.values()) {
|
||||
if (ability.isInUseableZone(game, true)) {
|
||||
MageObject object = game.getLastKnownInformation(ability.getSourceId(), event.getZone());
|
||||
MageObject object = game.getPermanent(ability.getSourceId());
|
||||
if (object == null) {
|
||||
object = game.getObject(ability.getSourceId());
|
||||
object = game.getLastKnownInformation(ability.getSourceId(), event.getZone());
|
||||
if (object == null) {
|
||||
object = game.getObject(ability.getSourceId());
|
||||
}
|
||||
}
|
||||
if (object != null && object.getAbilities().contains(ability)) {
|
||||
if (object instanceof Permanent) {
|
||||
|
|
Loading…
Add table
Reference in a new issue