mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +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.DamageTargetEffect;
|
||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
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 (ActivatedAbility ability: permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
|
||||
if (!(ability instanceof ManaAbility) && ability.canActivate(playerId, game)) {
|
||||
if (ability instanceof EquipAbility && permanent.getAttachedTo() != null)
|
||||
continue;
|
||||
ManaOptions abilityOptions = ability.getManaCosts().getOptions();
|
||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||
//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))
|
||||
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) {
|
||||
if (card.getSpellAbility().canActivate(playerId, game)) {
|
||||
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 (this.activateAbility(card.getSpellAbility(), game))
|
||||
return;
|
||||
|
|
|
@ -36,11 +36,11 @@ import mage.Constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.ManaEffect;
|
||||
import mage.abilities.mana.ManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -67,8 +67,7 @@ public class ElvishArchdruid extends CardImpl<ElvishArchdruid> {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
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(ability);
|
||||
this.addAbility(new ElvishArchdruidAbility());
|
||||
}
|
||||
|
||||
public ElvishArchdruid(final ElvishArchdruid card) {
|
||||
|
@ -85,40 +84,58 @@ public class ElvishArchdruid extends CardImpl<ElvishArchdruid> {
|
|||
return "121692_typ_reg_sty_010.jpg";
|
||||
}
|
||||
|
||||
class ElvishArchdruidAbility extends ManaAbility<ElvishArchdruidAbility> {
|
||||
|
||||
public ElvishArchdruidAbility() {
|
||||
super(Zone.BATTLEFIELD, new ElvishArchdruidEffect(), new TapSourceCost());
|
||||
}
|
||||
|
||||
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() {
|
||||
super(new Mana());
|
||||
}
|
||||
|
||||
public ElvishArchdruidEffect(final ElvishArchdruidEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElvishArchdruidEffect copy() {
|
||||
return new ElvishArchdruidEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
this.mana.clear();
|
||||
int amount = game.getBattlefield().countAll(filter, source.getControllerId());
|
||||
this.mana.setGreen(amount);
|
||||
return super.apply(game, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Ability source) {
|
||||
return "Add {G} to your mana pool for each Elf you control";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ElvishArchdruidEffect extends ManaEffect {
|
||||
|
||||
private static FilterCreaturePermanent filter = new FilterCreaturePermanent("Elf creatures");
|
||||
|
||||
static {
|
||||
filter.getSubtype().add("Elf");
|
||||
}
|
||||
|
||||
public ElvishArchdruidEffect() {
|
||||
super(new Mana());
|
||||
}
|
||||
|
||||
public ElvishArchdruidEffect(final ElvishArchdruidEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElvishArchdruidEffect copy() {
|
||||
return new ElvishArchdruidEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
this.mana.clear();
|
||||
int amount = game.getBattlefield().countAll(filter, source.getControllerId());
|
||||
this.mana.setGreen(amount);
|
||||
return super.apply(game, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Ability source) {
|
||||
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.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.common.TapSourceUnlessControlsEffect;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
|
|
|
@ -48,10 +48,10 @@ public class SunpetalGrove extends CardImpl<SunpetalGrove> {
|
|||
private static FilterLandPermanent filter = new FilterLandPermanent();
|
||||
|
||||
static {
|
||||
filter.getSubtype().add("Swamp");
|
||||
filter.getSubtype().add("Mountain");
|
||||
filter.getSubtype().add("Forest");
|
||||
filter.getSubtype().add("Plains");
|
||||
filter.setScopeSubtype(ComparisonScope.Any);
|
||||
filter.setMessage("Swamp or a Mountain");
|
||||
filter.setMessage("Forest or a Plains");
|
||||
}
|
||||
|
||||
public SunpetalGrove(UUID ownerId) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.Constants.Rarity;
|
|||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.CopyEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -53,7 +54,7 @@ public class Clone extends CardImpl<Clone> {
|
|||
this.power = 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());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -30,11 +30,16 @@ package mage.sets.zendikar;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.AddPlusOneCountersSourceEffect;
|
||||
import mage.abilities.effects.common.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.abilities.keyword.UnblockableAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
/**
|
||||
|
@ -44,16 +49,18 @@ import mage.cards.CardImpl;
|
|||
public class AetherFigment extends CardImpl<AetherFigment> {
|
||||
|
||||
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.subtype.add("Illusion");
|
||||
this.color.setBlue(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
KickerAbility ability = new KickerAbility(new AddPlusOneCountersSourceEffect(2), false);
|
||||
ability.addManaCost(new GenericManaCost(3));
|
||||
this.addAbility(ability);
|
||||
this.addAbility(UnblockableAbility.getInstance());
|
||||
Ability ability1 = new EntersBattlefieldTriggeredAbility(new AddPlusOneCountersSourceEffect(2));
|
||||
KickerAbility ability2 = new KickerAbility(new GainAbilitySourceEffect(ability1, Duration.WhileOnBattlefield), false);
|
||||
ability2.addManaCost(new GenericManaCost(3));
|
||||
this.addAbility(ability2);
|
||||
}
|
||||
|
||||
public AetherFigment(final AetherFigment card) {
|
||||
|
|
|
@ -45,7 +45,7 @@ import mage.game.permanent.token.Token;
|
|||
public class ConquerorsPledge extends CardImpl<ConquerorsPledge> {
|
||||
|
||||
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.color.setWhite(true);
|
||||
this.getSpellAbility().addEffect(new CreateTokenEffect(new KorSoldierToken(), 6));
|
||||
|
|
|
@ -64,7 +64,7 @@ public class GoblinRuinblaster extends CardImpl<GoblinRuinblaster> {
|
|||
ability1.addTarget(new TargetNonBasicLandPermanent());
|
||||
KickerAbility ability2 = new KickerAbility(new GainAbilitySourceEffect(ability1, Duration.WhileOnBattlefield), false);
|
||||
ability2.addManaCost(new ColoredManaCost(ColoredManaSymbol.R));
|
||||
this.addAbility(ability1);
|
||||
this.addAbility(ability2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.StaticAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
|
|
|
@ -78,17 +78,17 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl<EntersBattlef
|
|||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Spell spell = game.getStack().getSpell(event.getSourceId());
|
||||
for (Effect effect: baseEffects) {
|
||||
if (effect instanceof ContinuousEffect) {
|
||||
if (spell != null)
|
||||
game.addEffect((ContinuousEffect) effect, spell.getSpellAbility());
|
||||
else
|
||||
if (source.activate(game, false)) {
|
||||
if (effect instanceof ContinuousEffect) {
|
||||
game.addEffect((ContinuousEffect) effect, source);
|
||||
}
|
||||
else {
|
||||
if (spell != null)
|
||||
effect.apply(game, spell.getSpellAbility());
|
||||
else
|
||||
effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (spell != null)
|
||||
effect.apply(game, spell.getSpellAbility());
|
||||
else
|
||||
effect.apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import mage.Constants.Duration;
|
|||
import mage.Constants.Layer;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.SubLayer;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
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);
|
||||
game.getBattlefield().addPermanent(permanent);
|
||||
game.setZone(objectId, Zone.BATTLEFIELD);
|
||||
permanent.entersBattlefield(sourceId, game);
|
||||
game.applyEffects();
|
||||
permanent.entersBattlefield(sourceId, game);
|
||||
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -106,8 +106,8 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
result = card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId);
|
||||
resolveKicker(game);
|
||||
result = card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue