Deck creation and fixes for Glamdring and Sting missing strength bonuses.

This commit is contained in:
marcins78@gmail.com
2011-09-07 00:05:08 +00:00
parent abae927b96
commit 53d1107c01
10 changed files with 108 additions and 211 deletions

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ChooseOpponentEffect;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
@@ -13,11 +14,13 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction;
import com.gempukku.lotro.logic.modifiers.CompositeModifier;
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
@@ -43,7 +46,10 @@ public class Card1_075 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new KeywordModifier(self, Filters.attachedTo(self), Keyword.DAMAGE);
List<Modifier> modifiers = new LinkedList<Modifier>();
modifiers.add(new StrengthModifier(null, null, 2));
modifiers.add(new KeywordModifier(null, null, Keyword.DAMAGE));
return new CompositeModifier(self, Filters.attachedTo(self), modifiers);
}
@Override

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ChooseOpponentEffect;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
@@ -13,6 +14,7 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
@@ -41,6 +43,11 @@ public class Card1_313 extends AbstractAttachableFPPossession {
return Filters.and(Filters.name("Frodo"), Filters.not(Filters.hasAttached(Filters.keyword(Keyword.HAND_WEAPON))));
}
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, Filters.attachedTo(self), 2);
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, final LotroGame game, final PhysicalCard self) {
if ((PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)

View File

@@ -19,6 +19,8 @@ public class PlayStartingFellowshipGameProcess implements GameProcess {
public void process() {
String nextPlayer = _playOrder.getNextPlayer();
if (nextPlayer != null) {
if (_game.getGameState().getCurrentPlayerId() != null)
_game.getGameState().stopAffectingCardsForCurrentPlayer();
_game.getGameState().startPlayerTurn(nextPlayer);
_nextProcess = new PlayerPlaysStartingFellowshipGameProcess(_game, nextPlayer, new PlayStartingFellowshipGameProcess(_game, _playOrder));
} else {

View File

@@ -85,11 +85,11 @@ public class LotroServer {
// TODO
}
public synchronized String createNewGame(LotroFormat lotroFormat, LotroGameParticipant[] participants, String gameId) {
public synchronized String createNewGame(LotroFormat lotroFormat, LotroGameParticipant[] participants) {
if (participants.length < 2)
throw new IllegalArgumentException("There has to be at least two players");
LotroGameMediator lotroGameMediator = new LotroGameMediator(lotroFormat, participants, _lotroCardBlueprintLibrary);
// String gameId = String.valueOf(_nextGameId);
String gameId = String.valueOf(_nextGameId);
_runningGames.put(gameId, lotroGameMediator);
_nextGameId++;
return gameId;

View File

@@ -48,13 +48,14 @@ public class ServerResource {
_logger.debug("Resource created");
}
private void createGame(String gameId) {
private String createGameOnServer(String player1Name, String player2Name) {
LotroGameParticipant[] participants = new LotroGameParticipant[2];
participants[0] = new LotroGameParticipant("MarcinS1", _lotroServer.getParticipantDeck("MarcinS1"));
participants[1] = new LotroGameParticipant("MarcinS2", _lotroServer.getParticipantDeck("MarcinS2"));
participants[0] = new LotroGameParticipant(player1Name, _lotroServer.getParticipantDeck(player1Name));
participants[1] = new LotroGameParticipant(player2Name, _lotroServer.getParticipantDeck(player2Name));
_lotroServer.createNewGame(new DefaultLotroFormat(true), participants, gameId);
String gameId = _lotroServer.createNewGame(new DefaultLotroFormat(true), participants);
_lotroServer.getGameById(gameId).startGame();
return gameId;
}
@Path("/login")
@@ -70,6 +71,35 @@ public class ServerResource {
logUser(request, login);
}
@Path("/createGame")
@POST
@Produces(MediaType.TEXT_HTML)
public String createGame(
@FormParam("player1") String player1Name,
@FormParam("player2") String player2Name) {
PlayerDAO playerDao = _lotroServer.getPlayerDao();
Player player1 = playerDao.getPlayer(player1Name);
if (player1 == null)
return "<b>Error:</b> Can't find user with name: " + player1Name;
Player player2 = playerDao.getPlayer(player2Name);
if (player2 == null)
return "<b>Error:</b> Can't find user with name: " + player2Name;
DeckDAO deckDao = _lotroServer.getDeckDao();
Deck deck1 = deckDao.getDeckForPlayer(player1, "default");
if (deck1 == null)
return "<b>Error:</b> Can't find deck for user with name: " + player1Name + " - <a href='deckBuild.html?participantId=" + player1Name + "'>create deck</a>";
Deck deck2 = deckDao.getDeckForPlayer(player2, "default");
if (deck2 == null)
return "<b>Error:</b> Can't find deck for user with name: " + player2Name + " - <a href='deckBuild.html?participantId=" + player2Name + "'>create deck</a>";
String gameId = createGameOnServer(player1Name, player2Name);
return "Game created, open following links in two windows:<br />" +
"<a href='game.html?gameId=" + gameId + "&participantId=" + player1Name + "'>" + player1Name + "</a><br />" +
"<a href='game.html?gameId=" + gameId + "&participantId=" + player2Name + "'>" + player2Name + "</a>";
}
@Path("/game/{gameId}")
@GET
@Produces(MediaType.APPLICATION_XML)
@@ -80,9 +110,6 @@ public class ServerResource {
// String participantId = getLoggedUser(request);
LotroGameMediator gameMediator = _lotroServer.getGameById(gameId);
if (gameMediator == null)
createGame(gameId);
gameMediator = _lotroServer.getGameById(gameId);
if (gameMediator == null)
sendError(Response.Status.NOT_FOUND);

View File

@@ -1,152 +0,0 @@
/* GENERAL STYLES */
div.menu {
position: absolute;
top: 0;
left: 0;
font-family: verdana;
}
div.menu a {
display: block;
text-decoration: none;
cursor: default;
outline: none;
font-size: 11px;
}
.menu .separator {
height: 1px;
padding: 0;
overflow: hidden;
display: block;
font-size: 1px;
}
.menu ul, .menu li {
margin: 0;
padding: 0;
list-style: none;
}
.menu li {
list-style-position: outside;
}
/* FIREFOX STYLES */
.menu.firefox {
width: 12em;
background: #F4F5EB;
border-top: 1px solid #ddd;
border-left: 1px solid #ddd;
border-right: 1px solid #666;
border-bottom: 1px solid #666;
padding: 2px 0;
}
.menu.firefox a {
color: #555;
padding: 4px 15px;
margin: 0 2px;
}
.menu.firefox a:hover {
background: #006;
color: #fff;
}
.menu.firefox a.disabled {
color: #bbb;
}
.menu.firefox a.disabled:hover {
background: #F4F5EB;
color: #bbb;
}
.menu.firefox .separator {
border-bottom: 1px solid #fff;
background: #999;
margin: 2px 4px;
}
/* GOOGLE STYLES */
.menu.google {
width: 10.5em;
background: #fff;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
border-bottom: 1px solid #676767;
border-right: 1px solid #676767;
}
.menu.google a {
color: #00c;
text-decoration: none;
padding: 2px 5px;
cursor: pointer;
font-size: 12px;
}
.menu.google a:hover {
background: #D3E3FE;
}
.menu.google a.disabled {
color: #bbb;
}
.menu.google a.disabled:hover {
background: #fff;
color: #bbb;
}
.menu.google .separator {
background: #ccc;
}
/* DESKTOP STYLES */
.menu.desktop {
width: 14em;
background: #f9f8f7;
border: 1px solid #999;
padding: 0;
}
.menu.desktop ul, .menu.desktop li {
margin: 0;
padding: 0;
}
.menu.desktop li.separator {
height: 1px;
}
.menu.desktop a {
color: #555;
padding: 3px 0 3px 3px;
margin: 0;
border: 1px solid #f9f8f7;
}
.menu.desktop a.disabled {
opacity: 0.25;
filter: alpha(opacity = 25);
zoom: 1;
}
.menu.desktop li.separator {
border-bottom: 1px solid #fff;
background: #aaa;
margin: 1px 1px 0 1px;
line-height: 1px !important;
}
/* we need explicit enabled class to overcome css deficiences (without creating unnecessary markup) */
.menu.desktop a.enabled:hover {
background-color: #0A246A;
color: #fff;
}

View File

@@ -1,47 +0,0 @@
div.outline {
border: 1px solid #aaa;
padding: 1px;
float: left;
}
input.spin-decimal {
margin: 0;
padding: 0 6px;
text-align: right;
border: medium none;
width: 60px;
font-weight: normal;
font-size: 14px;
}
a {
text-decoration: none;
color: #000;
}
a:hover {
color: #444;
}
a.up {
display: block;
height: 9px;
width: 15px;
background: #ccc url(../images/vista-up.gif);
}
a.up:hover {
background: #ccc url(../images/vista-up-hover.gif);
}
a.dn {
margin-top: 1px;
display: block;
height: 9px;
width: 15px;
background: #ccc url(../images/vista-dn.gif);
}
a.dn:hover {
background: #ccc url(../images/vista-dn-hover.gif);
}

View File

@@ -31,7 +31,6 @@
</style>
<link rel="stylesheet" type="text/css" href="css/dark-hive/jquery-ui-1.8.16.custom.css">
<link rel="stylesheet" type="text/css" href="js/jquery/styles/jquery.spinnercontrol.css">
<link rel="stylesheet" type="text/css" href="css/spinnerControl.css">
<script type="text/javascript" src="js/jquery/jquery-1.6.2.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.16.custom.min.js"></script>

View File

@@ -56,7 +56,6 @@
</style>
<link rel="stylesheet" type="text/css" href="css/dark-hive/jquery-ui-1.8.16.custom.css">
<link rel="stylesheet" type="text/css" href="js/jquery/styles/jquery.spinnercontrol.css">
<link rel="stylesheet" type="text/css" href="css/spinnerControl.css">
<script type="text/javascript" src="js/jquery/jquery-1.6.2.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.16.custom.min.js"></script>

View File

@@ -0,0 +1,56 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Gemp-LotR</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="pragma" content="no-cache"/>
<style type="text/css">
body {
font-size: 12px;
}
</style>
<link rel="stylesheet" type="text/css" href="css/dark-hive/jquery-ui-1.8.16.custom.css">
<link rel="stylesheet" type="text/css" href="js/jquery/styles/jquery.spinnercontrol.css">
<script type="text/javascript" src="js/jquery/jquery-1.6.2.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/inheritance.js"></script>
<script type="text/javascript" src="js/logging.js"></script>
<script type="text/javascript">
$(document).ready(
function() {
/* attach a submit handler to the form */
$("#createGameForm").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
/* get some values from elements on the page: */
var form = $(this);
/* Send the data using post and put the results in a div */
$.post("/gemp-lotr/server/createGame", form.serialize(),
function(data) {
$("#result").empty().append(data);
});
});
});
</script>
</head>
<body>
<body>
<form action="/" id="createGameForm">
<b>Create game:</b><br/>
First player name: <input type="text" name="player1"/><br/>
Second player name: <input type="text" name="player2"/><br/>
<input type="submit" value="Create game"/>
</form>
<!-- the result of the search will be rendered inside this div -->
<div id="result"></div>
</body>
</html>