* Some minor fixed and log changes.

This commit is contained in:
LevelX2 2017-04-25 17:37:38 +02:00
parent 9a21b55d39
commit 60cc3a7622
9 changed files with 90 additions and 46 deletions

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.common;
import java.util.ArrayList;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
@ -144,14 +145,16 @@ class LicidContinuousEffect extends ContinuousEffectImpl {
licid.getSubtype(game).add("Aura");
break;
case AbilityAddingRemovingEffects_6:
ArrayList<Ability> toRemove = new ArrayList<>();
for (Ability ability : licid.getAbilities(game)) {
for (Effect effect : ability.getEffects()) {
if (effect instanceof LicidEffect) {
licid.getAbilities(game).remove(ability);
toRemove.add(ability);
break;
}
}
}
licid.getAbilities(game).removeAll(toRemove);
Ability ability = new EnchantAbility("creature");
ability.setRuleAtTheTop(true);
licid.addAbility(ability, source.getSourceId(), game);

View file

@ -1218,7 +1218,10 @@ public class ContinuousEffects implements Serializable {
}
}
} else {
logger.error("Replacement effect without ability: " + entry.getKey().toString());
if (!(entry.getKey() instanceof AuraReplacementEffect)
&& !(entry.getKey() instanceof PlaneswalkerRedirectionEffect)) {
logger.error("Replacement effect without ability: " + entry.getKey().toString());
}
}
}
return texts;

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common.counter;
import java.util.HashSet;
@ -47,8 +46,8 @@ import mage.util.CardUtil;
*
* @author LevelX2
*/
public class RemoveCounterTargetEffect extends OneShotEffect {
private final Counter counter;
public RemoveCounterTargetEffect() {
@ -69,23 +68,25 @@ public class RemoveCounterTargetEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(targetPointer.getFirst(game, source));
if(p != null) {
if (p != null) {
Counter toRemove = (counter == null ? selectCounterType(game, source, p) : counter);
if(toRemove != null && p.getCounters(game).getCount(toRemove.getName()) >= toRemove.getCount()) {
if (toRemove != null && p.getCounters(game).getCount(toRemove.getName()) >= toRemove.getCount()) {
p.removeCounters(toRemove.getName(), toRemove.getCount(), game);
if(!game.isSimulation())
if (!game.isSimulation()) {
game.informPlayers("Removed " + toRemove.getCount() + ' ' + toRemove.getName()
+ " counter from " + p.getName());
+ " counter from " + p.getName());
}
return true;
}
}
Card c = game.getCard(targetPointer.getFirst(game, source));
if (c != null && counter != null && c.getCounters(game).getCount(counter.getName()) >= counter.getCount()) {
c.removeCounters(counter.getName(), counter.getCount(), game);
if (!game.isSimulation())
if (!game.isSimulation()) {
game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(' ').append(counter.getName())
.append(" counter from ").append(c.getName())
.append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString());
.append(" counter from ").append(c.getName())
.append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString());
}
return true;
}
return false;
@ -93,12 +94,12 @@ public class RemoveCounterTargetEffect extends OneShotEffect {
private Counter selectCounterType(Game game, Ability source, Permanent permanent) {
Player controller = game.getPlayer(source.getControllerId());
if(controller != null && !permanent.getCounters(game).isEmpty()) {
if (controller != null && !permanent.getCounters(game).isEmpty()) {
String counterName = null;
if(permanent.getCounters(game).size() > 1) {
if (permanent.getCounters(game).size() > 1) {
Choice choice = new ChoiceImpl(true);
Set<String> choices = new HashSet<>();
for(Counter counter : permanent.getCounters(game).values()) {
for (Counter counter : permanent.getCounters(game).values()) {
if (permanent.getCounters(game).getCount(counter.getName()) > 0) {
choices.add(counter.getName());
}
@ -108,8 +109,8 @@ public class RemoveCounterTargetEffect extends OneShotEffect {
controller.choose(Outcome.Detriment, choice, game);
counterName = choice.getChoice();
} else {
for(Counter counter : permanent.getCounters(game).values()) {
if(counter.getCount() > 0) {
for (Counter counter : permanent.getCounters(game).values()) {
if (counter.getCount() > 0) {
counterName = counter.getName();
}
}
@ -131,14 +132,13 @@ public class RemoveCounterTargetEffect extends OneShotEffect {
}
String text = "remove ";
if(counter == null) {
if (counter == null) {
text += "a counter";
} else {
text += CardUtil.numberToText(counter.getCount(), "a") + ' ' + counter.getName();
text += counter.getCount() > 1 ? " counters" : " counter";
}
else {
text += CardUtil.numberToText(counter.getCount(), "a") + ' ' + counter.getName();
text += counter.getCount() > 1 ? " counters" : " counter";
}
text += " from target " + mode.getTargets().get(0).getTargetName();
text += " from target " + (mode.getTargets().isEmpty() ? " object" : mode.getTargets().get(0).getTargetName());
return text;
}
}

View file

@ -276,7 +276,7 @@ public class Turn implements Serializable {
setEndTurnRequested(true);
// 1) All spells and abilities on the stack are exiled. This includes Time Stop, though it will continue to resolve.
// 1) All spells and abilities on the stack are exiled. This includes (e.g.) Time Stop, though it will continue to resolve.
// It also includes spells and abilities that can't be countered.
while (!game.getStack().isEmpty()) {
StackObject stackObject = game.getStack().peekFirst();