mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Minor changes to logging and formatting, token usage, flip handling.
This commit is contained in:
parent
20453be5ff
commit
dc881d3330
10 changed files with 28 additions and 32 deletions
|
@ -54,6 +54,7 @@ import mage.target.common.TargetCardInGraveyard;
|
|||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.FlipSourceEffect;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
|
@ -76,9 +77,6 @@ public class NezumiGraverobber extends CardImpl<NezumiGraverobber> {
|
|||
ability.addTarget(new TargetCardInOpponentsGraveyard(new FilterCard("card from an opponent's graveyard")));
|
||||
ability.addEffect(new NezumiGraverobberFlipEffect());
|
||||
this.addAbility(ability);
|
||||
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new CopyTokenEffect(new NighteyesTheDesecratorToken()), FlippedCondition.getInstance(), ""));
|
||||
ability.setRuleVisible(false);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public NezumiGraverobber(final NezumiGraverobber card) {
|
||||
|
@ -109,14 +107,11 @@ class NezumiGraverobberFlipEffect extends OneShotEffect<NezumiGraverobberFlipEff
|
|||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
if (player.getGraveyard().size() == 0) {
|
||||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null) {
|
||||
p.flip(game);
|
||||
}
|
||||
return new FlipSourceEffect(new NighteyesTheDesecratorToken()).apply(game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -109,15 +109,6 @@ class SnapcasterMageEffect extends ContinuousEffectImpl<SnapcasterMageEffect> {
|
|||
return new SnapcasterMageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (card != null && sourcePermanent != null) {
|
||||
game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(" gives flashback to ").append(card.getName()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
||||
|
|
|
@ -28,12 +28,15 @@
|
|||
package mage.sets.mirrodin;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
|
@ -52,10 +55,12 @@ public class LightningGreaves extends CardImpl<LightningGreaves> {
|
|||
this.subtype.add("Equipment");
|
||||
|
||||
// Equipped creature has haste and shroud.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.EQUIPMENT)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ShroudAbility.getInstance(), AttachmentType.EQUIPMENT)));
|
||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.EQUIPMENT));
|
||||
Effect effect = new GainAbilityAttachedEffect(ShroudAbility.getInstance(), AttachmentType.EQUIPMENT);
|
||||
effect.setText("and shroud");
|
||||
this.addAbility(ability);
|
||||
// Equip {0}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, null));
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(0)));
|
||||
}
|
||||
|
||||
public LightningGreaves(final LightningGreaves card) {
|
||||
|
|
|
@ -55,9 +55,12 @@ public class SelesnyaGuildmage extends CardImpl<SelesnyaGuildmage> {
|
|||
this.subtype.add("Wizard");
|
||||
this.color.setGreen(true);
|
||||
this.color.setWhite(true);
|
||||
this.power = new MageInt(2);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SaprolingToken()), new ManaCostsImpl("{3}{G}")));
|
||||
|
||||
// {3}{G}: Put a 1/1 green Saproling creature token onto the battlefield.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SaprolingToken()), new ManaCostsImpl("{3}{G}")));
|
||||
// {3}{W}: Creatures you control get +1/+1 until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{3}{W}")));
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class FetchLandActivatedAbility extends ActivatedAbilityImpl<FetchLandAct
|
|||
addCost(new SacrificeSourceCost());
|
||||
FilterCard filter = new FilterCard(subTypeNames(subtypes));
|
||||
filter.add(new CardTypePredicate(CardType.LAND));
|
||||
ArrayList<Predicate<MageObject>> subtypePredicates = new ArrayList<Predicate<MageObject>>();
|
||||
ArrayList<Predicate<MageObject>> subtypePredicates = new ArrayList<>();
|
||||
for(int i = 0; i < subtypes.length; i++){
|
||||
subtypePredicates.add(new SubtypePredicate(subtypes[i]));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import mage.constants.Outcome;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -32,10 +33,12 @@ public class FlipSourceEffect extends OneShotEffect<FlipSourceEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (permanent != null && controller != null) {
|
||||
if (permanent.flip(game)) {
|
||||
ContinuousEffect effect = new ConditionalContinousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), "");
|
||||
game.addEffect(effect, source);
|
||||
game.informPlayers(new StringBuilder(controller.getName()).append(" flips ").append(permanent.getName()).toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,17 +126,13 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl<GainAbilityA
|
|||
}
|
||||
sb.append(" creature ");
|
||||
if (duration == Duration.WhileOnBattlefield) {
|
||||
sb.append("has \"");
|
||||
sb.append("has ");
|
||||
} else {
|
||||
sb.append("gains ");
|
||||
}
|
||||
sb.append(ability.getRule());
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ").append(duration.toString());
|
||||
} else {
|
||||
if (duration == Duration.WhileOnBattlefield) {
|
||||
sb.append("\"");
|
||||
}
|
||||
}
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
|
|
@ -90,10 +90,10 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect<SearchLibraryPutI
|
|||
}
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId(), tapped);
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), tapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,9 @@ public class EquipAbility extends ActivatedAbilityImpl<EquipAbility> {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("Equip ").append(costs.getText()).append(manaCosts.getText()).append(" (").append(manaCosts.getText()).append(": <i>Attach to target creature you control. Equip only as a sorcery.)</i>").toString();
|
||||
StringBuilder sb = new StringBuilder("Equip ").append(costs.getText()).append(manaCosts.getText());
|
||||
sb.append(" (").append(manaCosts.getText()).append(": <i>Attach to target creature you control. Equip only as a sorcery.)</i>").toString();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public class SaprolingToken extends Token {
|
|||
|
||||
public SaprolingToken() {
|
||||
super("Saproling", "1/1 green Saproling creature token");
|
||||
this.setOriginalExpansionSetCode("MMA");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color = ObjectColor.GREEN;
|
||||
subtype.add("Saproling");
|
||||
|
|
Loading…
Reference in a new issue