mirror of
https://github.com/correl/mage.git
synced 2025-01-13 11:01:58 +00:00
missed effects
This commit is contained in:
parent
7894cc4298
commit
8f9e574543
3 changed files with 311 additions and 230 deletions
|
@ -45,6 +45,7 @@ import mage.game.permanent.Permanent;
|
||||||
public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilityControlledEffect> {
|
public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilityControlledEffect> {
|
||||||
|
|
||||||
protected Ability ability;
|
protected Ability ability;
|
||||||
|
protected boolean excludeSource;
|
||||||
protected FilterPermanent permanentFilter;
|
protected FilterPermanent permanentFilter;
|
||||||
|
|
||||||
public GainAbilityControlledEffect(Ability ability, Duration duration) {
|
public GainAbilityControlledEffect(Ability ability, Duration duration) {
|
||||||
|
@ -52,15 +53,21 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilit
|
||||||
}
|
}
|
||||||
|
|
||||||
public GainAbilityControlledEffect(Ability ability, Duration duration, FilterPermanent filter) {
|
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);
|
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
this.permanentFilter = filter;
|
this.permanentFilter = filter;
|
||||||
|
this.excludeSource = excludeSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GainAbilityControlledEffect(final GainAbilityControlledEffect effect) {
|
public GainAbilityControlledEffect(final GainAbilityControlledEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.ability = effect.ability.copy();
|
this.ability = effect.ability.copy();
|
||||||
this.permanentFilter = effect.permanentFilter.copy();
|
this.permanentFilter = effect.permanentFilter.copy();
|
||||||
|
this.excludeSource = effect.excludeSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,14 +78,18 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilit
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(permanentFilter, source.getControllerId())) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(permanentFilter, source.getControllerId())) {
|
||||||
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
perm.addAbility(ability.copy());
|
perm.addAbility(ability.copy());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Ability source) {
|
public String getText(Ability source) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if (excludeSource)
|
||||||
|
sb.append("Other ");
|
||||||
sb.append(permanentFilter.getMessage()).append(" you control gain ").append(ability.getRule());
|
sb.append(permanentFilter.getMessage()).append(" you control gain ").append(ability.getRule());
|
||||||
sb.append(" ").append(duration.toString());
|
sb.append(" ").append(duration.toString());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
|
@ -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}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -115,7 +115,7 @@ public abstract class ExpansionSet implements Serializable {
|
||||||
directory = new File(fullPath);
|
directory = new File(fullPath);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String jarPath = fullPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", "");
|
String jarPath = fullPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", "").replaceAll("%20", " ");
|
||||||
JarFile jarFile = new JarFile(jarPath);
|
JarFile jarFile = new JarFile(jarPath);
|
||||||
Enumeration<JarEntry> entries = jarFile.entries();
|
Enumeration<JarEntry> entries = jarFile.entries();
|
||||||
while(entries.hasMoreElements()) {
|
while(entries.hasMoreElements()) {
|
||||||
|
|
Loading…
Reference in a new issue