mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09:00
Fix for LKI. Ratchet Bomb works.
This commit is contained in:
parent
465e8c3093
commit
4adc937b3c
3 changed files with 34 additions and 29 deletions
|
@ -87,15 +87,17 @@ public class RatchetBomb extends CardImpl<RatchetBomb> {
|
||||||
Permanent p = game.getBattlefield().getPermanent(source.getSourceId());
|
Permanent p = game.getBattlefield().getPermanent(source.getSourceId());
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
p = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
p = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||||
if (p == null)
|
if (p == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int count = p.getCounters().getCount(CounterType.CHARGE);
|
int count = p.getCounters().getCount(CounterType.CHARGE);
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents()) {
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents()) {
|
||||||
if (perm.getManaCost().convertedManaCost() == count && !(perm.getCardType().contains(CardType.LAND)))
|
if (perm.getManaCost().convertedManaCost() == count && !(perm.getCardType().contains(CardType.LAND))) {
|
||||||
perm.destroy(source.getId(), game, false);
|
perm.destroy(source.getId(), game, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -473,6 +473,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playPriority(UUID activePlayerId) {
|
public void playPriority(UUID activePlayerId) {
|
||||||
|
try {
|
||||||
while (!isGameOver()) {
|
while (!isGameOver()) {
|
||||||
state.getPlayers().resetPassed();
|
state.getPlayers().resetPassed();
|
||||||
state.getPlayerList().setCurrent(activePlayerId);
|
state.getPlayerList().setCurrent(activePlayerId);
|
||||||
|
@ -487,7 +488,6 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
||||||
player.priority(this);
|
player.priority(this);
|
||||||
if (isGameOver()) return;
|
if (isGameOver()) return;
|
||||||
applyEffects();
|
applyEffects();
|
||||||
resetLKI();
|
|
||||||
}
|
}
|
||||||
if (isGameOver()) return;
|
if (isGameOver()) return;
|
||||||
if (allPassed()) {
|
if (allPassed()) {
|
||||||
|
@ -498,13 +498,15 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
||||||
state.getPlayers().resetPassed();
|
state.getPlayers().resetPassed();
|
||||||
fireUpdatePlayersEvent();
|
fireUpdatePlayersEvent();
|
||||||
break;
|
break;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.getPlayerList().getNext();
|
state.getPlayerList().getNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
resetLKI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean allPassed() {
|
protected boolean allPassed() {
|
||||||
|
|
|
@ -153,6 +153,7 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
|
||||||
if (!game.replaceEvent(event)) {
|
if (!game.replaceEvent(event)) {
|
||||||
Card card = game.getCard(objectId);
|
Card card = game.getCard(objectId);
|
||||||
Player owner = game.getPlayer(ownerId);
|
Player owner = game.getPlayer(ownerId);
|
||||||
|
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
switch (event.getToZone()) {
|
switch (event.getToZone()) {
|
||||||
case GRAVEYARD:
|
case GRAVEYARD:
|
||||||
|
|
Loading…
Add table
Reference in a new issue