merge latest trunk

This commit is contained in:
myk
2013-03-10 15:34:49 +00:00
17 changed files with 228 additions and 91 deletions

3
.gitattributes vendored
View File

@@ -215,6 +215,7 @@ res/cardsfolder/a/ali_baba.txt svneol=native#text/plain
res/cardsfolder/a/ali_from_cairo.txt svneol=native#text/plain
res/cardsfolder/a/alibans_tower.txt svneol=native#text/plain
res/cardsfolder/a/all_hallows_eve.txt svneol=native#text/plain
res/cardsfolder/a/all_in_good_time.txt -text
res/cardsfolder/a/all_is_dust.txt svneol=native#text/plain
res/cardsfolder/a/all_shall_smolder_in_my_wake.txt -text
res/cardsfolder/a/all_suns_dawn.txt svneol=native#text/plain
@@ -4241,6 +4242,7 @@ res/cardsfolder/g/gobhobbler_rats.txt svneol=native#text/plain
res/cardsfolder/g/goblin_archaeologist.txt -text
res/cardsfolder/g/goblin_arsonist.txt svneol=native#text/plain
res/cardsfolder/g/goblin_artillery.txt svneol=native#text/plain
res/cardsfolder/g/goblin_assassin.txt -text
res/cardsfolder/g/goblin_assault.txt svneol=native#text/plain
res/cardsfolder/g/goblin_balloon_brigade.txt svneol=native#text/plain
res/cardsfolder/g/goblin_bangchuckers.txt -text
@@ -6323,6 +6325,7 @@ res/cardsfolder/m/man_o_war.txt svneol=native#text/plain
res/cardsfolder/m/mana_bloom.txt -text
res/cardsfolder/m/mana_breach.txt svneol=native#text/plain
res/cardsfolder/m/mana_chains.txt -text
res/cardsfolder/m/mana_clash.txt -text
res/cardsfolder/m/mana_crypt.txt svneol=native#text/plain
res/cardsfolder/m/mana_cylix.txt svneol=native#text/plain
res/cardsfolder/m/mana_drain.txt svneol=native#text/plain

View File

@@ -70,6 +70,11 @@ Feeding Grounds
Horizon Boughs
New Schemes:
All in Good Time
New Vanguard Avatars:

View File

@@ -0,0 +1,9 @@
Name:All in Good Time
ManaCost:no cost
Types:Scheme
Text:no text
T:Mode$ SetInMotion | ValidCard$ Card.Self | Execute$ GoodTimes | TriggerZones$ Command | TriggerDescription$ When you set this scheme in motion, take an extra turn after this one. Schemes can't be set in motion that turn.
SVar:GoodTimes:AB$ AddTurn | Cost$ 0 | NumTurns$ 1 | NoSchemes$ True
SVar:Picture:http://www.cardforge.org/fpics/lq_schemes/all_in_good_time.jpg
Oracle:When you set this scheme in motion, take an extra turn after this one. Schemes can't be set in motion that turn.
SetInfo:ARC Common

View File

@@ -0,0 +1,14 @@
Name:Goblin Assassin
ManaCost:3 R R
Types:Creature Goblin Assassin
Text:no text
PT:2/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ RepeatFlips | TriggerDescription$ Whenever CARDNAME or another Goblin enters the battlefield, each player flips a coin. Each player whose coin comes up tails sacrifices a creature.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Goblin.Other+YouCtrl | TriggerZones$ Battlefield | Execute$ RepeatFlips | Secondary$ True | TriggerDescription$ Whenever CARDNAME or another Goblin enters the battlefield, each player flips a coin. Each player whose coin comes up tails sacrifices a creature.
SVar:RepeatFlips:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ AssassinsFlip | SubAbility$ Assassination
SVar:AssassinsFlip:DB$ FlipACoin | Flipper$ Remembered | NoCall$ True | RememberResult$ True
SVar:Assassination:DB$ Sacrifice | Defined$ FlippedTails | SacValid$ Creature | Amount$ 1 | SubAbility$ ResetFlips
SVar:ResetFlips:DB$ Cleanup | ClearCoinFlips$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/goblin_assassin.jpg
Oracle:Whenever Goblin Assassin or another Goblin enters the battlefield, each player flips a coin. Each player whose coin comes up tails sacrifices a creature.
SetInfo:LGN Uncommon

