mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Fixed a bug that caused mass boost / unboost of spells to be applied to wrong objects.
This commit is contained in:
parent
0bc6952933
commit
746c86363f
3 changed files with 20 additions and 6 deletions
|
@ -137,7 +137,9 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
targetPointer.init(game, source);
|
targetPointer.init(game, source);
|
||||||
//20100716 - 611.2c
|
//20100716 - 611.2c
|
||||||
if (AbilityType.ACTIVATED.equals(source.getAbilityType()) || AbilityType.TRIGGERED.equals(source.getAbilityType())) {
|
if (AbilityType.ACTIVATED.equals(source.getAbilityType())
|
||||||
|
|| AbilityType.SPELL.equals(source.getAbilityType())
|
||||||
|
|| AbilityType.TRIGGERED.equals(source.getAbilityType())) {
|
||||||
if (layer != null) {
|
if (layer != null) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case CopyEffects_1:
|
case CopyEffects_1:
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -123,13 +125,25 @@ public class BoostAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
if (this.affectedObjectsSet) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
for (Iterator<UUID> it = objects.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||||
|
UUID permanentId = it.next();
|
||||||
|
Permanent permanent = game.getPermanent(permanentId);
|
||||||
|
if (permanent != null) {
|
||||||
|
permanent.addPower(power.calculate(game, source, this));
|
||||||
|
permanent.addToughness(toughness.calculate(game, source, this));
|
||||||
|
} else {
|
||||||
|
it.remove(); // no longer on the battlefield, remove reference to object
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
perm.addPower(power.calculate(game, source, this));
|
perm.addPower(power.calculate(game, source, this));
|
||||||
perm.addToughness(toughness.calculate(game, source, this));
|
perm.addToughness(toughness.calculate(game, source, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
|
|
Loading…
Reference in a new issue