mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Merge pull request #4450 from BenDawes/bugfix/becomesCreateAllEffectSetCalculation
Fix becomesCreatureAllEffect set calculation
This commit is contained in:
commit
afaa1149e7
1 changed files with 23 additions and 1 deletions
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
|
|
@ -40,6 +41,9 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*
|
||||
|
|
@ -64,6 +68,16 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
this.filter = effect.filter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (this.affectedObjectsSet) {
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
affectedObjectList.add(new MageObjectReference(perm, game));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesCreatureAllEffect copy() {
|
||||
return new BecomesCreatureAllEffect(this);
|
||||
|
|
@ -71,7 +85,15 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
Set<Permanent> affectedPermanents = new HashSet<>();
|
||||
if (this.affectedObjectsSet) {
|
||||
for(MageObjectReference ref : affectedObjectList) {
|
||||
affectedPermanents.add(ref.getPermanent(game));
|
||||
}
|
||||
} else {
|
||||
affectedPermanents = new HashSet<>(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game));
|
||||
}
|
||||
for(Permanent permanent : affectedPermanents) {
|
||||
if (permanent != null) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue