mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Improved text generation.
This commit is contained in:
parent
1d46a90bbd
commit
d065b95501
2 changed files with 26 additions and 2 deletions
|
@ -35,6 +35,7 @@ import mage.abilities.Mode;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -59,6 +60,12 @@ public class CopyTargetSpellEffect extends OneShotEffect<CopyTargetSpellEffect>
|
|||
copy.setCopiedSpell(true);
|
||||
game.getStack().push(copy);
|
||||
copy.chooseNewTargets(game, source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
String activateMessage = copy.getSpellAbility().getActivatedMessage(game);
|
||||
if (activateMessage.startsWith(" casts ")) {
|
||||
activateMessage = activateMessage.substring(6);
|
||||
}
|
||||
game.informPlayers(player.getName() + " copies " + activateMessage);;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -31,9 +31,11 @@ package mage.abilities.effects.common.counter;
|
|||
import mage.Constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.counters.Counter;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -41,17 +43,25 @@ import mage.game.permanent.Permanent;
|
|||
public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffect> {
|
||||
|
||||
private Counter counter;
|
||||
protected boolean informPlayers;
|
||||
|
||||
public AddCountersSourceEffect(Counter counter) {
|
||||
this(counter, false);
|
||||
}
|
||||
|
||||
public AddCountersSourceEffect(Counter counter, boolean informPlayers) {
|
||||
super(Outcome.Benefit);
|
||||
this.counter = counter.copy();
|
||||
this.informPlayers = informPlayers;
|
||||
setText();
|
||||
}
|
||||
|
||||
public AddCountersSourceEffect(final AddCountersSourceEffect effect) {
|
||||
super(effect);
|
||||
if (effect.counter != null)
|
||||
if (effect.counter != null) {
|
||||
this.counter = effect.counter.copy();
|
||||
}
|
||||
this.informPlayers = effect.informPlayers;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,6 +70,12 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
|
|||
if (permanent != null) {
|
||||
if (counter != null) {
|
||||
permanent.addCounters(counter.copy(), game);
|
||||
if (informPlayers) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
game.informPlayers(player.getName()+ " puts " + counter.getCount() + " " + counter.getName() + " counter on " + permanent.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -70,8 +86,9 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("put ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters on {this}");
|
||||
staticText = sb.toString();
|
||||
} else
|
||||
} else {
|
||||
staticText = "put a " + counter.getName() + " counter on {this}";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue