mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
HUGE update to the GUI refactoring, fixing most known bugs and making everything run a lot faster and smoother.
Fixed: exceptions during combat, display of face-down cards, searching libraries, mindslaver effects, and more.
This commit is contained in:
@@ -168,9 +168,10 @@ public class Game implements IGameStateObject {
|
||||
}
|
||||
}
|
||||
|
||||
int plId = 0;
|
||||
for (RegisteredPlayer psc : players0) {
|
||||
IGameEntitiesFactory factory = (IGameEntitiesFactory)psc.getPlayer();
|
||||
Player pl = factory.createIngamePlayer(this);
|
||||
Player pl = factory.createIngamePlayer(this, plId++);
|
||||
players.add(pl);
|
||||
ingamePlayers.add(pl);
|
||||
|
||||
|
||||
@@ -8859,6 +8859,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
Zone zone = this.getZone();
|
||||
if (zone == null) { return true; } //cards outside any zone are visible to all
|
||||
|
||||
final Player controller = this.getController();
|
||||
switch (zone.getZoneType()) {
|
||||
case Ante:
|
||||
case Command:
|
||||
@@ -8869,23 +8870,23 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
//cards in these zones are visible to all
|
||||
return true;
|
||||
case Hand:
|
||||
if (getController().hasKeyword("Play with your hand revealed.")) {
|
||||
if (controller.hasKeyword("Play with your hand revealed.")) {
|
||||
return true;
|
||||
}
|
||||
//fall through
|
||||
case Sideboard:
|
||||
//face-up cards in these zones are hidden to opponents unless they specify otherwise
|
||||
if (getController().isOpponentOf(viewer) && !hasKeyword("Your opponent may look at this card.")) {
|
||||
if (controller.isOpponentOf(viewer) && !hasKeyword("Your opponent may look at this card.")) {
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case Library:
|
||||
case PlanarDeck:
|
||||
//cards in these zones are hidden to all unless they specify otherwise
|
||||
if (getController() == viewer && hasKeyword("You may look at this card.")) {
|
||||
if (controller == viewer && hasKeyword("You may look at this card.")) {
|
||||
return true;
|
||||
}
|
||||
if (getController().isOpponentOf(viewer) && hasKeyword("Your opponent may look at this card.")) {
|
||||
if (controller.isOpponentOf(viewer) && hasKeyword("Your opponent may look at this card.")) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -8906,8 +8907,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
//if viewer is controlled by another player, also check if card can be shown to that player
|
||||
if (viewer.isMindSlaved()) {
|
||||
return canBeShownTo(viewer.getMindSlaveMaster());
|
||||
if (controller.isMindSlaved() && viewer == controller.getMindSlaveMaster()) {
|
||||
return canBeShownTo(controller);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -2,10 +2,8 @@ package forge.game.player;
|
||||
|
||||
import forge.game.Game;
|
||||
|
||||
|
||||
|
||||
public interface IGameEntitiesFactory
|
||||
{
|
||||
PlayerController createControllerFor(Player p);
|
||||
Player createIngamePlayer(Game game);
|
||||
Player createIngamePlayer(Game game, int id);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ import java.util.concurrent.ConcurrentSkipListMap;
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Player extends GameEntity implements Comparable<Player> {
|
||||
private final int id;
|
||||
|
||||
private final Map<Card,Integer> commanderDamage = new HashMap<Card,Integer>();
|
||||
|
||||
/** The poison counters. */
|
||||
@@ -206,7 +208,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
* @param myPoisonCounters
|
||||
* a int.
|
||||
*/
|
||||
public Player(String name, Game game0) {
|
||||
public Player(String name, Game game0, final int id) {
|
||||
game = game0;
|
||||
for (final ZoneType z : Player.ALL_ZONES) {
|
||||
final PlayerZone toPut = z == ZoneType.Battlefield ? new PlayerZoneBattlefield(z, this) : new PlayerZone(z, this);
|
||||
@@ -214,6 +216,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
this.setName(chooseName(name));
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private String chooseName(String originalName) {
|
||||
@@ -234,6 +237,10 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return nameCandidate;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Game getGame() { // I'll probably regret about this
|
||||
return game;
|
||||
|
||||
Reference in New Issue
Block a user