mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Sickleslicer and Living Weapon mechanic support
This commit is contained in:
parent
a57a8a52c7
commit
7efc3b953b
5 changed files with 136 additions and 1 deletions
|
@ -369,6 +369,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
|
||||
final static Map<String, String> setNameReplacement = new HashMap<String, String>() {
|
||||
{
|
||||
put("MBS", "mirrodin-besieged");
|
||||
put("SOM", "scars-of-mirrodin");
|
||||
put("M11", "magic-2011");
|
||||
put("ROE", "rise-of-the-eldrazi");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
|Generate|TOK:MBS|Germ|
|
||||
|
||||
|Generate|TOK:SOM|Cat|
|
||||
|Generate|TOK:SOM|Soldier|
|
||||
|Generate|TOK:SOM|Goblin|
|
||||
|
|
67
Mage.Sets/src/mage/sets/newphyrexia/Sickleslicer.java
Normal file
67
Mage.Sets/src/mage/sets/newphyrexia/Sickleslicer.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.newphyrexia;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.continious.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.LivingWeaponAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public class Sickleslicer extends CardImpl<Sickleslicer> {
|
||||
|
||||
public Sickleslicer (UUID ownerId) {
|
||||
super(ownerId, 157, "Sickleslicer", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
this.expansionSetCode = "NPH";
|
||||
this.subtype.add("Equipment");
|
||||
this.addAbility(new EquipAbility(Constants.Outcome.BoostCreature, new GenericManaCost(4)));
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2)));
|
||||
this.addAbility(new LivingWeaponAbility());
|
||||
}
|
||||
|
||||
public Sickleslicer (final Sickleslicer card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sickleslicer copy() {
|
||||
return new Sickleslicer(this);
|
||||
}
|
||||
|
||||
}
|
59
Mage/src/mage/abilities/keyword/LivingWeaponAbility.java
Normal file
59
Mage/src/mage/abilities/keyword/LivingWeaponAbility.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
public class LivingWeaponAbility extends EntersBattlefieldTriggeredAbility {
|
||||
public LivingWeaponAbility() {
|
||||
super(new LivingWeaponEffect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Living weapon";
|
||||
}
|
||||
}
|
||||
|
||||
class LivingWeaponEffect extends OneShotEffect<LivingWeaponEffect> {
|
||||
LivingWeaponEffect() {
|
||||
super(Constants.Outcome.PutCreatureInPlay);
|
||||
}
|
||||
|
||||
LivingWeaponEffect(final LivingWeaponEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
GermToken token = new GermToken();
|
||||
token.putOntoBattlefield(game, source.getId(), source.getControllerId());
|
||||
Permanent p = game.getPermanent(token.getLastAddedToken());
|
||||
if (p != null) {
|
||||
p.addAttachment(source.getSourceId(), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingWeaponEffect copy() {
|
||||
return new LivingWeaponEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GermToken extends Token {
|
||||
public GermToken() {
|
||||
super("Germ", "a 0/0 black Germ creature token");
|
||||
cardType.add(Constants.CardType.CREATURE);
|
||||
color = ObjectColor.BLACK;
|
||||
subtype.add("Germ");
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ import mage.game.permanent.PermanentToken;
|
|||
public class Token extends MageObjectImpl<Token> {
|
||||
|
||||
protected String description;
|
||||
private UUID lastAddedTokenId;
|
||||
|
||||
public Token(String name, String description) {
|
||||
this.name = name;
|
||||
|
@ -70,7 +71,11 @@ public class Token extends MageObjectImpl<Token> {
|
|||
return description;
|
||||
}
|
||||
|
||||
public void addAbility(Ability ability) {
|
||||
public UUID getLastAddedToken() {
|
||||
return lastAddedTokenId;
|
||||
}
|
||||
|
||||
public void addAbility(Ability ability) {
|
||||
ability.setSourceId(this.getId());
|
||||
abilities.add(ability);
|
||||
}
|
||||
|
@ -83,6 +88,7 @@ public class Token extends MageObjectImpl<Token> {
|
|||
public boolean putOntoBattlefield(Game game, UUID sourceId, UUID controllerId) {
|
||||
PermanentToken permanent = new PermanentToken(this, controllerId);
|
||||
game.getBattlefield().addPermanent(permanent);
|
||||
this.lastAddedTokenId = permanent.getId();
|
||||
permanent.entersBattlefield(sourceId, game);
|
||||
game.applyEffects();
|
||||
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, Zone.OUTSIDE, Zone.BATTLEFIELD));
|
||||
|
|
Loading…
Reference in a new issue