missed effects

This commit is contained in:
Loki 2010-10-15 09:49:32 +00:00
parent 7894cc4298
commit 8f9e574543
3 changed files with 311 additions and 230 deletions

View file

@ -45,6 +45,7 @@ import mage.game.permanent.Permanent;
public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilityControlledEffect> {
protected Ability ability;
protected boolean excludeSource;
protected FilterPermanent permanentFilter;
public GainAbilityControlledEffect(Ability ability, Duration duration) {
@ -52,15 +53,21 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilit
}
public GainAbilityControlledEffect(Ability ability, Duration duration, FilterPermanent filter) {
this(ability, duration, filter, false);
}
public GainAbilityControlledEffect(Ability ability, Duration duration, FilterPermanent filter, boolean excludeSource) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability;
this.permanentFilter = filter;
this.excludeSource = excludeSource;
}
public GainAbilityControlledEffect(final GainAbilityControlledEffect effect) {
super(effect);
this.ability = effect.ability.copy();
this.permanentFilter = effect.permanentFilter.copy();
this.excludeSource = effect.excludeSource;
}
@Override
@ -71,14 +78,18 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilit
@Override
public boolean apply(Game game, Ability source) {
for (Permanent perm: game.getBattlefield().getAllActivePermanents(permanentFilter, source.getControllerId())) {
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
perm.addAbility(ability.copy());
}
}
return true;
}
@Override
public String getText(Ability source) {
StringBuilder sb = new StringBuilder();
if (excludeSource)
sb.append("Other ");
sb.append(permanentFilter.getMessage()).append(" you control gain ").append(ability.getRule());
sb.append(" ").append(duration.toString());
return sb.toString();

View file

@ -0,0 +1,70 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.Constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author Loki
*/
public class UntapSourceEffect extends OneShotEffect<UntapSourceEffect> {
public UntapSourceEffect() {
super(Outcome.Untap);
}
public UntapSourceEffect(final UntapSourceEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.setTapped(false);
return true;
}
return false;
}
@Override
public UntapSourceEffect copy() {
return new UntapSourceEffect(this);
}
@Override
public String getText(Ability source) {
return "untap {this}";
}
}

View file

@ -115,7 +115,7 @@ public abstract class ExpansionSet implements Serializable {
directory = new File(fullPath);
try {
String jarPath = fullPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", "");
String jarPath = fullPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", "").replaceAll("%20", " ");
JarFile jarFile = new JarFile(jarPath);
Enumeration<JarEntry> entries = jarFile.entries();
while(entries.hasMoreElements()) {