mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
added missing Planeswalker damage redirection effect + some fixes
This commit is contained in:
parent
120de78d97
commit
06b7e63843
37 changed files with 347 additions and 75 deletions
|
|
@ -37,10 +37,10 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.keyword.LevelAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.LevelerCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -112,18 +112,58 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
|
|||
this.cardNumber = card.getCardNumber();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean moveToZone(Zone zone, Game game, boolean flag) {
|
||||
// ZoneChangeEvent event = new ZoneChangeEvent(this.getId(), this.getControllerId(), Zone.BATTLEFIELD, zone);
|
||||
// if (!game.replaceEvent(event)) {
|
||||
// if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
|
||||
// CardImpl card = (CardImpl) game.getCard(objectId);
|
||||
// return card.moveToZone(event.getToZone(), controllerId, game, flag);
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean moveToZone(Zone zone, Game game, boolean flag) {
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this.getId(), this.getControllerId(), Zone.BATTLEFIELD, zone);
|
||||
public boolean moveToZone(Zone toZone, Game game, boolean flag) {
|
||||
Zone fromZone = zone;
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this, controllerId, fromZone, toZone);
|
||||
if (!game.replaceEvent(event)) {
|
||||
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
|
||||
CardImpl card = (CardImpl) game.getCard(objectId);
|
||||
return card.moveToZone(event.getToZone(), controllerId, game, flag);
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null && controller.removeFromBattlefield(this, game)) {
|
||||
Card card = game.getCard(objectId);
|
||||
Player owner = game.getPlayer(ownerId);
|
||||
if (owner != null) {
|
||||
switch (event.getToZone()) {
|
||||
case GRAVEYARD:
|
||||
owner.putInGraveyard(card, game, !flag);
|
||||
break;
|
||||
case HAND:
|
||||
owner.getHand().add(card);
|
||||
break;
|
||||
case EXILED:
|
||||
game.getExile().getPermanentExile().add(card);
|
||||
break;
|
||||
case LIBRARY:
|
||||
if (flag)
|
||||
owner.getLibrary().putOnTop(card, game);
|
||||
else
|
||||
owner.getLibrary().putOnBottom(card, game);
|
||||
break;
|
||||
case BATTLEFIELD:
|
||||
//should never happen
|
||||
break;
|
||||
}
|
||||
zone = event.getToZone();
|
||||
game.fireEvent(event);
|
||||
return zone == toZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean moveToExile(UUID exileId, String name, Game game) {
|
||||
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue