mirror of
https://github.com/magefree/mage.git
synced 2026-01-23 11:49:56 -08:00
* Fixed that player enchnatments were not correctly removed as they left the battlefield causing problems if they were cast again later in the game (fixes #1006).
This commit is contained in:
parent
a50447c84d
commit
36eebfa317
4 changed files with 71 additions and 5 deletions
|
|
@ -2058,6 +2058,11 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
Permanent attachedTo = getPermanent(perm.getAttachedTo());
|
||||
if (attachedTo != null) {
|
||||
attachedTo.removeAttachment(perm.getId(), this);
|
||||
} else {
|
||||
Player attachedToPlayer = getPlayer(perm.getAttachedTo());
|
||||
if (attachedToPlayer != null) {
|
||||
attachedToPlayer.removeAttachment(perm.getId(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if it's a creature and must be removed from combat
|
||||
|
|
|
|||
|
|
@ -789,12 +789,17 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public boolean removeFromBattlefield(Permanent permanent, Game game) {
|
||||
permanent.removeFromCombat(game, false);
|
||||
game.getBattlefield().removePermanent(permanent.getId());
|
||||
if (permanent.getAttachedTo() != null) {
|
||||
Permanent attachedTo = game.getPermanent(permanent.getAttachedTo());
|
||||
if (attachedTo != null) {
|
||||
attachedTo.removeAttachment(permanent.getId(), game);
|
||||
} else {
|
||||
Player attachedToPlayer = game.getPlayer(permanent.getAttachedTo());
|
||||
if (attachedToPlayer != null) {
|
||||
attachedToPlayer.removeAttachment(permanent.getId(), game);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (permanent.getPairedCard() != null) {
|
||||
Permanent pairedCard = game.getPermanent(permanent.getPairedCard());
|
||||
|
|
@ -802,6 +807,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
pairedCard.clearPairedCard();
|
||||
}
|
||||
}
|
||||
game.getBattlefield().removePermanent(permanent.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue