- "Bill the Pony" no longer is discarded when moving to Underground site, before it decreases the shadow number of the
site, when adding twilight for moving.
This commit is contained in:
@@ -45,7 +45,8 @@ public class Card3_106 extends AbstractAttachableFPPossession {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||||
if (game.getModifiersQuerying().hasKeyword(game.getGameState(), game.getGameState().getCurrentSite(), Keyword.UNDERGROUND)) {
|
if (!game.getGameState().isMoving()
|
||||||
|
&& game.getModifiersQuerying().hasKeyword(game.getGameState(), game.getGameState().getCurrentSite(), Keyword.UNDERGROUND)) {
|
||||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||||
action.appendEffect(
|
action.appendEffect(
|
||||||
new SelfDiscardEffect(self));
|
new SelfDiscardEffect(self));
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class GameState {
|
|||||||
private int _twilightPool;
|
private int _twilightPool;
|
||||||
|
|
||||||
private int _moveCount;
|
private int _moveCount;
|
||||||
|
private boolean _moving;
|
||||||
private boolean _fierceSkirmishes;
|
private boolean _fierceSkirmishes;
|
||||||
private boolean _extraSkirmishes;
|
private boolean _extraSkirmishes;
|
||||||
|
|
||||||
@@ -90,6 +91,14 @@ public class GameState {
|
|||||||
listener.setPlayerOrder(playerOrder.getAllPlayers());
|
listener.setPlayerOrder(playerOrder.getAllPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMoving() {
|
||||||
|
return _moving;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMoving(boolean moving) {
|
||||||
|
_moving = moving;
|
||||||
|
}
|
||||||
|
|
||||||
private void addPlayerCards(String playerId, List<String> cards, LotroCardBlueprintLibrary library) {
|
private void addPlayerCards(String playerId, List<String> cards, LotroCardBlueprintLibrary library) {
|
||||||
for (String blueprintId : cards) {
|
for (String blueprintId : cards) {
|
||||||
PhysicalCardImpl physicalCard = createPhysicalCard(playerId, library, blueprintId);
|
PhysicalCardImpl physicalCard = createPhysicalCard(playerId, library, blueprintId);
|
||||||
|
|||||||
@@ -28,6 +28,13 @@ public class MovementGameProcess implements GameProcess {
|
|||||||
public void process(LotroGame game) {
|
public void process(LotroGame game) {
|
||||||
PhysicalCard currentSite = game.getGameState().getCurrentSite();
|
PhysicalCard currentSite = game.getGameState().getCurrentSite();
|
||||||
final SystemQueueAction action = new SystemQueueAction();
|
final SystemQueueAction action = new SystemQueueAction();
|
||||||
|
action.appendEffect(
|
||||||
|
new UnrespondableEffect() {
|
||||||
|
@Override
|
||||||
|
protected void doPlayEffect(LotroGame game) {
|
||||||
|
game.getGameState().setMoving(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
action.appendEffect(
|
action.appendEffect(
|
||||||
new UnrespondableEffect() {
|
new UnrespondableEffect() {
|
||||||
@Override
|
@Override
|
||||||
@@ -90,6 +97,13 @@ public class MovementGameProcess implements GameProcess {
|
|||||||
action.insertEffect(effect);
|
action.insertEffect(effect);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
action.appendEffect(
|
||||||
|
new UnrespondableEffect() {
|
||||||
|
@Override
|
||||||
|
protected void doPlayEffect(LotroGame game) {
|
||||||
|
game.getGameState().setMoving(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
game.getActionsEnvironment().addActionToStack(action);
|
game.getActionsEnvironment().addActionToStack(action);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,64 +14,42 @@ public class PlayerDAO {
|
|||||||
private final String validLoginChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
|
private final String validLoginChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
|
||||||
|
|
||||||
private DbAccess _dbAccess;
|
private DbAccess _dbAccess;
|
||||||
private Map<String, Player> _players = new ConcurrentHashMap<String, Player>();
|
private Map<String, Player> _playersByName = new ConcurrentHashMap<String, Player>();
|
||||||
|
private Map<Integer, Player> _playersById = new ConcurrentHashMap<Integer, Player>();
|
||||||
|
|
||||||
public PlayerDAO(DbAccess dbAccess) {
|
public PlayerDAO(DbAccess dbAccess) {
|
||||||
_dbAccess = dbAccess;
|
_dbAccess = dbAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
_players.clear();
|
_playersByName.clear();
|
||||||
|
_playersById.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer(int id) {
|
public Player getPlayer(int id) {
|
||||||
try {
|
if (_playersById.containsKey(id))
|
||||||
Connection conn = _dbAccess.getDataSource().getConnection();
|
return _playersById.get(id);
|
||||||
try {
|
|
||||||
PreparedStatement statement = conn.prepareStatement("select id, name, type, last_login_reward from player where id=?");
|
|
||||||
try {
|
|
||||||
statement.setInt(1, id);
|
|
||||||
ResultSet rs = statement.executeQuery();
|
|
||||||
try {
|
|
||||||
if (rs.next()) {
|
|
||||||
String name = rs.getString(2);
|
|
||||||
String type = rs.getString(3);
|
|
||||||
Integer lastLoginReward = rs.getInt(4);
|
|
||||||
if (rs.wasNull())
|
|
||||||
lastLoginReward = null;
|
|
||||||
|
|
||||||
return new Player(id, name, type, lastLoginReward);
|
try {
|
||||||
} else {
|
final Player player = getPlayerFromDBById(id);
|
||||||
return null;
|
if (player != null)
|
||||||
}
|
_playersById.put(id, player);
|
||||||
} finally {
|
return player;
|
||||||
rs.close();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
statement.close();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
conn.close();
|
|
||||||
}
|
|
||||||
} catch (SQLException exp) {
|
} catch (SQLException exp) {
|
||||||
throw new RuntimeException("Error while retrieving player", exp);
|
throw new RuntimeException("Error while retrieving player", exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer(String playerName) {
|
public Player getPlayer(String playerName) {
|
||||||
if (_players.containsKey(playerName))
|
if (_playersByName.containsKey(playerName))
|
||||||
return _players.get(playerName);
|
return _playersByName.get(playerName);
|
||||||
else {
|
try {
|
||||||
try {
|
Player player = getPlayerFromDBByName(playerName);
|
||||||
Player player = getPlayerFromDB(playerName);
|
if (player != null)
|
||||||
if (player != null) {
|
_playersByName.put(playerName, player);
|
||||||
_players.put(playerName, player);
|
return player;
|
||||||
return player;
|
} catch (SQLException exp) {
|
||||||
} else
|
throw new RuntimeException("Unable to get player from DB", exp);
|
||||||
return null;
|
|
||||||
} catch (SQLException exp) {
|
|
||||||
throw new RuntimeException("Unable to get player from DB", exp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +200,37 @@ public class PlayerDAO {
|
|||||||
return hexString.toString();
|
return hexString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Player getPlayerFromDB(String playerName) throws SQLException {
|
private Player getPlayerFromDBById(int id) throws SQLException {
|
||||||
|
Connection conn = _dbAccess.getDataSource().getConnection();
|
||||||
|
try {
|
||||||
|
PreparedStatement statement = conn.prepareStatement("select id, name, type, last_login_reward from player where id=?");
|
||||||
|
try {
|
||||||
|
statement.setInt(1, id);
|
||||||
|
ResultSet rs = statement.executeQuery();
|
||||||
|
try {
|
||||||
|
if (rs.next()) {
|
||||||
|
String name = rs.getString(2);
|
||||||
|
String type = rs.getString(3);
|
||||||
|
Integer lastLoginReward = rs.getInt(4);
|
||||||
|
if (rs.wasNull())
|
||||||
|
lastLoginReward = null;
|
||||||
|
|
||||||
|
return new Player(id, name, type, lastLoginReward);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
rs.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
statement.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
conn.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Player getPlayerFromDBByName(String playerName) throws SQLException {
|
||||||
Connection conn = _dbAccess.getDataSource().getConnection();
|
Connection conn = _dbAccess.getDataSource().getConnection();
|
||||||
try {
|
try {
|
||||||
PreparedStatement statement = conn.prepareStatement("select id, name, type, last_login_reward from player where name=?");
|
PreparedStatement statement = conn.prepareStatement("select id, name, type, last_login_reward from player where name=?");
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<pre style="font-size:80%">
|
<pre style="font-size:80%">
|
||||||
|
<b>24 Apr. 2012</b>
|
||||||
|
- "Bill the Pony" no longer is discarded when moving to Underground site, before it decreases the shadow number of the
|
||||||
|
site, when adding twilight for moving.
|
||||||
|
|
||||||
<b>23 Apr. 2012</b>
|
<b>23 Apr. 2012</b>
|
||||||
- Adding 0 threats is now possible and legal, hence playing "Plotting" will not fail now, if you can't add any threats
|
- Adding 0 threats is now possible and legal, hence playing "Plotting" will not fail now, if you can't add any threats
|
||||||
anymore (number of threats is equal to or greater than number of companions).
|
anymore (number of threats is equal to or greater than number of companions).
|
||||||
|
|||||||
Reference in New Issue
Block a user