View File

@@ -0,0 +1,21 @@
Name:Mana Clash
ManaCost:R
Types:Sorcery
Text:no text
A:SP$ Repeat | Cost$ R | ValidTgts$ Opponent | RepeatCheckSVar$ RepeatCheck | RepeatSVarCompare$ GT0 | RepeatSubAbility$ ResetCheck | StackDescription$ SpellDescription | SpellDescription$ You and target opponent each flip a coin. CARDNAME deals 1 damage to each player whose coin comes up tails. Repeat this process until both players' coins come up heads on the same flip.
SVar:ResetCheck:DB$ StoreSVar | SVar$ RepeatCheck | Type$ Number | Expression$ 0 | SubAbility$ RepeatClash
SVar:RepeatClash:DB$ RepeatEach | RepeatPlayers$ TargetedAndYou | RepeatSubAbility$ FlipClash | SubAbility$ ClashDamage
SVar:FlipClash:DB$ FlipACoin | Flipper$ Remembered | NoCall$ True | TailsSubAbility$ ClashTails | RememberResult$ True
SVar:ClashTails:DB$ StoreSVar | SVar$ RepeatCheck | Type$ CountSVar | Expression$ RepeatCheck/Plus.1
SVar:ClashDamage:DB$ DamageAll | ValidPlayers$ FlippedTails | NumDmg$ 1 | SubAbility$ ResetFlips
SVar:ResetFlips:DB$ Cleanup | ClearCoinFlips$ True
SVar:RepeatCheck:Number$ 0
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/mana_clash.jpg
Oracle:You and target opponent each flip a coin. Mana Clash deals 1 damage to each player whose coin comes up tails. Repeat this process until both players' coins come up heads on the same flip.
SetInfo:8ED Rare
SetInfo:7ED Rare
SetInfo:DRK Rare
SetInfo:9ED Rare
SetInfo:5ED Rare
SetInfo:4ED Rare

View File

