mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
Test framework: fixed missing range info for added cards (some ETB effects were broken on "put to battlefield" command usage);
This commit is contained in:
parent
654c0be1ac
commit
4e79c83784
5 changed files with 27 additions and 2 deletions
|
|
@ -707,6 +707,8 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
void untap(Game game);
|
||||
|
||||
void updateRange(Game game);
|
||||
|
||||
ManaOptions getManaAvailable(Game game);
|
||||
|
||||
void addAvailableTriggeredMana(List<Mana> netManaAvailable);
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public void beginTurn(Game game) {
|
||||
this.landsPlayed = 0;
|
||||
updateRangeOfInfluence(game);
|
||||
updateRange(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -491,7 +491,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return range;
|
||||
}
|
||||
|
||||
protected void updateRangeOfInfluence(Game game) {
|
||||
@Override
|
||||
public void updateRange(Game game) {
|
||||
// 20100423 - 801.2c
|
||||
// 801.2c The particular players within each player’s range of influence are determined as each turn begins.
|
||||
inRange.clear();
|
||||
|
|
@ -523,6 +524,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
@Override
|
||||
public Set<UUID> getInRange() {
|
||||
if (inRange.isEmpty()) {
|
||||
// runtime check: inRange filled on beginTurn, but unit tests adds cards by cheat engine before game starting,
|
||||
// so inRange will be empty and some ETB effects can be broken (example: Spark Double puts direct to battlefield).
|
||||
// Cheat engine already have a workaround, so that error must not be visible in normal situation.
|
||||
throw new IllegalStateException("Wrong code usage (game is not started, but you call getInRange in some effects).");
|
||||
}
|
||||
|
||||
return inRange;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue