New implementation for LevelUpAbility. All tests ok.

This commit is contained in:
magenoxx 2012-05-02 20:20:01 +04:00
parent c2ea8246d2
commit f39d5dbca1
26 changed files with 433 additions and 322 deletions

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -35,14 +34,16 @@ import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class BeastbreakerOfBalaGed extends LevelerCard<BeastbreakerOfBalaGed> {
@ -58,11 +59,13 @@ public class BeastbreakerOfBalaGed extends LevelerCard<BeastbreakerOfBalaGed> {
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{2}{G}")));
this.getLevels().add(new LevelAbility(1, 3, new AbilitiesImpl<Ability>(), 4, 4));
Abilities<Ability> levelAbilities = new AbilitiesImpl<Ability>();
levelAbilities.add(TrampleAbility.getInstance());
this.getLevels().add(new LevelAbility(4, -1, levelAbilities, 6, 6));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 3, new AbilitiesImpl<Ability>(), 4, 4),
new LevelerCardBuilder.LevelAbility(4, -1, levelAbilities, 6, 6)
);
}
public BeastbreakerOfBalaGed(final BeastbreakerOfBalaGed card) {

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
@ -40,14 +39,16 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
/**
*
* @author Loki
* @author Loki, noxx
*/
public class BrimstoneMage extends LevelerCard<BrimstoneMage> {
@ -65,14 +66,16 @@ public class BrimstoneMage extends LevelerCard<BrimstoneMage> {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());
abilities1.add(ability);
this.getLevels().add(new LevelAbility(1, 2, abilities1, 2, 3));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), new TapSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());
abilities2.add(ability);
this.getLevels().add(new LevelAbility(3, -1, abilities2, 2, 4));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 2, abilities1, 2, 3),
new LevelerCardBuilder.LevelAbility(3, -1, abilities2, 2, 4)
);
}
public BrimstoneMage (final BrimstoneMage card) {

View file

@ -27,19 +27,19 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.keyword.LevelUpAbility;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author North
@ -58,11 +58,13 @@ public class CaravanEscort extends LevelerCard<CaravanEscort> {
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{2}")));
this.getLevels().add(new LevelAbility(1, 4, new AbilitiesImpl<Ability>(), 2, 2));
AbilitiesImpl<Ability> levelAbilities = new AbilitiesImpl<Ability>(FirstStrikeAbility.getInstance());
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 4, new AbilitiesImpl<Ability>(), 2, 2),
new LevelerCardBuilder.LevelAbility(5, -1, levelAbilities, 5, 5)
);
Abilities<Ability> levelAbilities = new AbilitiesImpl<Ability>();
levelAbilities.add(FirstStrikeAbility.getInstance());
this.getLevels().add(new LevelAbility(5, -1, levelAbilities, 5, 5));
setMaxLevelCounters(5);
}
public CaravanEscort(final CaravanEscort card) {

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
@ -40,11 +39,13 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import mage.filter.common.FilterCreaturePermanent;
import java.util.UUID;
/**
*
* @author North
@ -71,12 +72,15 @@ public class CoralhelmCommander extends LevelerCard<CoralhelmCommander> {
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(FlyingAbility.getInstance());
this.getLevels().add(new LevelAbility(2, 3, abilities1, 3, 3));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(FlyingAbility.getInstance());
abilities2.add(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
this.getLevels().add(new LevelAbility(4, -1, abilities2, 4, 4));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(2, 3, abilities1, 3, 3),
new LevelerCardBuilder.LevelAbility(4, -1, abilities2, 4, 4)
);
}
public CoralhelmCommander(final CoralhelmCommander card) {

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
@ -41,13 +40,15 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.keyword.LevelUpAbility;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
* @author BetaSteward_at_googlemail.com, noxx
*/
public class EnclaveCryptologist extends LevelerCard<EnclaveCryptologist> {
@ -61,16 +62,17 @@ public class EnclaveCryptologist extends LevelerCard<EnclaveCryptologist> {
this.toughness = new MageInt(1);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{1}{U}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(), new TapSourceCost());
abilities1.add(ability);
this.getLevels().add(new LevelAbility(1, 2, abilities1, 0, 1));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>(ability);
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), new TapSourceCost());
abilities2.add(ability);
this.getLevels().add(new LevelAbility(3, -1, abilities2, 0, 1));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>(ability);
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 2, abilities1, 0, 1),
new LevelerCardBuilder.LevelAbility(3, -1, abilities2, 0, 1)
);
}
public EnclaveCryptologist (final EnclaveCryptologist card) {

View file

@ -28,8 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
@ -41,14 +39,16 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author Loki
* @author Loki, noxx
*/
public class GuulDrazAssassin extends LevelerCard<GuulDrazAssassin> {
@ -62,18 +62,23 @@ public class GuulDrazAssassin extends LevelerCard<GuulDrazAssassin> {
this.toughness = new MageInt(1);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{1}{B}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(-2, -2, Constants.Duration.EndOfTurn), new ManaCostsImpl("{B}"));
ability.addTarget(new TargetCreaturePermanent());
ability.addCost(new TapSourceCost());
abilities1.add(ability);
this.getLevels().add(new LevelAbility(2, 3, abilities1, 2, 2));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
Ability ability2 = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(-4, -4, Constants.Duration.EndOfTurn), new ManaCostsImpl("{B}"));
ability2.addTarget(new TargetCreaturePermanent());
ability2.addCost(new TapSourceCost());
abilities2.add(ability2);
this.getLevels().add(new LevelAbility(4, -1, abilities2, 4, 4));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(2, 3, abilities1, 2, 2),
new LevelerCardBuilder.LevelAbility(4, -1, abilities2, 4, 4)
);
}
public GuulDrazAssassin (final GuulDrazAssassin card) {

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -35,15 +34,17 @@ import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.keyword.ShroudAbility;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class HadaSpyPatrol extends LevelerCard<HadaSpyPatrol> {
@ -61,12 +62,15 @@ public class HadaSpyPatrol extends LevelerCard<HadaSpyPatrol> {
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(UnblockableAbility.getInstance());
this.getLevels().add(new LevelAbility(1, 2, abilities1, 2, 2));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(UnblockableAbility.getInstance());
abilities2.add(ShroudAbility.getInstance());
this.getLevels().add(new LevelAbility(3, -1, abilities2, 3, 3));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 2, abilities1, 2, 2),
new LevelerCardBuilder.LevelAbility(3, -1, abilities2, 3, 3)
);
}
public HadaSpyPatrol(final HadaSpyPatrol card) {

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -36,13 +35,15 @@ import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.IslandwalkAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class HalimarWavewatch extends LevelerCard<HalimarWavewatch> {
@ -58,11 +59,13 @@ public class HalimarWavewatch extends LevelerCard<HalimarWavewatch> {
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{2}")));
this.getLevels().add(new LevelAbility(1, 4, new AbilitiesImpl<Ability>(), 0, 6));
Abilities<Ability> levelAbilities = new AbilitiesImpl<Ability>();
levelAbilities.add(new IslandwalkAbility());
this.getLevels().add(new LevelAbility(5, -1, levelAbilities, 6, 6));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 4, new AbilitiesImpl<Ability>(), 0, 6),
new LevelerCardBuilder.LevelAbility(5, -1, levelAbilities, 6, 6)
);
}
public HalimarWavewatch(final HalimarWavewatch card) {

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -36,15 +35,16 @@ import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author Loki
* @author Loki, noxx
*/
public class IkiralOutrider extends LevelerCard<IkiralOutrider> {
@ -58,12 +58,17 @@ public class IkiralOutrider extends LevelerCard<IkiralOutrider> {
this.toughness = new MageInt(2);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{4}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(VigilanceAbility.getInstance());
this.getLevels().add(new LevelAbility(1, 3, abilities1, 2, 6));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(VigilanceAbility.getInstance());
this.getLevels().add(new LevelAbility(4, -1, abilities2, 3, 10));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 3, abilities1, 2, 6),
new LevelerCardBuilder.LevelAbility(4, -1, abilities2, 3, 10)
);
}
public IkiralOutrider (final IkiralOutrider card) {

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
@ -42,17 +41,19 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.LevelerCard;
import mage.filter.common.FilterCreaturePermanent;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
* @author BetaSteward_at_googlemail.com, noxx
*/
public class JoragaTreespeaker extends LevelerCard<JoragaTreespeaker> {
@ -76,15 +77,18 @@ public class JoragaTreespeaker extends LevelerCard<JoragaTreespeaker> {
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(new SimpleManaAbility(Zone.BATTLEFIELD, new BasicManaEffect(Mana.GreenMana(2)), new TapSourceCost()));
this.getLevels().add(new LevelAbility(1, 4, abilities1, 1, 2));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(new SimpleStaticAbility(Zone.BATTLEFIELD,
new GainAbilityControlledEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BasicManaEffect(Mana.GreenMana(2)),
new TapSourceCost()),
Duration.WhileOnBattlefield, filter)));
this.getLevels().add(new LevelAbility(5, -1, abilities2, 1, 4));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 4, abilities1, 1, 2),
new LevelerCardBuilder.LevelAbility(5, -1, abilities2, 1, 4)
);
}
public JoragaTreespeaker(final JoragaTreespeaker card) {

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
@ -39,14 +38,16 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import mage.filter.common.FilterCreaturePermanent;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class KabiraVindicator extends LevelerCard<KabiraVindicator> {
@ -64,11 +65,14 @@ public class KabiraVindicator extends LevelerCard<KabiraVindicator> {
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), true)));
this.getLevels().add(new LevelAbility(2, 4, abilities1, 3, 6));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), true)));
this.getLevels().add(new LevelAbility(5, -1, abilities2, 4, 8));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(2, 4, abilities1, 3, 6),
new LevelerCardBuilder.LevelAbility(5, -1, abilities2, 4, 8)
);
}
public KabiraVindicator(final KabiraVindicator card) {

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
@ -41,14 +40,16 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
* @author BetaSteward_at_googlemail.com, noxx
*/
public class KarganDragonlord extends LevelerCard<KarganDragonlord> {
@ -62,14 +63,19 @@ public class KarganDragonlord extends LevelerCard<KarganDragonlord> {
this.toughness = new MageInt(2);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{R}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(FlyingAbility.getInstance());
this.getLevels().add(new LevelAbility(4, 7, abilities1, 4, 4));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(FlyingAbility.getInstance());
abilities2.add(TrampleAbility.getInstance());
abilities2.add(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
this.getLevels().add(new LevelAbility(8, -1, abilities2, 8, 8));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(4, 7, abilities1, 4, 4),
new LevelerCardBuilder.LevelAbility(8, -1, abilities2, 8, 8)
);
}
public KarganDragonlord(final KarganDragonlord card) {

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
@ -39,14 +38,15 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import mage.game.permanent.token.ElephantToken;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class KazanduTuskcaller extends LevelerCard<KazanduTuskcaller> {
@ -66,13 +66,16 @@ public class KazanduTuskcaller extends LevelerCard<KazanduTuskcaller> {
abilities1.add(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new CreateTokenEffect(new ElephantToken()),
new TapSourceCost()));
this.getLevels().add(new LevelAbility(2, 5, abilities1, 1, 1));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new CreateTokenEffect(new ElephantToken(), 2),
new TapSourceCost()));
this.getLevels().add(new LevelAbility(6, -1, abilities2, 1, 1));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(2, 5, abilities1, 1, 1),
new LevelerCardBuilder.LevelAbility(6, -1, abilities2, 1, 1)
);
}
public KazanduTuskcaller(final KazanduTuskcaller card) {

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -36,14 +35,16 @@ import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class KnightOfCliffhaven extends LevelerCard<KnightOfCliffhaven> {
@ -61,12 +62,15 @@ public class KnightOfCliffhaven extends LevelerCard<KnightOfCliffhaven> {
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(FlyingAbility.getInstance());
this.getLevels().add(new LevelAbility(1, 3, abilities1, 2, 3));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(FlyingAbility.getInstance());
abilities2.add(VigilanceAbility.getInstance());
this.getLevels().add(new LevelAbility(4, -1, abilities2, 4, 4));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 3, abilities1, 2, 3),
new LevelerCardBuilder.LevelAbility(4, -1, abilities2, 4, 4)
);
}
public KnightOfCliffhaven(final KnightOfCliffhaven card) {

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
@ -40,16 +39,18 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.turn.TurnMod;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
* @author BetaSteward_at_googlemail.com, noxx
*/
public class LighthouseChronologist extends LevelerCard<LighthouseChronologist> {
@ -63,13 +64,16 @@ public class LighthouseChronologist extends LevelerCard<LighthouseChronologist>
this.toughness = new MageInt(3);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{U}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
this.getLevels().add(new LevelAbility(4, 6, abilities1, 2, 4));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(new LighthouseChronologistAbility());
this.getLevels().add(new LevelAbility(7, -1, abilities2, 3, 5));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(4, 6, abilities1, 2, 4),
new LevelerCardBuilder.LevelAbility(7, -1, abilities2, 3, 5)
);
}
public LighthouseChronologist (final LighthouseChronologist card) {

View file

@ -28,8 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -39,13 +37,15 @@ import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author Loki
* @author Loki, noxx
*/
public class NirkanaCutthroat extends LevelerCard<NirkanaCutthroat> {
@ -61,12 +61,15 @@ public class NirkanaCutthroat extends LevelerCard<NirkanaCutthroat> {
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(DeathtouchAbility.getInstance());
this.getLevels().add(new LevelAbility(1, 2, abilities1, 4, 3));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(FirstStrikeAbility.getInstance());
abilities2.add(DeathtouchAbility.getInstance());
this.getLevels().add(new LevelAbility(3, -1, abilities2, 5, 4));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 2, abilities1, 4, 3),
new LevelerCardBuilder.LevelAbility(3, -1, abilities2, 5, 4)
);
}
public NirkanaCutthroat (final NirkanaCutthroat card) {

View file

@ -28,8 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
@ -40,15 +38,15 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author Loki
* @author Loki, noxx
*/
public class NullChampion extends LevelerCard<NullChampion> {
@ -63,11 +61,14 @@ public class NullChampion extends LevelerCard<NullChampion> {
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{3}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
this.getLevels().add(new LevelAbility(1, 3, abilities1, 4, 2));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}")));
this.getLevels().add(new LevelAbility(4, -1, abilities2, 7, 3));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 3, abilities1, 4, 2),
new LevelerCardBuilder.LevelAbility(4, -1, abilities2, 7, 3)
);
}
public NullChampion (final NullChampion card) {

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -36,13 +35,15 @@ import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class SkywatcherAdept extends LevelerCard<SkywatcherAdept> {
@ -60,11 +61,14 @@ public class SkywatcherAdept extends LevelerCard<SkywatcherAdept> {
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(FlyingAbility.getInstance());
this.getLevels().add(new LevelAbility(1, 2, abilities1, 2, 2));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(FlyingAbility.getInstance());
this.getLevels().add(new LevelAbility(3, -1, abilities2, 4, 2));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 2, abilities1, 2, 2),
new LevelerCardBuilder.LevelAbility(3, -1, abilities2, 4, 2)
);
}
public SkywatcherAdept(final SkywatcherAdept card) {

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
@ -38,13 +37,15 @@ import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import java.util.UUID;
/**
*
* @author Loki
* @author Loki, noxx
*/
public class StudentOfWarfare extends LevelerCard<StudentOfWarfare> {
@ -60,10 +61,14 @@ public class StudentOfWarfare extends LevelerCard<StudentOfWarfare> {
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{W}")));
Abilities<Ability> abilities1 = new AbilitiesImpl<Ability>();
abilities1.add(FirstStrikeAbility.getInstance());
this.getLevels().add(new LevelAbility(2, 6, abilities1, 3, 3));
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>();
abilities2.add(DoubleStrikeAbility.getInstance());
this.getLevels().add(new LevelAbility(7, -1, abilities2, 4, 4));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(2, 6, abilities1, 3, 3),
new LevelerCardBuilder.LevelAbility(7, -1, abilities2, 4, 4)
);
}
public StudentOfWarfare (final StudentOfWarfare card) {

View file

@ -40,7 +40,7 @@ import mage.cards.LevelerCard;
import java.util.UUID;
/**
* @author North
* @author North, noxx
*/
public class TranscendentMaster extends LevelerCard<TranscendentMaster> {
@ -61,9 +61,9 @@ public class TranscendentMaster extends LevelerCard<TranscendentMaster> {
Abilities<Ability> abilities2 = new AbilitiesImpl<Ability>(LifelinkAbility.getInstance(),
IndestructibleAbility.getInstance());
LevelAbilityBuilder.construct(this,
new LevelAbility(6, 11, abilities1, 6, 6),
new LevelAbility(12, -1, abilities2, 9, 9)
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(6, 11, abilities1, 6, 6),
new LevelerCardBuilder.LevelAbility(12, -1, abilities2, 9, 9)
);
}

View file

@ -27,7 +27,6 @@
*/
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
@ -38,15 +37,17 @@ import mage.abilities.Ability;
import mage.abilities.EvasionAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.keyword.LevelAbility;
import mage.abilities.keyword.LevelUpAbility;
import mage.abilities.keyword.LevelerCardBuilder;
import mage.cards.LevelerCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author North
* @author North, noxx
*/
public class ZulaportEnforcer extends LevelerCard<ZulaportEnforcer> {
@ -61,13 +62,18 @@ public class ZulaportEnforcer extends LevelerCard<ZulaportEnforcer> {
this.toughness = new MageInt(1);
this.addAbility(new LevelUpAbility(new ManaCostsImpl("{4}")));
// LEVEL 1-2: 3/3
this.getLevels().add(new LevelAbility(1, 2, new AbilitiesImpl<Ability>(), 3, 3));
// LEVEL 3+: 5/5
// Zulaport Enforcer can't be blocked except by black creatures.
Abilities<Ability> levelAbilities = new AbilitiesImpl<Ability>();
levelAbilities.add(ZulaportEnforcerAbility.getInstance());
this.getLevels().add(new LevelAbility(3, -1, levelAbilities, 5, 5));
LevelerCardBuilder.construct(this,
new LevelerCardBuilder.LevelAbility(1, 2, new AbilitiesImpl<Ability>(), 3, 3),
new LevelerCardBuilder.LevelAbility(3, -1, levelAbilities, 5, 5)
);
}
public ZulaportEnforcer(final ZulaportEnforcer card) {

View file

@ -1,42 +0,0 @@
package org.mage.test.ai;
import junit.framework.Assert;
import mage.Constants;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.permanent.Permanent;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
import java.util.Map;
import org.junit.Ignore;
/**
* Make sure AI uses level up ability, but not too much (over the max useful level - Issue 441).
*
* @author ayratn
*/
public class LevelUpAbilityTest extends CardTestBase {
@Test
@Ignore
public void testLevelUpAbilityUsage() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Transcendent Master");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 15);
setStopOnTurn(3);
execute();
Permanent master = getPermanent("Transcendent Master", playerA.getId());
Assert.assertNotNull(master);
System.out.println("Results:");
for (Map.Entry<String, Counter> counter : master.getCounters().entrySet()) {
System.out.println(counter.getKey() + " : " + counter.getValue().getName() + " : " + counter.getValue().getCount());
}
Assert.assertNotNull(master.getCounters());
Assert.assertFalse(master.getCounters().isEmpty());
Assert.assertEquals(12, master.getCounters().getCount(CounterType.LEVEL));
}
}

View file

@ -1,112 +0,0 @@
/*
* 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.abilities.keyword;
import mage.Constants.Zone;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
/**
* The implementation by BetaSteward was discarded as requires special handling in Mage.Core.
*
* Instead it was replaced by conditional continuous effects and builder pattern.
*
* @author BetaSteward_at_googlemail.com
* @author noxx
*/
public class LevelAbility extends StaticAbility<LevelAbility> {
private int level1;
private int level2;
private int power;
private int toughness;
private Abilities<Ability> abilities = new AbilitiesImpl<Ability>();
public LevelAbility(int level1, int level2, Abilities<Ability> abilities, int power, int toughness) {
super(Zone.BATTLEFIELD, null);
this.level1 = level1;
this.level2 = level2;
this.abilities.addAll(abilities);
this.power = power;
this.toughness = toughness;
}
public LevelAbility(LevelAbility ability) {
super(ability);
this.level1 = ability.level1;
this.level2 = ability.level2;
this.abilities = ability.abilities.copy();
this.power = ability.power;
this.toughness = ability.toughness;
}
public int getLevel1() {
return level1;
}
public int getLevel2() {
return level2;
}
public Abilities<Ability> getAbilities() {
return abilities;
}
public int getPower() {
return power;
}
public int getToughness() {
return toughness;
}
@Override
public String getRule() {
StringBuilder sb = new StringBuilder();
sb.append("Level ").append(level1);
if (level2 == -1)
sb.append("+");
else
sb.append("-").append(level2);
sb.append(": ").append(power).append("/").append(toughness).append(" ");
for (String rule: abilities.getRules("{this}")) {
sb.append(rule).append(" ");
}
return sb.toString();
}
@Override
public LevelAbility copy() {
return new LevelAbility(this);
}
}

View file

@ -0,0 +1,232 @@
/*
* 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.abilities.keyword;
import mage.Constants;
import mage.Constants.Zone;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.HasCounterCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
import mage.cards.Card;
import mage.cards.LevelerCard;
import mage.counters.CounterType;
import java.util.ArrayList;
import java.util.List;
/**
* The implementation by BetaSteward was discarded as requires special handling in Mage.Core.
*
* Instead it was replaced by conditional continuous effects and builder pattern.
*
* @author BetaSteward_at_googlemail.com
* @author noxx
*/
public class LevelerCardBuilder {
private int level1;
private int level2;
private int power;
private int toughness;
private String rule = "";
private Abilities<Ability> abilities = new AbilitiesImpl<Ability>();
/**
* Main method constructing ability.
*
* @return
*/
public List<Ability> build() {
List<Ability> constructed = new ArrayList<Ability>();
Condition condition = new HasCounterCondition(CounterType.LEVEL, level1, level2);
for (Ability ability : abilities) {
ContinuousEffect effect = new GainAbilitySourceEffect(ability);
ConditionalContinousEffect abEffect = new ConditionalContinousEffect(effect, condition, "");
constructed.add(new SimpleStaticAbility(Zone.BATTLEFIELD, abEffect));
}
ContinuousEffect effect = new SetPowerToughnessSourceEffect(power, toughness, Constants.Duration.WhileOnBattlefield);
ConditionalContinousEffect ptEffect = new ConditionalContinousEffect(effect, condition, rule);
constructed.add(new SimpleStaticAbility(Zone.BATTLEFIELD, ptEffect));
return constructed;
}
public LevelerCardBuilder setLevel1(int level1) {
this.level1 = level1;
return this;
}
public LevelerCardBuilder setLevel2(int level2) {
this.level2 = level2;
return this;
}
public LevelerCardBuilder setPower(int power) {
this.power = power;
return this;
}
public LevelerCardBuilder setToughness(int toughness) {
this.toughness = toughness;
return this;
}
public LevelerCardBuilder addAbility(Ability ability) {
this.abilities.add(ability);
return this;
}
public LevelerCardBuilder setRule(String rule) {
this.rule = rule;
return this;
}
public LevelerCardBuilder reset() {
this.level1 = 0;
this.level2 = 0;
this.power = 0;
this.toughness = 0;
this.abilities.clear();
this.rule = "";
return this;
}
/**
* Add abilities to card to enable switching between levels.
*
* @param card
* @param levelAbilities
*/
public static void construct(Card card, LevelAbility... levelAbilities) {
LevelerCardBuilder builder = new LevelerCardBuilder();
for (LevelAbility levelAbility : levelAbilities) {
// set main params
builder = builder
.reset()
.setLevel1(levelAbility.getLevel1())
.setLevel2(levelAbility.getLevel2() == -1 ? Integer.MAX_VALUE : levelAbility.getLevel2())
.setPower(levelAbility.getPower())
.setToughness(levelAbility.getToughness())
.setRule(levelAbility.getRule());
// set abilities that give the next level
for (Ability addedAbility : levelAbility.getAbilities()) {
builder.addAbility(addedAbility);
}
// build static abilities and add them to card
for (Ability simpleStaticAbility : builder.build()) {
card.addAbility(simpleStaticAbility);
}
}
// set max level counters (for ai)
if (card instanceof LevelerCard) {
int maxValue = 0;
for (LevelAbility levelAbility : levelAbilities) {
if (levelAbility.getLevel1() > maxValue) {
maxValue = levelAbility.getLevel1();
}
}
((LevelerCard) card).setMaxLevelCounters(maxValue);
}
}
public static class LevelAbility {
private int level1;
private int level2;
private int power;
private int toughness;
private Abilities<Ability> abilities = new AbilitiesImpl<Ability>();
public LevelAbility(int level1, int level2, Abilities<Ability> abilities, int power, int toughness) {
this.level1 = level1;
this.level2 = level2;
this.abilities.addAll(abilities);
this.power = power;
this.toughness = toughness;
}
public LevelAbility(LevelAbility ability) {
this.level1 = ability.level1;
this.level2 = ability.level2;
this.abilities = ability.abilities.copy();
this.power = ability.power;
this.toughness = ability.toughness;
}
public int getLevel1() {
return level1;
}
public int getLevel2() {
return level2;
}
public Abilities<Ability> getAbilities() {
return abilities;
}
public int getPower() {
return power;
}
public int getToughness() {
return toughness;
}
public String getRule() {
StringBuilder sb = new StringBuilder();
sb.append("Level ").append(level1);
if (level2 == -1)
sb.append("+");
else
sb.append("-").append(level2);
sb.append(": ").append(power).append("/").append(toughness).append(" ");
for (String rule: abilities.getRules("{this}")) {
sb.append(rule).append(" ");
}
return sb.toString();
}
}
}

View file

@ -30,10 +30,7 @@ package mage.cards;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.keyword.LevelAbility;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
@ -42,46 +39,21 @@ import java.util.UUID;
*/
public abstract class LevelerCard<T extends LevelerCard<T>> extends CardImpl<T> {
protected List<LevelAbility> levels = new ArrayList<LevelAbility>();
private int maxLevelCounters;
public LevelerCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
super(ownerId, cardNumber, name, rarity, cardTypes, costs);
}
public LevelerCard(LevelerCard card) {
super(card);
for (LevelAbility ability: (List<LevelAbility>)card.levels) {
this.levels.add(ability.copy());
}
}
public List<LevelAbility> getLevels() {
return levels;
}
public LevelAbility getLevel(int level) {
for (LevelAbility levelerLevel: levels) {
if (level >= levelerLevel.getLevel1() && (levelerLevel.getLevel2() == -1 || level <= levelerLevel.getLevel2()))
return levelerLevel;
}
return null;
}
public int getMaxLevelCounters() {
for (LevelAbility levelerLevel: levels) {
if (levelerLevel.getLevel2() == -1)
return levelerLevel.getLevel1();
}
return 0;
return maxLevelCounters;
}
@Override
public List<String> getRules() {
List<String> rules = new ArrayList<String>();
rules.addAll(super.getRules());
for (LevelAbility ability: levels) {
rules.add(ability.getRule());
}
return rules;
}
public void setMaxLevelCounters(int maxLevelCounters) {
this.maxLevelCounters = maxLevelCounters;
}
}

View file

@ -35,8 +35,6 @@ import mage.game.Game;
import mage.game.events.ZoneChangeEvent;
import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@ -45,7 +43,6 @@ import java.util.UUID;
*/
public class PermanentCard extends PermanentImpl<PermanentCard> {
protected List<String> levelerRules;
protected int maxLevelCounters;
protected Card card;
@ -67,7 +64,6 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
this.loyalty = new MageInt(card.getLoyalty().getValue());
}*/
if (card instanceof LevelerCard) {
levelerRules = ((LevelerCard) card).getRules();
maxLevelCounters = ((LevelerCard) card).getMaxLevelCounters();
}
}
@ -239,14 +235,4 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
return this.maxLevelCounters;
}
@Override
public List<String> getRules() {
if (levelerRules == null)
return super.getRules();
List<String> rules = new ArrayList<String>();
rules.addAll(super.getRules());
rules.addAll(levelerRules);
return rules;
}
}