@@ -3,7 +3,7 @@ ManaCost:3 R
Types:Creature Elemental
PT:*/*
K:ETBReplacement:Other:TrigFlip
SVar:TrigFlip:DB$ FlipACoin | WinSubAbility$ DBAttacker | LoseSubAbility$ DBDefender | SpellDescription$ As Molten Sentry enters the battlefield, flip a coin. If the coin comes up heads, Molten Sentry enters the battlefield as a 5/2 creature with haste. If it comes up tails, Molten Sentry enters the battlefield as a 2/5 creature with defender.
SVar:TrigFlip:DB$ FlipACoin | NoCall$ True | HeadsSubAbility$ DBAttacker | TailsSubAbility$ DBDefender | SpellDescription$ As Molten Sentry enters the battlefield, flip a coin. If the coin comes up heads, Molten Sentry enters the battlefield as a 5/2 creature with haste. If it comes up tails, Molten Sentry enters the battlefield as a 2/5 creature with defender.
SVar:DBAttacker:DB$ Animate | Cost$ 0 | Defined$ Self | Power$ 5 | Toughness$ 2 | Types$ Creature | Keywords$ Haste | Permanent$ True
SVar:DBDefender:DB$ Animate | Cost$ 0 | Defined$ Self | Power$ 2 | Toughness$ 5 | Types$ Creature | Keywords$ Defender | Permanent$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/molten_sentry.jpg

View File

@@ -125,6 +125,7 @@ public class Card extends GameEntity implements Comparable<Card> {
private final ArrayList<Card> encodedCards = new ArrayList<Card>();
private Card championedCard = null;
private final List<Card> devouredCards = new ArrayList<Card>();
private Map<Player, String> flipResult = new TreeMap<Player, String>();
private Map<Card, Integer> receivedDamageFromThisTurn = new TreeMap<Card, Integer>();
private Map<Card, Integer> dealtDamageToThisTurn = new TreeMap<Card, Integer>();
@@ -758,6 +759,39 @@ public class Card extends GameEntity implements Comparable<Card> {
this.encodedCards.clear();
}
/**
* <p>
* addFlipResult.
* </p>
*
* @param flipper The Player who flipped the coin.
* @param result The result of the coin flip as a String.
*/
public final void addFlipResult(final Player flipper, final String result) {
this.flipResult.put(flipper, result);
}
/**
* <p>
* getFlipResult.
* </p>
*
* @param flipper The Player who flipped the coin.
* @return a String result - Heads or Tails.
*/
public final String getFlipResult(final Player flipper) {
return this.flipResult.get(flipper);
}
/**
* <p>
* clearFlipResult.
* </p>
*/
public final void clearFlipResult() {
this.flipResult.clear();
}
/**
* <p>
* Setter for the field <code>championedCard</code>.

View File

@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.JOptionPane;
import org.apache.commons.lang3.StringUtils;
@@ -26,12 +25,10 @@ import forge.game.GameActionUtil;
import forge.game.GameState;
import forge.game.ai.ComputerUtil;
import forge.game.ai.ComputerUtilCost;
import forge.game.event.FlipCoinEvent;
import forge.game.player.AIPlayer;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
import forge.util.Expressions;
import forge.util.MyRandom;
/**
* TODO: Write javadoc for this type.
@@ -708,6 +705,12 @@ public class AbilityUtils {
players.add(p);
}
}
} else if (defined.equals("TargetedAndYou")) {
final SpellAbility saTargeting = sa.getSATargetingPlayer();
if (saTargeting != null) {
players.addAll(saTargeting.getTarget().getTargetPlayers());
players.add(sa.getActivatingPlayer());
}
} else if (defined.equals("Remembered")) {
for (final Object rem : card.getRemembered()) {
if (rem instanceof Player) {
@@ -864,6 +867,14 @@ public class AbilityUtils {
if (!players.contains(p)) {
players.add(p);
}
} else if (defined.startsWith("Flipped")) {
for (Player p : Singletons.getModel().getGame().getPlayers()) {
if (null != sa.getSourceCard().getFlipResult(p)) {
if (sa.getSourceCard().getFlipResult(p).equals(defined.substring(7))) {
players.add(p);
}
}
}
} else if (defined.equals("You")) {
players.add(sa.getActivatingPlayer());
} else if (defined.equals("Each")) {
@@ -1257,28 +1268,4 @@ public class AbilityUtils {
return CardFactoryUtil.xCount(c, s);
}
/**
* <p>
* flipACoin without call.
* </p>
*
* @param source
* a {@link forge.Card} object.
* @return a boolean.
*/
public static boolean flipCoin(final Card source) {
final boolean resultIsHeads = MyRandom.getRandom().nextBoolean();
Singletons.getModel().getGame().getEvents().post(new FlipCoinEvent());
final StringBuilder msgTitle = new StringBuilder();
msgTitle.append(source);
msgTitle.append(" Flip result:");
final StringBuilder result = new StringBuilder();
result.append("Flip comes up");
result.append(resultIsHeads ? " heads." : " tails.");
JOptionPane.showMessageDialog(null, result, msgTitle.toString(), JOptionPane.PLAIN_MESSAGE);
return resultIsHeads;
}
}

View File

@@ -59,6 +59,9 @@ public class AddTurnEffect extends SpellAbilityEffect {
if (sa.hasParam("SkipUntap")) {
extra.setSkipUntap(true);
}
if (sa.hasParam("NoSchemes")) {
extra.setCantSetSchemesInMotion(true);
}
}
}
}

View File

