Merge pull request #3441 from ingmargoudt/text

text fix for exert, removed comparator
This commit is contained in:
ingmargoudt 2017-05-28 12:49:20 +02:00 committed by GitHub
commit 1af39d5659
3 changed files with 10 additions and 23 deletions

View file

@ -34,7 +34,7 @@ public class SuqAtaFirewalker extends CardImpl {
color.setBlue(true);
// Suq'Ata Firewalker can't be the target of black spells or abilities from black sources.
// Suq'Ata Firewalker can't be the target of red spells or abilities from red sources.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeTargetedSourceEffect(filterRed, Duration.WhileOnBattlefield)));
//{T}: Suq'Ata Firewalker deals 1 damage to target creature or player.

View file

@ -30,6 +30,8 @@ package mage.abilities.effects;
import java.io.Serializable;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import mage.MageObject;
import mage.abilities.*;
import mage.abilities.keyword.SpliceOntoArcaneAbility;
@ -83,7 +85,6 @@ public class ContinuousEffects implements Serializable {
// note all effect/abilities that were only added temporary
private final Map<ContinuousEffect, Set<Ability>> temporaryEffects = new HashMap<>();
private final ContinuousEffectSorter sorter = new ContinuousEffectSorter();
public ContinuousEffects() {
applyCounters = new ApplyCountersEffect();
@ -211,7 +212,7 @@ public class ContinuousEffects implements Serializable {
updateTimestamps(layerEffects);
layerEffects.sort(sorter);
Collections.sort(layerEffects, Comparator.comparingLong(ContinuousEffect::getOrder));
return layerEffects;
}
@ -240,13 +241,7 @@ public class ContinuousEffects implements Serializable {
}
private List<ContinuousEffect> filterLayeredEffects(List<ContinuousEffect> effects, Layer layer) {
List<ContinuousEffect> layerEffects = new ArrayList<>();
for (ContinuousEffect effect : effects) {
if (effect.hasLayer(layer)) {
layerEffects.add(effect);
}
}
return layerEffects;
return effects.stream().filter(effect->effect.hasLayer(layer)).collect(Collectors.toList());
}
public HashMap<RequirementEffect, HashSet<Ability>> getApplicableRequirementEffects(Permanent permanent, Game game) {
@ -554,7 +549,7 @@ public class ContinuousEffects implements Serializable {
/**
* Filters out asThough effects that are not active.
*
* @param AsThoughEffectType type
* @param type type
* @param game
* @return
*/
@ -1266,11 +1261,3 @@ public class ContinuousEffects implements Serializable {
return controllerFound;
}
}
class ContinuousEffectSorter implements Comparator<ContinuousEffect>, Serializable {
@Override
public int compare(ContinuousEffect one, ContinuousEffect two) {
return Long.compare(one.getOrder(), two.getOrder());
}
}

View file

@ -69,14 +69,14 @@ public class ExertAbility extends SimpleStaticAbility {
: "You may exert {this}") + " as it attacks. ";
if (ability != null) {
this.addSubAbility(ability);
ruleText += ("When you do,");
ability.getEffects().stream().forEach((effect) -> {
ruleText += "When you do,";
ability.getEffects().forEach(effect -> {
ruleText += " " + effect.getText(ability.getModes().getMode());
});
ruleText += ". ";
ability.setRuleVisible(false);
}
ruleText += "<i>(An exterted creature can't untap during your next untap step)</i>";
ruleText += "<i>(An exerted creature can't untap during your next untap step)</i>";
if (exertOnlyOncePerTurn) {
getWatchers().add(new ExertedThisTurnWatcher());
}
@ -142,7 +142,7 @@ class ExertReplacementEffect extends ReplacementEffectImpl {
}
}
if (controller.chooseUse(outcome, "Exert " + creature.getLogName() + '?',
"An exterted creature can't untap during your next untap step.", "Yes", "No", source, game)) {
"An exerted creature can't untap during your next untap step.", "Yes", "No", source, game)) {
if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + " exerted " + creature.getName());
}