* Fixed that equipments with restrictions (e.g. Gate Smasher) were not unequipped if the equipped permanent did no longer fulfill the restrictions(fixes #2212).

This commit is contained in:
LevelX2 2016-09-03 15:26:17 +02:00
parent 720a4457fd
commit ab2399cbe7
17 changed files with 234 additions and 59 deletions

View file

@ -625,13 +625,13 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean changeControllerId(UUID controllerId, Game game) {
Player newController = game.getPlayer(controllerId);
GameEvent loseControlEvent = GameEvent.getEvent(GameEvent.EventType.LOSE_CONTROL, this.getId(), null, controllerId);
if (game.replaceEvent(loseControlEvent)) {
return false;
}
if (newController != null && (!newController.hasLeft() || !newController.hasLost())) {
this.controllerId = controllerId;
return true;
@ -981,7 +981,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean hasProtectionFrom(MageObject source, Game game) {
for (ProtectionAbility ability : abilities.getProtectionAbilities()) {
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
if (!ability.canTarget(source, game)) {
return true;
}
@ -990,8 +990,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
@Override
public boolean cantBeEnchantedBy(MageObject source, Game game) {
for (ProtectionAbility ability : abilities.getProtectionAbilities()) {
public boolean cantBeAttachedBy(MageObject source, Game game) {
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
if (!(source.getSubtype(game).contains("Aura")
&& !ability.removesAuras())
&& !source.getId().equals(ability.getAuraIdNotToBeRemoved())