Merge origin/master

This commit is contained in:
fireshoes 2015-06-22 18:47:51 -05:00
commit cda11b280c
14 changed files with 384 additions and 105 deletions

View file

@ -33,6 +33,7 @@ import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
/**
@ -58,9 +59,12 @@ public class ReturnToLibrarySpellEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
if (spellCard != null) {
controller.moveCardToLibraryWithInfo(spellCard, source.getSourceId(), game, Zone.STACK, toTop, true);
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
if (spellCard != null) {
controller.moveCardToLibraryWithInfo(spellCard, source.getSourceId(), game, Zone.STACK, toTop, true);
}
}
return true;
}

View file

@ -141,7 +141,9 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
return kickerCost;
}
public void resetKicker() {
public void resetKicker(Game game, Ability source) {
String key = getActivationKey(source, "", game);
activations.remove(key);
for (OptionalAdditionalCost cost: kickerCosts) {
cost.reset();
}
@ -196,13 +198,13 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
if (ability instanceof SpellAbility) {
Player player = game.getPlayer(controllerId);
if (player != null) {
this.resetKicker();
this.resetKicker(game, ability);
for (OptionalAdditionalCost kickerCost: kickerCosts) {
boolean again = true;
while (player.isInGame() && again) {
String times = "";
if (kickerCost.isRepeatable()) {
int activatedCount = kickerCost.getActivateCount();
int activatedCount = getKickedCounter(game, ability);
times = Integer.toString(activatedCount + 1) + (activatedCount == 0 ? " time ":" times ");
}
if (kickerCost.canPay(ability, sourceId, controllerId, game) &&

View file

@ -585,7 +585,28 @@ public class GameState implements Serializable, Copyable<GameState> {
newPlayerList.setCurrent(playerId);
return newPlayerList;
}
/**
* Returns a list of all active players of the game in range of playerId,
* also setting the playerId to the current player of the list.
*
* @param playerId
* @param game
* @return playerList
*/
public PlayerList getPlayersInRange(UUID playerId, Game game) {
PlayerList newPlayerList = new PlayerList();
Player currentPlayer = game.getPlayer(playerId);
if (currentPlayer != null) {
for (Player player: players.values()) {
if (!player.hasLeft()&& !player.hasLost() && currentPlayer.getInRange().contains(player.getId())) {
newPlayerList.add(player.getId());
}
}
newPlayerList.setCurrent(playerId);
}
return newPlayerList;
}
public Permanent getPermanent(UUID permanentId) {
if (permanentId != null && battlefield.containsPermanent(permanentId)) {
Permanent permanent = battlefield.getPermanent(permanentId);