Merge branch 'patch-4' into 'master'

Fix getController()

See merge request core-developers/forge!2142
This commit is contained in:
Hans Mackowiak
2019-09-23 04:53:14 +00:00

View File

@@ -2722,9 +2722,27 @@ public class Card extends GameEntity implements Comparable<Card> {
public final Player getController() { public final Player getController() {
if ((currentZone == null) || ((currentZone.getZoneType() != ZoneType.Battlefield) && (currentZone.getZoneType() != ZoneType.Stack))){ if ((currentZone == null) || ((currentZone.getZoneType() != ZoneType.Battlefield) && (currentZone.getZoneType() != ZoneType.Stack))){
//only permanents and spells have controllers [108.4], /*
//so a card really only has a controller while it's on the stack or battlefield. * 108.4. A card doesnt have a controller unless that card represents a permanent or spell; in those cases,
//everywhere else, just use the owner [108.4a]. * its controller is determined by the rules for permanents or spells. See rules 110.2 and 112.2.
* 108.4a If anything asks for the controller of a card that doesnt have one (because its not a permanent
* or spell), use its owner instead.
*
* Control, Controller: "Control" is the system that determines who gets to use an object in the game.
* An object's "controller" is the player who currently controls it. See rule 108.4.
*
* 400.6. If an object would move from one zone to another, determine what event is moving the object.
* If the object is moving to a public zone and its owner will be able to look at it in that zone,
* its owner looks at it to see if it has any abilities that would affect the move.
* If the object is moving to the battlefield, each other player who will be able to look at it in that
* zone does so. Then any appropriate replacement effects, whether they come from that object or from
* elsewhere, are applied to that event. If any effects or rules try to do two or more contradictory or
* mutually exclusive things to a particular object, that objects CONTROLLER—or its OWNER
* IF IT HAS NO CONTROLLER—chooses which effect to apply, and what that effect does.
*/
if (controller != null) {
return controller; // if there's a controller we return this
}
if (owner != null) { if (owner != null) {
return owner; return owner;
} }