mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00: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
|
@ -85,16 +85,18 @@ public class RatchetBomb extends CardImpl<RatchetBomb> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getBattlefield().getPermanent(source.getSourceId());
|
||||
if (p == null) {
|
||||
if (p == null) {
|
||||
p = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
if (p == null)
|
||||
if (p == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int count = p.getCounters().getCount(CounterType.CHARGE);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -473,37 +473,39 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
|
||||
@Override
|
||||
public void playPriority(UUID activePlayerId) {
|
||||
while (!isGameOver()) {
|
||||
state.getPlayers().resetPassed();
|
||||
state.getPlayerList().setCurrent(activePlayerId);
|
||||
Player player;
|
||||
try {
|
||||
while (!isGameOver()) {
|
||||
player = getPlayer(state.getPlayerList().get());
|
||||
state.setPriorityPlayerId(player.getId());
|
||||
while (!player.isPassed() && !player.hasLost() && !player.hasLeft()&& !isGameOver()) {
|
||||
checkStateAndTriggered();
|
||||
if (isGameOver()) return;
|
||||
// resetPassed should be called if player performs any action
|
||||
player.priority(this);
|
||||
if (isGameOver()) return;
|
||||
applyEffects();
|
||||
resetLKI();
|
||||
}
|
||||
if (isGameOver()) return;
|
||||
if (allPassed()) {
|
||||
if (!state.getStack().isEmpty()) {
|
||||
//20091005 - 115.4
|
||||
state.getStack().resolve(this);
|
||||
state.getPlayers().resetPassed();
|
||||
state.getPlayerList().setCurrent(activePlayerId);
|
||||
Player player;
|
||||
while (!isGameOver()) {
|
||||
player = getPlayer(state.getPlayerList().get());
|
||||
state.setPriorityPlayerId(player.getId());
|
||||
while (!player.isPassed() && !player.hasLost() && !player.hasLeft() && !isGameOver()) {
|
||||
checkStateAndTriggered();
|
||||
if (isGameOver()) return;
|
||||
// resetPassed should be called if player performs any action
|
||||
player.priority(this);
|
||||
if (isGameOver()) return;
|
||||
applyEffects();
|
||||
state.getPlayers().resetPassed();
|
||||
fireUpdatePlayersEvent();
|
||||
break;
|
||||
}
|
||||
else
|
||||
return;
|
||||
if (isGameOver()) return;
|
||||
if (allPassed()) {
|
||||
if (!state.getStack().isEmpty()) {
|
||||
//20091005 - 115.4
|
||||
state.getStack().resolve(this);
|
||||
applyEffects();
|
||||
state.getPlayers().resetPassed();
|
||||
fireUpdatePlayersEvent();
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
}
|
||||
state.getPlayerList().getNext();
|
||||
}
|
||||
state.getPlayerList().getNext();
|
||||
}
|
||||
} finally {
|
||||
resetLKI();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
|
|||
if (!game.replaceEvent(event)) {
|
||||
Card card = game.getCard(objectId);
|
||||
Player owner = game.getPlayer(ownerId);
|
||||
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
||||
if (owner != null) {
|
||||
switch (event.getToZone()) {
|
||||
case GRAVEYARD:
|
||||
|
|
Loading…
Reference in a new issue