@@ -87,15 +87,7 @@ public class ChooseTypeEffect extends SpellAbilityEffect {
for (final String s : invalidTypes) {
validChoices.remove(s);
}
final Object o = GuiChoose.one("Choose a creature type", validChoices);
if (null == o) {
return;
}
final String choice = (String) o;
if (CardType.isACreatureType(choice) && !invalidTypes.contains(choice)) {
valid = true;
card.setChosenType(choice);
}
chosenType = GuiChoose.one("Choose a creature type", validChoices);
} else {
Player ai = sa.getActivatingPlayer();
Player opp = ai.getOpponent();

View File

@@ -37,6 +37,9 @@ public class CleanUpEffect extends SpellAbilityEffect {
if (sa.hasParam("ClearTriggered")) {
Singletons.getModel().getGame().getTriggerHandler().clearDelayedTrigger(source);
}
if (sa.hasParam("ClearCoinFlips")) {
source.clearFlipResult();
}
}
}

View File

@@ -2,14 +2,19 @@ package forge.card.ability.effects;
import java.util.List;
import javax.swing.JOptionPane;
import forge.Card;
import forge.Singletons;
import forge.card.ability.AbilityFactory;
import forge.card.ability.AbilityUtils;
import forge.card.ability.SpellAbilityEffect;
import forge.card.spellability.AbilitySub;
import forge.card.spellability.SpellAbility;
import forge.game.event.FlipCoinEvent;
import forge.game.player.Player;
import forge.gui.GuiDialog;
import forge.util.MyRandom;
public class FlipCoinEffect extends SpellAbilityEffect {
@@ -32,7 +37,12 @@ public class FlipCoinEffect extends SpellAbilityEffect {
final Card host = sa.getSourceCard();
final Player player = host.getController();
final List<Player> caller = AbilityUtils.getDefinedPlayers(sa.getSourceCard(), sa.getParam("Caller"), sa);
final List<Player> playersToFlip = AbilityUtils.getDefinedPlayers(host, sa.getParam("Flipper"), sa);
if (playersToFlip.isEmpty()) {
playersToFlip.add(sa.getActivatingPlayer());
}
final List<Player> caller = AbilityUtils.getDefinedPlayers(host, sa.getParam("Caller"), sa);
if (caller.isEmpty()) {
caller.add(player);
}
@@ -40,20 +50,21 @@ public class FlipCoinEffect extends SpellAbilityEffect {
final boolean noCall = sa.hasParam("NoCall");
boolean victory = false;
if (!noCall) {
victory = GuiDialog.flipCoin(caller.get(0), sa.getSourceCard());
victory = GuiDialog.flipCoin(caller.get(0), host);
}
// Run triggers
// HashMap<String,Object> runParams = new HashMap<String,Object>();
// runParams.put("Player", player);
if (sa.getParam("RememberAll") != null) {
host.addRemembered(host);
final boolean rememberResult = sa.hasParam("RememberResult");
for (final Player flipper : playersToFlip) {
if (noCall) {
final boolean resultIsHeads = FlipCoinEffect.flipCoinNoCall(sa.getSourceCard(), flipper);
if (rememberResult) {
host.addFlipResult(flipper, resultIsHeads ? "Heads" : "Tails");
}
if (noCall) {
final boolean resultIsHeads = AbilityUtils.flipCoin(sa.getSourceCard());
System.out.println("Flipped coin result:" + (resultIsHeads ? " Heads" : " Tails"));
if (resultIsHeads) {
if (sa.hasParam("HeadsSubAbility")) {
final SpellAbility heads = AbilityFactory.getAbility(host.getSVar(sa.getParam("HeadsSubAbility")), host);
@@ -98,8 +109,34 @@ public class FlipCoinEffect extends SpellAbilityEffect {
// runParams.put("Won","False");
}
}
}
// AllZone.getTriggerHandler().runTrigger("FlipsACoin",runParams);
}
/**
* <p>
* flipCoinNoCall Flip a coin without any call.
* </p>
*
* @param source the source card.
* @param flipper the player flipping the coin.
* @return a boolean.
*/
public static boolean flipCoinNoCall(final Card source, final Player flipper) {
final boolean resultIsHeads = MyRandom.getRandom().nextBoolean();
Singletons.getModel().getGame().getEvents().post(new FlipCoinEvent());
final StringBuilder msgTitle = new StringBuilder();
msgTitle.append(source);
msgTitle.append(" Flip result:");
final StringBuilder result = new StringBuilder();
result.append(flipper.getName());
result.append("'s flip comes up");
result.append(resultIsHeads ? " heads." : " tails.");
JOptionPane.showMessageDialog(null, result, msgTitle.toString(), JOptionPane.PLAIN_MESSAGE);
return resultIsHeads;
}
}

View File

@@ -159,10 +159,12 @@ public class MatchController {
getInput().clearInput();
getInput().resetInput();
getInput().setNewInput(currentGame);
Thread thGame = new GameInputUpdatesThread(this, currentGame);
thGame.setName("Game input updater");
thGame.start();
// Thread thGame = new GameInputUpdatesThread(this, currentGame);
// thGame.setName("Game input updater");
// thGame.start();
// TODO restore this functionality!!!
//VMatchUI.SINGLETON_INSTANCE.getViewDevMode().getDocument().setVisible(Preferences.DEV_MODE);

View File

@@ -33,6 +33,7 @@ public class ExtraTurn {
private Player player = null;
private boolean loseAtEndStep = false;
private boolean skipUntap = false;
private boolean cantSetSchemesInMotion = false;
/**
* TODO: Write javadoc for Constructor.
* @param player the player
@@ -83,4 +84,18 @@ public class ExtraTurn {
this.skipUntap = skipUntap;
}
/**
* @return true if Schemes can't be played during the extra turn
*/
public boolean isCantSetSchemesInMotion() {
return cantSetSchemesInMotion;
}
/**
* @param noSchemes set boolean if schemes can't be played this extra turn
*/
public void setCantSetSchemesInMotion(boolean noSchemes) {
this.cantSetSchemesInMotion = noSchemes;
}
} //end class Untap

View File

@@ -540,16 +540,16 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
p.removeKeyword("At the beginning of this turn's end step, you lose the game.");
p.removeKeyword("Skip the untap step of this turn.");
p.removeKeyword("Schemes can't be set in motion this turn.");
}
Player next = getNextActivePlayer();
VField nextField = CMatchUI.SINGLETON_INSTANCE.getFieldViewFor(next);
SDisplayUtil.showTab(nextField);
if(game.getType() == GameType.Planechase) {
if (game.getType() == GameType.Planechase) {
Card p = game.getActivePlane();
if(p != null)
{
if (p != null) {
p.clearControllers();
p.addController(next);
game.getAction().controllerChangeZoneCorrection(p);
@@ -580,6 +580,9 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
if (extraTurn.isSkipUntap()) {
nextTurn.addKeyword("Skip the untap step of this turn.");
}
if (extraTurn.isCantSetSchemesInMotion()) {
nextTurn.addKeyword("Schemes can't be set in motion this turn.");
}
return nextTurn;
}
if (nextTurn.skipTurnTimeVault()) {

View File

@@ -224,6 +224,11 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
}
public void setSchemeInMotion() {
for (final Player p : game.getPlayers()) {
if (p.hasKeyword("Schemes can't be set in motion this turn.")) {
return;
}
}
// Replacement effects
final HashMap<String, Object> repRunParams = new HashMap<String, Object>();

View File

@@ -21,10 +21,11 @@ import java.util.Observable;
import java.util.Observer;
import forge.Card;
import forge.Singletons;
import forge.control.input.Input;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.util.MyObservable;
import forge.view.ButtonUtil;
/**
* <p>
@@ -34,7 +35,7 @@ import forge.util.MyObservable;
* @author Forge
* @version $Id$
*/
public class InputProxy extends MyObservable implements Observer {
public class InputProxy implements Observer {
/** The input. */
private Input input;
@@ -42,7 +43,10 @@ public class InputProxy extends MyObservable implements Observer {
@Override
public final synchronized void update(final Observable observable, final Object obj) {
ButtonUtil.disableAll();
valid = false;
Singletons.getModel().getMatch().getInput().setNewInput(Singletons.getModel().getGame());
}
/**
* <p>