mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08:00
* Gather Specimens - Fixed that it did not work for token creatures the opponent brought onto the battlefield.
This commit is contained in:
parent
cb014226c4
commit
6514e30b59
5 changed files with 51 additions and 19 deletions
|
|
@ -377,7 +377,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
}
|
||||
break;
|
||||
case BATTLEFIELD:
|
||||
PermanentCard permanent = new PermanentCard(this, ownerId);
|
||||
PermanentCard permanent = new PermanentCard(this, event.getPlayerId()); // controller can be replaced (e.g. Gather Specimens)
|
||||
game.resetForSourceId(permanent.getId());
|
||||
game.addPermanent(permanent);
|
||||
game.setZone(objectId, Zone.BATTLEFIELD);
|
||||
|
|
@ -399,7 +399,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
.append("] source [").append(sourceCard != null ? sourceCard.getName():"null").append("]").toString());
|
||||
return false;
|
||||
}
|
||||
setControllerId(ownerId);
|
||||
setControllerId(event.getPlayerId());
|
||||
game.setZone(objectId, event.getToZone());
|
||||
game.addSimultaneousEvent(event);
|
||||
return game.getState().getZone(objectId) == toZone;
|
||||
|
|
@ -543,11 +543,11 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
}
|
||||
}
|
||||
updateZoneChangeCounter();
|
||||
PermanentCard permanent = new PermanentCard(this, controllerId);
|
||||
PermanentCard permanent = new PermanentCard(this, event.getPlayerId());
|
||||
// reset is done to end continuous effects from previous instances of that permanent (e.g undying)
|
||||
game.resetForSourceId(permanent.getId());
|
||||
// make sure the controller of all continuous effects of this card are switched to the current controller
|
||||
game.getContinuousEffects().setController(objectId, controllerId);
|
||||
game.getContinuousEffects().setController(objectId, event.getPlayerId());
|
||||
game.addPermanent(permanent);
|
||||
game.setZone(objectId, Zone.BATTLEFIELD);
|
||||
game.setScopeRelevant(true);
|
||||
|
|
@ -555,7 +555,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
permanent.entersBattlefield(sourceId, game, event.getFromZone(), true);
|
||||
game.setScopeRelevant(false);
|
||||
game.applyEffects();
|
||||
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
|
||||
game.fireEvent(new ZoneChangeEvent(permanent, event.getPlayerId(), fromZone, Zone.BATTLEFIELD));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -186,6 +186,10 @@ public class GameEvent {
|
|||
return sourceId;
|
||||
}
|
||||
|
||||
public void setPlayerId(UUID playerId) {
|
||||
this.playerId = playerId;
|
||||
}
|
||||
|
||||
public UUID getPlayerId() {
|
||||
return playerId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,11 +139,11 @@ public class Token extends MageObjectImpl {
|
|||
} else {
|
||||
setCode = source != null ? source.getExpansionSetCode() : null;
|
||||
}
|
||||
GameEvent event = GameEvent.getEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount);
|
||||
GameEvent event = new GameEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount, this.getCardType().contains(CardType.CREATURE));
|
||||
if (!game.replaceEvent(event)) {
|
||||
amount = event.getAmount();
|
||||
for (int i = 0; i < amount; i++) {
|
||||
PermanentToken newToken = new PermanentToken(this, controllerId, setCode, game);
|
||||
PermanentToken newToken = new PermanentToken(this, event.getPlayerId(), setCode, game); // use event.getPlayerId() because it can be replaced by replacement effect
|
||||
game.getState().addCard(newToken);
|
||||
game.addPermanent(newToken);
|
||||
if (tapped) {
|
||||
|
|
@ -156,7 +156,7 @@ public class Token extends MageObjectImpl {
|
|||
newToken.entersBattlefield(sourceId, game, Zone.OUTSIDE, true);
|
||||
game.setScopeRelevant(false);
|
||||
game.applyEffects();
|
||||
game.fireEvent(new ZoneChangeEvent(newToken, controllerId, Zone.OUTSIDE, Zone.BATTLEFIELD));
|
||||
game.fireEvent(new ZoneChangeEvent(newToken, event.getPlayerId(), Zone.OUTSIDE, Zone.BATTLEFIELD));
|
||||
if (attacking && game.getCombat() != null) {
|
||||
game.getCombat().addAttackingCreature(newToken.getId(), game);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue