Propaganda and Ghostly Prison

This commit is contained in:
Loki 2011-05-25 13:50:03 +03:00
parent e38111072d
commit f8d9f36ced
8 changed files with 309 additions and 2 deletions

View file

@ -25,7 +25,7 @@ public class ManaSymbols {
private static final String[] sets = {"DIS", "GPT", "RAV", "MRD",
"10E", "HOP", "ALA", "CFX", "ARB", "ZEN", "WWK", "ROE", "SOM", "M10", "M11",
"MBS", "DDF", "DST", "EVE", "APC", "NPH"};
"MBS", "DDF", "DST", "EVE", "APC", "NPH", "TMP", "CHK"};
static public void loadImages() {

View file

@ -13,13 +13,14 @@ import static org.mage.plugins.card.dl.DownloadJob.toFile;
public class GathererSets implements Iterable<DownloadJob> {
private static final File outDir = new File("plugins/images/sets");
private static final String[] symbols = {"DIS", "DST", "GPT", "RAV", "MRD", "10E", "HOP", "EVE", "APC"};
private static final String[] symbols = {"DIS", "DST", "GPT", "RAV", "MRD", "10E", "HOP", "EVE", "APC", "TMP", "CHK"};
private static final String[] withMythics = {"ALA", "CFX", "ARB", "ZEN", "WWK", "ROE", "SOM", "M10", "M11", "DDF", "MBS", "NPH"};
private static final HashMap<String, String> symbolsReplacements = new HashMap<String, String>();
static {
symbolsReplacements.put("CFX", "CON");
symbolsReplacements.put("APC", "AP");
symbolsReplacements.put("TMP", "TE");
}
@Override

View file

@ -0,0 +1,26 @@
package mage.sets;
import mage.Constants;
import mage.cards.ExpansionSet;
import java.util.GregorianCalendar;
public class ChampionsOfKamigawa extends ExpansionSet {
private static final ChampionsOfKamigawa fINSTANCE = new ChampionsOfKamigawa();
public static ChampionsOfKamigawa getInstance() {
return fINSTANCE;
}
private ChampionsOfKamigawa() {
super("Champions of Kamigawa", "CHK", "", "mage.sets.championsofkamigawa", new GregorianCalendar(2004, 9, 1).getTime(), Constants.SetType.EXPANSION);
this.blockName = "Champions of Kamigawa";
this.hasBoosters = true;
this.numBoosterLands = 1;
this.numBoosterCommon = 10;
this.numBoosterUncommon = 3;
this.numBoosterRare = 1;
this.ratioBoosterMythic = 8;
}
}

View file

@ -66,6 +66,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
cards = new ArrayList<Card>();
this.addSet(AlaraReborn.getInstance());
this.addSet(Apocalypse.getInstance());
this.addSet(ChampionsOfKamigawa.getInstance());
this.addSet(Conflux.getInstance());
this.addSet(Darksteel.getInstance());
this.addSet(Dissension.getInstance());
@ -84,6 +85,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
this.addSet(ShardsOfAlara.getInstance());
this.addSet(ScarsOfMirrodin.getInstance());
this.addSet(Tenth.getInstance());
this.addSet(Tempest.getInstance());
this.addSet(Worldwake.getInstance());
this.addSet(Zendikar.getInstance());
}

View file

@ -0,0 +1,24 @@
package mage.sets;
import mage.Constants;
import mage.cards.ExpansionSet;
import java.util.GregorianCalendar;
public class Tempest extends ExpansionSet {
private static final Tempest fINSTANCE = new Tempest();
public static Tempest getInstance() {
return fINSTANCE;
}
private Tempest() {
super("Tempest", "TMP", "", "mage.sets.tempest", new GregorianCalendar(1997, 9, 1).getTime(), Constants.SetType.EXPANSION);
this.hasBoosters = true;
this.numBoosterLands = 1;
this.numBoosterCommon = 10;
this.numBoosterUncommon = 3;
this.numBoosterRare = 1;
this.ratioBoosterMythic = 0;
}
}

View file

@ -0,0 +1,126 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
*
* @author Loki
*/
public class GhostlyPrison extends CardImpl<GhostlyPrison> {
public GhostlyPrison (UUID ownerId) {
super(ownerId, 10, "Ghostly Prison", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
this.expansionSetCode = "CHK";
this.color.setWhite(true);
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GhostlyPrisonReplacementEffect()));
}
public GhostlyPrison (final GhostlyPrison card) {
super(card);
}
@Override
public GhostlyPrison copy() {
return new GhostlyPrison(this);
}
}
class GhostlyPrisonReplacementEffect extends ReplacementEffectImpl<GhostlyPrisonReplacementEffect> {
private static final String effectText = "Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you";
GhostlyPrisonReplacementEffect ( ) {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Neutral);
}
GhostlyPrisonReplacementEffect ( GhostlyPrisonReplacementEffect effect ) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
Player player = game.getPlayer(event.getPlayerId());
if ( player != null ) {
ManaCostsImpl propagandaTax = new ManaCostsImpl("{2}");
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
player.chooseUse(Constants.Outcome.Neutral, "Pay {2} to declare attacker?", game) )
{
propagandaTax.pay(game, this.getId(), event.getPlayerId(), false);
if ( propagandaTax.isPaid() ) {
return false;
}
}
}
return true;
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER ) {
return true;
}
return false;
}
@Override
public GhostlyPrisonReplacementEffect copy() {
return new GhostlyPrisonReplacementEffect(this);
}
@Override
public String getText(Ability source) {
return effectText;
}
}

View file

@ -0,0 +1,126 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.tempest;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
*
* @author Loki
*/
public class Propaganda extends CardImpl<Propaganda> {
public Propaganda (UUID ownerId) {
super(ownerId, 80, "Propaganda", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
this.expansionSetCode = "TMP";
this.color.setBlue(true);
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new PropagandaReplacementEffect()));
}
public Propaganda (final Propaganda card) {
super(card);
}
@Override
public Propaganda copy() {
return new Propaganda(this);
}
}
class PropagandaReplacementEffect extends ReplacementEffectImpl<PropagandaReplacementEffect> {
private static final String effectText = "Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you";
PropagandaReplacementEffect ( ) {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Neutral);
}
PropagandaReplacementEffect ( PropagandaReplacementEffect effect ) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
Player player = game.getPlayer(event.getPlayerId());
if ( player != null ) {
ManaCostsImpl propagandaTax = new ManaCostsImpl("{2}");
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
player.chooseUse(Constants.Outcome.Neutral, "Pay {2} to declare attacker?", game) )
{
propagandaTax.pay(game, this.getId(), event.getPlayerId(), false);
if ( propagandaTax.isPaid() ) {
return false;
}
}
}
return true;
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER ) {
return true;
}
return false;
}
@Override
public PropagandaReplacementEffect copy() {
return new PropagandaReplacementEffect(this);
}
@Override
public String getText(Ability source) {
return effectText;
}
}

View file

@ -236,6 +236,8 @@ $knownSets{'MRD'} = 'mirrodin';
$knownSets{'DDF'} = 'elspethvstezzeret';
$knownSets{'MBS'} = 'mirrodinbesieged';
$knownSets{'NPH'} = 'newphyrexia';
$knownSets{'TMP'} = 'tempest';
$knownSets{'CHK'} = 'championsofkamigawa';
my %raritiesConversion;
$raritiesConversion{'C'} = 'COMMON';