MBS and improvements

This commit is contained in:
Loki 2011-02-27 21:19:07 +02:00
parent 6653e34bc3
commit 42c2888340
9 changed files with 258 additions and 20 deletions

View file

@ -0,0 +1,102 @@
/*
* 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.scarsofmirrodin;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
*
* @author Loki
*/
public class MolderBeast extends CardImpl<MolderBeast> {
public MolderBeast (UUID ownerId) {
super(ownerId, 125, "Molder Beast", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.expansionSetCode = "SOM";
this.subtype.add("Beast");
this.color.setGreen(true);
this.power = new MageInt(5);
this.toughness = new MageInt(3);
this.addAbility(new MolderBeastTriggeredAbility());
}
public MolderBeast (final MolderBeast card) {
super(card);
}
@Override
public MolderBeast copy() {
return new MolderBeast(this);
}
}
class MolderBeastTriggeredAbility extends TriggeredAbilityImpl<MolderBeastTriggeredAbility> {
MolderBeastTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new BoostSourceEffect(2, 0, Constants.Duration.EndOfTurn));
}
MolderBeastTriggeredAbility(final MolderBeastTriggeredAbility ability) {
super(ability);
}
@Override
public MolderBeastTriggeredAbility copy() {
return new MolderBeastTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD && zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever an artifact is put into a graveyard from the battlefield, Molder Beast gets +2/+0 until end of turn.";
}
}

View file

@ -0,0 +1,96 @@
/*
* 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.scarsofmirrodin;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
/**
*
* @author Loki
*/
public class ViridianRevel extends CardImpl<ViridianRevel> {
public ViridianRevel (UUID ownerId) {
super(ownerId, 132, "Viridian Revel", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}");
this.expansionSetCode = "SOM";
this.color.setGreen(true);
this.addAbility(new ViridianRevelTriggeredAbility());
}
public ViridianRevel (final ViridianRevel card) {
super(card);
}
@Override
public ViridianRevel copy() {
return new ViridianRevel(this);
}
}
class ViridianRevelTriggeredAbility extends TriggeredAbilityImpl<ViridianRevelTriggeredAbility> {
ViridianRevelTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new DrawCardControllerEffect(1), true);
}
ViridianRevelTriggeredAbility(final ViridianRevelTriggeredAbility ability) {
super(ability);
}
@Override
public ViridianRevelTriggeredAbility copy() {
return new ViridianRevelTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD && game.getOpponents(this.getControllerId()).contains(zEvent.getPlayerId())) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever an artifact is put into an opponent's graveyard from the battlefield, you may draw a card.";
}
}

View file

@ -0,0 +1,19 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.counters.CounterType;
import mage.game.Game;
public class HaveCounter implements Condition {
private CounterType counterType;
public HaveCounter(CounterType type) {
this.counterType = type;
}
@Override
public boolean apply(Game game, Ability source) {
return game.getPermanent(source.getSourceId()).getCounters().getCount(counterType) > 0;
}
}

View file

@ -37,6 +37,8 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -62,15 +64,19 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
int affectedTargets = 0;
for (UUID permanentId : source.getTargets().get(0).getTargets()) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null) {
permanent.addAbility(ability.copy());
return true;
affectedTargets++;
}
return false;
}
return affectedTargets > 0;
}
@Override
//TODO redone text for multiple targets
public String getText(Ability source) {
StringBuilder sb = new StringBuilder();
sb.append("Target ").append(source.getTargets().get(0).getTargetName()).append(" gains ");

View file

@ -35,6 +35,8 @@ import mage.counters.Counter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -45,12 +47,6 @@ public class AddCountersTargetEffect extends OneShotEffect<AddCountersTargetEffe
private String name;
private Counter counter;
public AddCountersTargetEffect(String name, int amount) {
super(Outcome.Benefit);
this.name = name;
this.amount = amount;
}
public AddCountersTargetEffect(Counter counter) {
super(Outcome.Benefit);
this.name = counter.getName();
@ -66,7 +62,9 @@ public class AddCountersTargetEffect extends OneShotEffect<AddCountersTargetEffe
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
int affectedTargets = 0;
for (UUID permanentId : source.getTargets().get(0).getTargets()) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null) {
if (counter != null) {
permanent.addCounters(counter);
@ -74,7 +72,8 @@ public class AddCountersTargetEffect extends OneShotEffect<AddCountersTargetEffe
permanent.addCounters(name, amount);
}
}
return true;
}
return affectedTargets > 0;
}
@Override

View file

@ -46,7 +46,8 @@ public enum CounterType {
FEATHER(new FeatherCounter().name),
QUEST(new QuestCounter().name),
ARROWHEAD(new ArrowheadCounter().name),
EON(new EonCounter().name);
EON(new EonCounter().name),
AWAKENING(new AwakeningCounter().name);
private String name;
@ -102,6 +103,8 @@ public enum CounterType {
return new ArrowheadCounter(amount);
case EON:
return new EonCounter(amount);
case AWAKENING:
return new AwakeningCounter(amount);
}
return null;
}

View file

@ -0,0 +1,14 @@
package mage.counters.common;
import mage.counters.Counter;
public class AwakeningCounter extends Counter<AwakeningCounter> {
public AwakeningCounter() {
this(1);
}
public AwakeningCounter(int amount) {
super("Awakening");
this.count = amount;
}
}

View file

@ -30,9 +30,7 @@ package mage.sets.[=$longset=];
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;[= if (defined($power)) {$OUT .= "\nimport mage.MageInt;"}=]
import mage.Constants.Rarity;[= if (defined($power)) {$OUT .= "\nimport mage.MageInt;"}=]
import mage.cards.CardImpl;
/**

View file

@ -365,6 +365,7 @@ foreach my $div (@divs) {
}
}
if ($id =~m/currentSetSymbol/) {
print "*** " . $div->as_HTML();
my ($imgurl) = $div->look_down('_tag', 'img');
$imgurl->attr('src') =~m/set=(\w+)\&.*rarity=(\w+)/;
my $multiverseid = $multiverses[0];