diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BeastbreakerOfBalaGed.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BeastbreakerOfBalaGed.java index ec5fa625ee..bb54e02f35 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BeastbreakerOfBalaGed.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BeastbreakerOfBalaGed.java @@ -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 { @@ -58,11 +59,13 @@ public class BeastbreakerOfBalaGed extends LevelerCard { this.addAbility(new LevelUpAbility(new ManaCostsImpl("{2}{G}"))); - this.getLevels().add(new LevelAbility(1, 3, new AbilitiesImpl(), 4, 4)); - Abilities levelAbilities = new AbilitiesImpl(); levelAbilities.add(TrampleAbility.getInstance()); - this.getLevels().add(new LevelAbility(4, -1, levelAbilities, 6, 6)); + + LevelerCardBuilder.construct(this, + new LevelerCardBuilder.LevelAbility(1, 3, new AbilitiesImpl(), 4, 4), + new LevelerCardBuilder.LevelAbility(4, -1, levelAbilities, 6, 6) + ); } public BeastbreakerOfBalaGed(final BeastbreakerOfBalaGed card) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BrimstoneMage.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BrimstoneMage.java index 08124dc8e7..8e4b2619ea 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BrimstoneMage.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BrimstoneMage.java @@ -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 { @@ -65,14 +66,16 @@ public class BrimstoneMage extends LevelerCard { 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 abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CaravanEscort.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CaravanEscort.java index b65e16e13f..e2f0ba8430 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CaravanEscort.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CaravanEscort.java @@ -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 { this.addAbility(new LevelUpAbility(new ManaCostsImpl("{2}"))); - this.getLevels().add(new LevelAbility(1, 4, new AbilitiesImpl(), 2, 2)); + AbilitiesImpl levelAbilities = new AbilitiesImpl(FirstStrikeAbility.getInstance()); + LevelerCardBuilder.construct(this, + new LevelerCardBuilder.LevelAbility(1, 4, new AbilitiesImpl(), 2, 2), + new LevelerCardBuilder.LevelAbility(5, -1, levelAbilities, 5, 5) + ); - Abilities levelAbilities = new AbilitiesImpl(); - levelAbilities.add(FirstStrikeAbility.getInstance()); - this.getLevels().add(new LevelAbility(5, -1, levelAbilities, 5, 5)); + setMaxLevelCounters(5); } public CaravanEscort(final CaravanEscort card) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CoralhelmCommander.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CoralhelmCommander.java index d46f1f57e5..32f1dc8dc2 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CoralhelmCommander.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CoralhelmCommander.java @@ -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 { Abilities abilities1 = new AbilitiesImpl(); abilities1.add(FlyingAbility.getInstance()); - this.getLevels().add(new LevelAbility(2, 3, abilities1, 3, 3)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/EnclaveCryptologist.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/EnclaveCryptologist.java index 9aacf44900..97e838cd23 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/EnclaveCryptologist.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/EnclaveCryptologist.java @@ -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 { @@ -61,16 +62,17 @@ public class EnclaveCryptologist extends LevelerCard { this.toughness = new MageInt(1); this.addAbility(new LevelUpAbility(new ManaCostsImpl("{1}{U}"))); - Abilities abilities1 = new AbilitiesImpl(); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(), new TapSourceCost()); - abilities1.add(ability); - this.getLevels().add(new LevelAbility(1, 2, abilities1, 0, 1)); + Abilities abilities1 = new AbilitiesImpl(ability); - Abilities abilities2 = new AbilitiesImpl(); ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), new TapSourceCost()); - abilities2.add(ability); - this.getLevels().add(new LevelAbility(3, -1, abilities2, 0, 1)); + Abilities abilities2 = new AbilitiesImpl(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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GuulDrazAssassin.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GuulDrazAssassin.java index 3f2a8ed014..7441ceb683 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GuulDrazAssassin.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GuulDrazAssassin.java @@ -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 { @@ -62,18 +62,23 @@ public class GuulDrazAssassin extends LevelerCard { this.toughness = new MageInt(1); this.addAbility(new LevelUpAbility(new ManaCostsImpl("{1}{B}"))); + Abilities abilities1 = new AbilitiesImpl(); 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 abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HadaSpyPatrol.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HadaSpyPatrol.java index bb742aeb58..8f09f15f7d 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HadaSpyPatrol.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HadaSpyPatrol.java @@ -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 { @@ -61,12 +62,15 @@ public class HadaSpyPatrol extends LevelerCard { Abilities abilities1 = new AbilitiesImpl(); abilities1.add(UnblockableAbility.getInstance()); - this.getLevels().add(new LevelAbility(1, 2, abilities1, 2, 2)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HalimarWavewatch.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HalimarWavewatch.java index 3e4e77a110..625b6102e2 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HalimarWavewatch.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HalimarWavewatch.java @@ -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 { @@ -58,11 +59,13 @@ public class HalimarWavewatch extends LevelerCard { this.addAbility(new LevelUpAbility(new ManaCostsImpl("{2}"))); - this.getLevels().add(new LevelAbility(1, 4, new AbilitiesImpl(), 0, 6)); - Abilities levelAbilities = new AbilitiesImpl(); levelAbilities.add(new IslandwalkAbility()); - this.getLevels().add(new LevelAbility(5, -1, levelAbilities, 6, 6)); + + LevelerCardBuilder.construct(this, + new LevelerCardBuilder.LevelAbility(1, 4, new AbilitiesImpl(), 0, 6), + new LevelerCardBuilder.LevelAbility(5, -1, levelAbilities, 6, 6) + ); } public HalimarWavewatch(final HalimarWavewatch card) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/IkiralOutrider.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/IkiralOutrider.java index 885e6a89e0..6dd3f9ddcf 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/IkiralOutrider.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/IkiralOutrider.java @@ -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 { @@ -58,12 +58,17 @@ public class IkiralOutrider extends LevelerCard { this.toughness = new MageInt(2); this.addAbility(new LevelUpAbility(new ManaCostsImpl("{4}"))); + Abilities abilities1 = new AbilitiesImpl(); abilities1.add(VigilanceAbility.getInstance()); - this.getLevels().add(new LevelAbility(1, 3, abilities1, 2, 6)); + Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/JoragaTreespeaker.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/JoragaTreespeaker.java index a409ba6356..751606017e 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/JoragaTreespeaker.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/JoragaTreespeaker.java @@ -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 { @@ -76,15 +77,18 @@ public class JoragaTreespeaker extends LevelerCard { Abilities abilities1 = new AbilitiesImpl(); abilities1.add(new SimpleManaAbility(Zone.BATTLEFIELD, new BasicManaEffect(Mana.GreenMana(2)), new TapSourceCost())); - this.getLevels().add(new LevelAbility(1, 4, abilities1, 1, 2)); - + Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KabiraVindicator.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KabiraVindicator.java index 558b944c6b..60daaeec6f 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KabiraVindicator.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KabiraVindicator.java @@ -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 { @@ -64,11 +65,14 @@ public class KabiraVindicator extends LevelerCard { Abilities abilities1 = new AbilitiesImpl(); 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 abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KarganDragonlord.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KarganDragonlord.java index f2860e579e..8df5320132 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KarganDragonlord.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KarganDragonlord.java @@ -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 { @@ -62,14 +63,19 @@ public class KarganDragonlord extends LevelerCard { this.toughness = new MageInt(2); this.addAbility(new LevelUpAbility(new ManaCostsImpl("{R}"))); + Abilities abilities1 = new AbilitiesImpl(); abilities1.add(FlyingAbility.getInstance()); - this.getLevels().add(new LevelAbility(4, 7, abilities1, 4, 4)); + Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KazanduTuskcaller.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KazanduTuskcaller.java index 5ee94f55b4..25e681b18f 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KazanduTuskcaller.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KazanduTuskcaller.java @@ -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 { @@ -66,13 +66,16 @@ public class KazanduTuskcaller extends LevelerCard { abilities1.add(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new ElephantToken()), new TapSourceCost())); - this.getLevels().add(new LevelAbility(2, 5, abilities1, 1, 1)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KnightOfCliffhaven.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KnightOfCliffhaven.java index 9ff68a5a9c..4ad6b8e2e9 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KnightOfCliffhaven.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KnightOfCliffhaven.java @@ -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 { @@ -61,12 +62,15 @@ public class KnightOfCliffhaven extends LevelerCard { Abilities abilities1 = new AbilitiesImpl(); abilities1.add(FlyingAbility.getInstance()); - this.getLevels().add(new LevelAbility(1, 3, abilities1, 2, 3)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java index 99670e7488..85354ac63b 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java @@ -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 { @@ -63,13 +64,16 @@ public class LighthouseChronologist extends LevelerCard this.toughness = new MageInt(3); this.addAbility(new LevelUpAbility(new ManaCostsImpl("{U}"))); + Abilities abilities1 = new AbilitiesImpl(); - this.getLevels().add(new LevelAbility(4, 6, abilities1, 2, 4)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaCutthroat.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaCutthroat.java index 103d464fc0..3cf5c28fdc 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaCutthroat.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaCutthroat.java @@ -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 { @@ -61,12 +61,15 @@ public class NirkanaCutthroat extends LevelerCard { Abilities abilities1 = new AbilitiesImpl(); abilities1.add(DeathtouchAbility.getInstance()); - this.getLevels().add(new LevelAbility(1, 2, abilities1, 4, 3)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/NullChampion.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/NullChampion.java index d6bf3544ea..43809c5ec1 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/NullChampion.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/NullChampion.java @@ -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 { @@ -63,11 +61,14 @@ public class NullChampion extends LevelerCard { this.addAbility(new LevelUpAbility(new ManaCostsImpl("{3}"))); Abilities abilities1 = new AbilitiesImpl(); - this.getLevels().add(new LevelAbility(1, 3, abilities1, 4, 2)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SkywatcherAdept.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SkywatcherAdept.java index d098401433..17bc72d7aa 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SkywatcherAdept.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SkywatcherAdept.java @@ -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 { @@ -60,11 +61,14 @@ public class SkywatcherAdept extends LevelerCard { Abilities abilities1 = new AbilitiesImpl(); abilities1.add(FlyingAbility.getInstance()); - this.getLevels().add(new LevelAbility(1, 2, abilities1, 2, 2)); Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/StudentOfWarfare.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/StudentOfWarfare.java index 088f117923..76e3675970 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/StudentOfWarfare.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/StudentOfWarfare.java @@ -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 { @@ -60,10 +61,14 @@ public class StudentOfWarfare extends LevelerCard { this.addAbility(new LevelUpAbility(new ManaCostsImpl("{W}"))); Abilities abilities1 = new AbilitiesImpl(); abilities1.add(FirstStrikeAbility.getInstance()); - this.getLevels().add(new LevelAbility(2, 6, abilities1, 3, 3)); + Abilities abilities2 = new AbilitiesImpl(); 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java index 42b3cad14a..42ddec3890 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/TranscendentMaster.java @@ -40,7 +40,7 @@ import mage.cards.LevelerCard; import java.util.UUID; /** - * @author North + * @author North, noxx */ public class TranscendentMaster extends LevelerCard { @@ -61,9 +61,9 @@ public class TranscendentMaster extends LevelerCard { Abilities abilities2 = new AbilitiesImpl(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) ); } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ZulaportEnforcer.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ZulaportEnforcer.java index 855062be58..57f9b16abd 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ZulaportEnforcer.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ZulaportEnforcer.java @@ -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 { @@ -61,13 +62,18 @@ public class ZulaportEnforcer extends LevelerCard { 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(), 3, 3)); + // LEVEL 3+: 5/5 // Zulaport Enforcer can't be blocked except by black creatures. Abilities levelAbilities = new AbilitiesImpl(); levelAbilities.add(ZulaportEnforcerAbility.getInstance()); - this.getLevels().add(new LevelAbility(3, -1, levelAbilities, 5, 5)); + + LevelerCardBuilder.construct(this, + new LevelerCardBuilder.LevelAbility(1, 2, new AbilitiesImpl(), 3, 3), + new LevelerCardBuilder.LevelAbility(3, -1, levelAbilities, 5, 5) + ); } public ZulaportEnforcer(final ZulaportEnforcer card) { diff --git a/Mage.Tests/src/test/java/org/mage/test/ai/LevelUpAbilityTest.java b/Mage.Tests/src/test/java/org/mage/test/ai/LevelUpAbilityTest.java deleted file mode 100644 index 530bf8ed07..0000000000 --- a/Mage.Tests/src/test/java/org/mage/test/ai/LevelUpAbilityTest.java +++ /dev/null @@ -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 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)); - } -} diff --git a/Mage/src/mage/abilities/keyword/LevelAbility.java b/Mage/src/mage/abilities/keyword/LevelAbility.java deleted file mode 100644 index 7eb3fc2292..0000000000 --- a/Mage/src/mage/abilities/keyword/LevelAbility.java +++ /dev/null @@ -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 { - - private int level1; - private int level2; - private int power; - private int toughness; - - private Abilities abilities = new AbilitiesImpl(); - - public LevelAbility(int level1, int level2, Abilities 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 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); - } - -} diff --git a/Mage/src/mage/abilities/keyword/LevelerCardBuilder.java b/Mage/src/mage/abilities/keyword/LevelerCardBuilder.java new file mode 100644 index 0000000000..65aad738f9 --- /dev/null +++ b/Mage/src/mage/abilities/keyword/LevelerCardBuilder.java @@ -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 abilities = new AbilitiesImpl(); + + /** + * Main method constructing ability. + * + * @return + */ + public List build() { + List constructed = new ArrayList(); + + 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 abilities = new AbilitiesImpl(); + + public LevelAbility(int level1, int level2, Abilities 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 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(); + } + + } +} diff --git a/Mage/src/mage/cards/LevelerCard.java b/Mage/src/mage/cards/LevelerCard.java index 371d8a3e8b..9ae49d502b 100644 --- a/Mage/src/mage/cards/LevelerCard.java +++ b/Mage/src/mage/cards/LevelerCard.java @@ -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> extends CardImpl { - protected List levels = new ArrayList(); - + 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)card.levels) { - this.levels.add(ability.copy()); - } - } - - public List 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 getRules() { - List rules = new ArrayList(); - rules.addAll(super.getRules()); - for (LevelAbility ability: levels) { - rules.add(ability.getRule()); - } - return rules; - } + public void setMaxLevelCounters(int maxLevelCounters) { + this.maxLevelCounters = maxLevelCounters; + } } diff --git a/Mage/src/mage/game/permanent/PermanentCard.java b/Mage/src/mage/game/permanent/PermanentCard.java index dbc15112dd..3d0a3d8a22 100644 --- a/Mage/src/mage/game/permanent/PermanentCard.java +++ b/Mage/src/mage/game/permanent/PermanentCard.java @@ -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 { - protected List levelerRules; protected int maxLevelCounters; protected Card card; @@ -67,7 +64,6 @@ public class PermanentCard extends PermanentImpl { 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 { return this.maxLevelCounters; } - @Override - public List getRules() { - if (levelerRules == null) - return super.getRules(); - List rules = new ArrayList(); - rules.addAll(super.getRules()); - rules.addAll(levelerRules); - return rules; - } - }