mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
fixes
This commit is contained in:
parent
53d7e5623b
commit
3384d27ea8
13 changed files with 107 additions and 64 deletions
|
@ -67,6 +67,7 @@ import mage.abilities.effects.ReplacementEffect;
|
||||||
import mage.abilities.effects.common.BecomesCreatureSourceEOTEffect;
|
import mage.abilities.effects.common.BecomesCreatureSourceEOTEffect;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||||
|
import mage.abilities.keyword.EquipAbility;
|
||||||
import mage.abilities.keyword.FirstStrikeAbility;
|
import mage.abilities.keyword.FirstStrikeAbility;
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.abilities.mana.ManaAbility;
|
import mage.abilities.mana.ManaAbility;
|
||||||
|
@ -457,6 +458,8 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
||||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(playerId)) {
|
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(playerId)) {
|
||||||
for (ActivatedAbility ability: permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
|
for (ActivatedAbility ability: permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
|
||||||
if (!(ability instanceof ManaAbility) && ability.canActivate(playerId, game)) {
|
if (!(ability instanceof ManaAbility) && ability.canActivate(playerId, game)) {
|
||||||
|
if (ability instanceof EquipAbility && permanent.getAttachedTo() != null)
|
||||||
|
continue;
|
||||||
ManaOptions abilityOptions = ability.getManaCosts().getOptions();
|
ManaOptions abilityOptions = ability.getManaCosts().getOptions();
|
||||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||||
//don't use variable mana costs unless there is at least 3 extra mana for X
|
//don't use variable mana costs unless there is at least 3 extra mana for X
|
||||||
|
@ -479,6 +482,25 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Card card: graveyard.getCards(game)) {
|
||||||
|
for (ActivatedAbility ability: card.getAbilities().getActivatedAbilities(Zone.GRAVEYARD)) {
|
||||||
|
if (ability.canActivate(playerId, game)) {
|
||||||
|
ManaOptions abilityOptions = ability.getManaCosts().getOptions();
|
||||||
|
if (abilityOptions.size() == 0) {
|
||||||
|
playableAbilities.add(ability);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (Mana mana: abilityOptions) {
|
||||||
|
for (Mana avail: available) {
|
||||||
|
if (mana.enough(avail)) {
|
||||||
|
playableAbilities.add(ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (logger.isLoggable(Level.FINE))
|
if (logger.isLoggable(Level.FINE))
|
||||||
logger.fine("findPlayables: " + playableInstant.toString() + "---" + playableNonInstant.toString() + "---" + playableAbilities.toString() );
|
logger.fine("findPlayables: " + playableInstant.toString() + "---" + playableNonInstant.toString() + "---" + playableAbilities.toString() );
|
||||||
}
|
}
|
||||||
|
@ -911,7 +933,7 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
||||||
for (Card card: this.playableInstant) {
|
for (Card card: this.playableInstant) {
|
||||||
if (card.getSpellAbility().canActivate(playerId, game)) {
|
if (card.getSpellAbility().canActivate(playerId, game)) {
|
||||||
for (Effect effect: card.getSpellAbility().getEffects()) {
|
for (Effect effect: card.getSpellAbility().getEffects()) {
|
||||||
if (effect.getOutcome().equals(Outcome.DestroyPermanent)) {
|
if (effect.getOutcome().equals(Outcome.DestroyPermanent) || effect.getOutcome().equals(Outcome.ReturnToHand)) {
|
||||||
if (card.getSpellAbility().getTargets().get(0).canTarget(creatureId, card.getSpellAbility(), game)) {
|
if (card.getSpellAbility().getTargets().get(0).canTarget(creatureId, card.getSpellAbility(), game)) {
|
||||||
if (this.activateAbility(card.getSpellAbility(), game))
|
if (this.activateAbility(card.getSpellAbility(), game))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -36,11 +36,11 @@ import mage.Constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.effects.common.BoostControlledEffect;
|
import mage.abilities.effects.common.BoostControlledEffect;
|
||||||
import mage.abilities.effects.common.ManaEffect;
|
import mage.abilities.effects.common.ManaEffect;
|
||||||
|
import mage.abilities.mana.ManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -67,8 +67,7 @@ public class ElvishArchdruid extends CardImpl<ElvishArchdruid> {
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ElvishArchdruidEffect(), new TapSourceCost());
|
this.addAbility(new ElvishArchdruidAbility());
|
||||||
this.addAbility(ability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElvishArchdruid(final ElvishArchdruid card) {
|
public ElvishArchdruid(final ElvishArchdruid card) {
|
||||||
|
@ -85,16 +84,32 @@ public class ElvishArchdruid extends CardImpl<ElvishArchdruid> {
|
||||||
return "121692_typ_reg_sty_010.jpg";
|
return "121692_typ_reg_sty_010.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
class ElvishArchdruidAbility extends ManaAbility<ElvishArchdruidAbility> {
|
||||||
|
|
||||||
class ElvishArchdruidEffect extends ManaEffect {
|
public ElvishArchdruidAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new ElvishArchdruidEffect(), new TapSourceCost());
|
||||||
private static FilterCreaturePermanent filter = new FilterCreaturePermanent("Elf creatures");
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.getSubtype().add("Elf");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ElvishArchdruidAbility(final ElvishArchdruidAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ElvishArchdruidAbility copy() {
|
||||||
|
return new ElvishArchdruidAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mana getNetMana(Game game) {
|
||||||
|
if (game == null)
|
||||||
|
return new Mana();
|
||||||
|
return Mana.GreenMana(game.getBattlefield().countAll(filter, controllerId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ElvishArchdruidEffect extends ManaEffect {
|
||||||
|
|
||||||
public ElvishArchdruidEffect() {
|
public ElvishArchdruidEffect() {
|
||||||
super(new Mana());
|
super(new Mana());
|
||||||
}
|
}
|
||||||
|
@ -121,4 +136,6 @@ class ElvishArchdruidEffect extends ManaEffect {
|
||||||
return "Add {G} to your mana pool for each Elf you control";
|
return "Add {G} to your mana pool for each Elf you control";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@ import java.util.UUID;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
|
||||||
import mage.abilities.effects.common.TapSourceUnlessControlsEffect;
|
import mage.abilities.effects.common.TapSourceUnlessControlsEffect;
|
||||||
import mage.abilities.mana.BlueManaAbility;
|
import mage.abilities.mana.BlueManaAbility;
|
||||||
import mage.abilities.mana.WhiteManaAbility;
|
import mage.abilities.mana.WhiteManaAbility;
|
||||||
|
|
|
@ -48,10 +48,10 @@ public class SunpetalGrove extends CardImpl<SunpetalGrove> {
|
||||||
private static FilterLandPermanent filter = new FilterLandPermanent();
|
private static FilterLandPermanent filter = new FilterLandPermanent();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.getSubtype().add("Swamp");
|
filter.getSubtype().add("Forest");
|
||||||
filter.getSubtype().add("Mountain");
|
filter.getSubtype().add("Plains");
|
||||||
filter.setScopeSubtype(ComparisonScope.Any);
|
filter.setScopeSubtype(ComparisonScope.Any);
|
||||||
filter.setMessage("Swamp or a Mountain");
|
filter.setMessage("Forest or a Plains");
|
||||||
}
|
}
|
||||||
|
|
||||||
public SunpetalGrove(UUID ownerId) {
|
public SunpetalGrove(UUID ownerId) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.Constants.Rarity;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.common.CopyEffect;
|
import mage.abilities.effects.common.CopyEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -53,7 +54,7 @@ public class Clone extends CardImpl<Clone> {
|
||||||
this.power = new MageInt(0);
|
this.power = new MageInt(0);
|
||||||
this.toughness = new MageInt(0);
|
this.toughness = new MageInt(0);
|
||||||
|
|
||||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CopyEffect());
|
Ability ability = new EntersBattlefieldAbility(new CopyEffect(), "You may have Clone enter the battlefield as a copy of any creature on the battlefield");
|
||||||
ability.addTarget(new TargetCreaturePermanent());
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,16 @@ package mage.sets.zendikar;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Duration;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.common.AddPlusOneCountersSourceEffect;
|
import mage.abilities.effects.common.AddPlusOneCountersSourceEffect;
|
||||||
|
import mage.abilities.effects.common.GainAbilitySourceEffect;
|
||||||
import mage.abilities.keyword.KickerAbility;
|
import mage.abilities.keyword.KickerAbility;
|
||||||
|
import mage.abilities.keyword.UnblockableAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,16 +49,18 @@ import mage.cards.CardImpl;
|
||||||
public class AetherFigment extends CardImpl<AetherFigment> {
|
public class AetherFigment extends CardImpl<AetherFigment> {
|
||||||
|
|
||||||
public AetherFigment(UUID ownerId) {
|
public AetherFigment(UUID ownerId) {
|
||||||
super(ownerId, 40, "Æther Figment", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
super(ownerId, 40, "AEther Figment", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||||
this.expansionSetCode = "ZEN";
|
this.expansionSetCode = "ZEN";
|
||||||
this.subtype.add("Illusion");
|
this.subtype.add("Illusion");
|
||||||
this.color.setBlue(true);
|
this.color.setBlue(true);
|
||||||
this.power = new MageInt(1);
|
this.power = new MageInt(1);
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
KickerAbility ability = new KickerAbility(new AddPlusOneCountersSourceEffect(2), false);
|
this.addAbility(UnblockableAbility.getInstance());
|
||||||
ability.addManaCost(new GenericManaCost(3));
|
Ability ability1 = new EntersBattlefieldTriggeredAbility(new AddPlusOneCountersSourceEffect(2));
|
||||||
this.addAbility(ability);
|
KickerAbility ability2 = new KickerAbility(new GainAbilitySourceEffect(ability1, Duration.WhileOnBattlefield), false);
|
||||||
|
ability2.addManaCost(new GenericManaCost(3));
|
||||||
|
this.addAbility(ability2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AetherFigment(final AetherFigment card) {
|
public AetherFigment(final AetherFigment card) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ import mage.game.permanent.token.Token;
|
||||||
public class ConquerorsPledge extends CardImpl<ConquerorsPledge> {
|
public class ConquerorsPledge extends CardImpl<ConquerorsPledge> {
|
||||||
|
|
||||||
public ConquerorsPledge(UUID ownerId) {
|
public ConquerorsPledge(UUID ownerId) {
|
||||||
super(ownerId, 8, "Conquerors Pledge", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{W}{W}{W}");
|
super(ownerId, 8, "Conqueror's Pledge", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{W}{W}{W}");
|
||||||
this.expansionSetCode = "ZEN";
|
this.expansionSetCode = "ZEN";
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
this.getSpellAbility().addEffect(new CreateTokenEffect(new KorSoldierToken(), 6));
|
this.getSpellAbility().addEffect(new CreateTokenEffect(new KorSoldierToken(), 6));
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class GoblinRuinblaster extends CardImpl<GoblinRuinblaster> {
|
||||||
ability1.addTarget(new TargetNonBasicLandPermanent());
|
ability1.addTarget(new TargetNonBasicLandPermanent());
|
||||||
KickerAbility ability2 = new KickerAbility(new GainAbilitySourceEffect(ability1, Duration.WhileOnBattlefield), false);
|
KickerAbility ability2 = new KickerAbility(new GainAbilitySourceEffect(ability1, Duration.WhileOnBattlefield), false);
|
||||||
ability2.addManaCost(new ColoredManaCost(ColoredManaSymbol.R));
|
ability2.addManaCost(new ColoredManaCost(ColoredManaSymbol.R));
|
||||||
this.addAbility(ability1);
|
this.addAbility(ability2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import java.io.ObjectStreamException;
|
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
import mage.abilities.StaticAbility;
|
import mage.abilities.StaticAbility;
|
||||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
|
|
|
@ -78,18 +78,18 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl<EntersBattlef
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Spell spell = game.getStack().getSpell(event.getSourceId());
|
Spell spell = game.getStack().getSpell(event.getSourceId());
|
||||||
for (Effect effect: baseEffects) {
|
for (Effect effect: baseEffects) {
|
||||||
|
if (source.activate(game, false)) {
|
||||||
if (effect instanceof ContinuousEffect) {
|
if (effect instanceof ContinuousEffect) {
|
||||||
if (spell != null)
|
|
||||||
game.addEffect((ContinuousEffect) effect, spell.getSpellAbility());
|
|
||||||
else
|
|
||||||
game.addEffect((ContinuousEffect) effect, source);
|
game.addEffect((ContinuousEffect) effect, source);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
if (spell != null)
|
if (spell != null)
|
||||||
effect.apply(game, spell.getSpellAbility());
|
effect.apply(game, spell.getSpellAbility());
|
||||||
else
|
else
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import mage.Constants.Duration;
|
||||||
import mage.Constants.Layer;
|
import mage.Constants.Layer;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.SubLayer;
|
import mage.Constants.SubLayer;
|
||||||
import mage.ObjectColor;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
|
|
@ -257,8 +257,8 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
||||||
PermanentCard permanent = new PermanentCard(this, controllerId);
|
PermanentCard permanent = new PermanentCard(this, controllerId);
|
||||||
game.getBattlefield().addPermanent(permanent);
|
game.getBattlefield().addPermanent(permanent);
|
||||||
game.setZone(objectId, Zone.BATTLEFIELD);
|
game.setZone(objectId, Zone.BATTLEFIELD);
|
||||||
permanent.entersBattlefield(sourceId, game);
|
|
||||||
game.applyEffects();
|
game.applyEffects();
|
||||||
|
permanent.entersBattlefield(sourceId, game);
|
||||||
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
|
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,8 +106,8 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId);
|
|
||||||
resolveKicker(game);
|
resolveKicker(game);
|
||||||
|
result = card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue