Fixed GainAbilityAllEffect not working for controlled permanents. Fixed FiresOfYavimaya.

This commit is contained in:
magenoxx 2011-09-22 17:34:31 +04:00
parent ae159557af
commit 1397534a1c
2 changed files with 12 additions and 7 deletions

View file

@ -45,12 +45,16 @@ import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
* @author Loki, nantuko
*/
public class FiresOfYavimaya extends CardImpl<FiresOfYavimaya> {
private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Creatures you control");
static {
filter.setTargetController(Constants.TargetController.YOU);
}
public FiresOfYavimaya(UUID ownerId) {
super(ownerId, 87, "Fires of Yavimaya", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{G}");
this.expansionSetCode = "HOP";

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
/**
*
@ -75,11 +76,11 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl<GainAbilityAllEff
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter)) {
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
objects.add(perm.getId());
}
}
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
objects.add(perm.getId());
}
}
}
}
@ -90,7 +91,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl<GainAbilityAllEff
@Override
public boolean apply(Game game, Ability source) {
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter)) {
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) {
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
perm.addAbility(ability);