mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
* BattleCry - Fixed that power boost did not last until end of turn.
This commit is contained in:
parent
6e4facfa8b
commit
df475d8049
5 changed files with 115 additions and 3 deletions
|
|
@ -137,7 +137,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
public void init(Ability source, Game game) {
|
||||
targetPointer.init(game, source);
|
||||
//20100716 - 611.2c
|
||||
if (source instanceof ActivatedAbility || source instanceof TriggeredAbility) {
|
||||
if (AbilityType.ACTIVATED.equals(source.getAbilityType()) || AbilityType.TRIGGERED.equals(source.getAbilityType())) {
|
||||
if (layer != null) {
|
||||
switch (layer) {
|
||||
case CopyEffects_1:
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@
|
|||
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -126,13 +130,25 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
||||
if (this.affectedObjectsSet) {
|
||||
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().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||
perm.addPower(power.calculate(game, source, this));
|
||||
perm.addToughness(toughness.calculate(game, source, this));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.constants.Duration;
|
|||
import mage.filter.common.FilterAttackingCreature;
|
||||
|
||||
public class BattleCryAbility extends AttacksTriggeredAbility {
|
||||
|
||||
public BattleCryAbility() {
|
||||
super(new BoostControlledEffect(1, 0, Duration.EndOfTurn, new FilterAttackingCreature(), true), false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue