mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
Spells on the stack can now get counters.
This commit is contained in:
parent
5de03a4165
commit
3b3f136d34
6 changed files with 38 additions and 21 deletions
|
|
@ -889,6 +889,10 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getTargetDescription(Targets targets, Game game) {
|
||||
return getTargetDescriptionForLog(targets, game);
|
||||
}
|
||||
|
||||
protected String getTargetDescriptionForLog(Targets targets, Game game) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (targets.size() > 0) {
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ public enum MageObjectType {
|
|||
CARD ("Card", false, true),
|
||||
COPY_CARD ("Copy of a Card", false, true),
|
||||
TOKEN ("Token", true, true),
|
||||
SPELL ("Spell", false, false),
|
||||
SPELL ("Spell", false, true),
|
||||
PERMANENT ("Permanent", true, true),
|
||||
EMBLEM ("Emblem", false, false),
|
||||
COMMANDER ("Commander", false, false);
|
||||
|
||||
private String text;
|
||||
private boolean permanent;
|
||||
private boolean canHaveCounters;
|
||||
private final String text;
|
||||
private final boolean permanent;
|
||||
private final boolean canHaveCounters;
|
||||
|
||||
|
||||
MageObjectType(String text, boolean permanent, boolean canHaveCounters) {
|
||||
|
|
|
|||
|
|
@ -372,6 +372,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
public boolean chooseNewTargets(Game game, UUID playerId, boolean forceChange, boolean onlyOneTarget) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
StringBuilder newTargetDescription = new StringBuilder();
|
||||
// Fused split spells or spells where "Splice on Arcane" was used can have more than one ability
|
||||
for (SpellAbility spellAbility : spellAbilities) {
|
||||
// Some spells can have more than one mode
|
||||
|
|
@ -386,9 +387,11 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
}
|
||||
|
||||
}
|
||||
newTargetDescription.append(getSpellAbility().getTargetDescription(mode.getTargets(), game));
|
||||
}
|
||||
|
||||
}
|
||||
game.informPlayers(this.getName() + " is now " + newTargetDescription.toString());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -851,26 +854,38 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
|
||||
@Override
|
||||
public Counters getCounters() {
|
||||
return null;
|
||||
return card.getCounters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCounters(String name, int amount, Game game) {}
|
||||
public void addCounters(String name, int amount, Game game) {
|
||||
card.addCounters(name, amount, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects) {}
|
||||
public void addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects) {
|
||||
card.addCounters(name, amount, game, appliedEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCounters(Counter counter, Game game) {}
|
||||
public void addCounters(Counter counter, Game game) {
|
||||
card.addCounters(counter, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCounters(Counter counter, Game game, ArrayList<UUID> appliedEffects) {}
|
||||
public void addCounters(Counter counter, Game game, ArrayList<UUID> appliedEffects) {
|
||||
card.addCounters(counter, game, appliedEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCounters(String name, int amount, Game game) {}
|
||||
public void removeCounters(String name, int amount, Game game) {
|
||||
card.removeCounters(name, amount, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCounters(Counter counter, Game game) {}
|
||||
public void removeCounters(Counter counter, Game game) {
|
||||
card.removeCounters(counter, game);
|
||||
}
|
||||
|
||||
public Card getCard() {
|
||||
return card;
|
||||
|
|
|
|||
|
|
@ -105,13 +105,10 @@ public class SpellStack extends ArrayDeque<StackObject> {
|
|||
|
||||
public Spell getSpell(UUID id) {
|
||||
for (StackObject stackObject: this) {
|
||||
if (stackObject.getId().equals(id)) {
|
||||
if (stackObject instanceof Spell) {
|
||||
if (stackObject instanceof Spell) {
|
||||
if (stackObject.getId().equals(id) || stackObject.getSourceId().equals(id)) {
|
||||
return (Spell)stackObject;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue