mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
Now Planeswalkers use counters for loyalty. Fixed Issue 69.
This commit is contained in:
parent
13497ec651
commit
d5c4ac371a
32 changed files with 169 additions and 64 deletions
|
@ -37,6 +37,7 @@ import mage.ObjectColor;
|
|||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.cards.Card;
|
||||
import mage.counters.CounterType;
|
||||
import mage.counters.Counters;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
|
@ -81,11 +82,11 @@ public class CardView implements Serializable {
|
|||
if (card instanceof Permanent) {
|
||||
this.power = Integer.toString(card.getPower().getValue());
|
||||
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||
this.loyalty = Integer.toString(card.getLoyalty().getValue());
|
||||
this.loyalty = Integer.toString(((Permanent) card).getCounters().getCount(CounterType.LOYALTY));
|
||||
} else {
|
||||
this.power = card.getPower().toString();
|
||||
this.toughness = card.getToughness().toString();
|
||||
this.loyalty = card.getLoyalty().toString();
|
||||
this.loyalty = "";
|
||||
}
|
||||
this.cardTypes = card.getCardType();
|
||||
this.subTypes = card.getSubtype();
|
||||
|
@ -123,7 +124,7 @@ public class CardView implements Serializable {
|
|||
this.rules = token.getAbilities().getRules(this.name);
|
||||
this.power = token.getPower().toString();
|
||||
this.toughness = token.getToughness().toString();
|
||||
this.loyalty = token.getLoyalty().toString();
|
||||
this.loyalty = "";
|
||||
this.cardTypes = token.getCardType();
|
||||
this.subTypes = token.getSubtype();
|
||||
this.superTypes = token.getSupertype();
|
||||
|
|
|
@ -51,7 +51,7 @@ public class StackAbilityView extends CardView {
|
|||
rules.add(ability.getRule(sourceName));
|
||||
this.power = ability.getPower().toString();
|
||||
this.toughness = ability.getToughness().toString();
|
||||
this.loyalty = ability.getLoyalty().toString();
|
||||
this.loyalty = "";
|
||||
this.cardTypes = ability.getCardType();
|
||||
this.subTypes = ability.getSubtype();
|
||||
this.superTypes = ability.getSupertype();
|
||||
|
|
|
@ -35,6 +35,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -66,7 +68,7 @@ public class CombatSimulator implements Serializable {
|
|||
}
|
||||
else {
|
||||
Permanent permanent = game.getPermanent(defenderId);
|
||||
simCombat.planeswalkerLoyalty.put(defenderId, permanent.getLoyalty().getValue());
|
||||
simCombat.planeswalkerLoyalty.put(defenderId, permanent.getCounters().getCount(CounterType.LOYALTY));
|
||||
}
|
||||
}
|
||||
return simCombat;
|
||||
|
|
|
@ -39,15 +39,19 @@ import mage.Constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddPlusOneCountersControlledEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -65,7 +69,7 @@ public class AjaniGoldmane extends CardImpl<AjaniGoldmane> {
|
|||
this.expansionSetCode = "M10";
|
||||
this.subtype.add("Ajani");
|
||||
this.color.setWhite(true);
|
||||
this.loyalty = new MageInt(4);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), ""));
|
||||
|
||||
this.addAbility(new LoyaltyAbility(new GainLifeEffect(2), 1));
|
||||
|
||||
|
|
|
@ -33,11 +33,14 @@ import mage.Constants.CardType;
|
|||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.common.DamageAllControlledTargetEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.DamageXTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
@ -53,7 +56,8 @@ public class ChandraNalaar extends CardImpl<ChandraNalaar> {
|
|||
this.expansionSetCode = "M10";
|
||||
this.subtype.add("Chandra ");
|
||||
this.color.setRed(true);
|
||||
this.loyalty = new MageInt(6);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(6)), ""));
|
||||
|
||||
|
||||
LoyaltyAbility ability1 = new LoyaltyAbility(new DamageTargetEffect(1), 1);
|
||||
ability1.addTarget(new TargetPlayer());
|
||||
|
|
|
@ -34,13 +34,16 @@ import mage.Constants.Duration;
|
|||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.common.continious.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.UntapTargetEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.permanent.token.BeastToken;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
@ -58,7 +61,8 @@ public class GarrukWildspeaker extends CardImpl<GarrukWildspeaker> {
|
|||
this.expansionSetCode = "M10";
|
||||
this.subtype.add("Garruk");
|
||||
this.color.setGreen(true);
|
||||
this.loyalty = new MageInt(3);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), ""));
|
||||
|
||||
|
||||
LoyaltyAbility ability1 = new LoyaltyAbility(new UntapTargetEffect(), 1);
|
||||
ability1.addTarget(new TargetLandPermanent(2));
|
||||
|
|
|
@ -33,10 +33,13 @@ import mage.Constants.CardType;
|
|||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.common.DrawCardAllEffect;
|
||||
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +53,8 @@ public class JaceBeleren extends CardImpl<JaceBeleren> {
|
|||
this.expansionSetCode = "M10";
|
||||
this.subtype.add("Jace");
|
||||
this.color.setBlue(true);
|
||||
this.loyalty = new MageInt(3);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), ""));
|
||||
|
||||
|
||||
this.addAbility(new LoyaltyAbility(new DrawCardAllEffect(1), 2));
|
||||
|
||||
|
|
|
@ -36,11 +36,14 @@ import mage.Constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DiscardTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutOnLibraryEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
@ -57,7 +60,7 @@ public class LilianaVess extends CardImpl<LilianaVess> {
|
|||
this.expansionSetCode = "M10";
|
||||
this.subtype.add("Liliana");
|
||||
this.color.setBlack(true);
|
||||
this.loyalty = new MageInt(5);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(5)), ""));
|
||||
|
||||
LoyaltyAbility ability1 = new LoyaltyAbility(new DiscardTargetEffect(1), 1);
|
||||
ability1.addTarget(new TargetPlayer());
|
||||
|
|
|
@ -36,11 +36,14 @@ import mage.Constants.TurnPhase;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.abilities.effects.common.continious.BecomesCreatureSourceEOTEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.PreventAllDamageSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -66,7 +69,7 @@ public class GideonJura extends CardImpl<GideonJura> {
|
|||
this.expansionSetCode = "ROE";
|
||||
this.subtype.add("Gideon");
|
||||
this.color.setWhite(true);
|
||||
this.loyalty = new MageInt(6);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(6)), ""));
|
||||
|
||||
LoyaltyAbility ability1 = new LoyaltyAbility(new GideonJuraEffect(), 2);
|
||||
ability1.addTarget(new TargetOpponent());
|
||||
|
|
|
@ -36,11 +36,14 @@ import mage.Constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -60,7 +63,7 @@ public class SarkhantheMad extends CardImpl<SarkhantheMad> {
|
|||
super(ownerId, 214, "Sarkhan the Mad", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{3}{B}{R}");
|
||||
this.expansionSetCode = "ROE";
|
||||
this.subtype.add("Sarkhan");
|
||||
this.loyalty = new MageInt(7);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(7)), ""));
|
||||
|
||||
this.color.setBlack(true);
|
||||
this.color.setRed(true);
|
||||
|
|
|
@ -36,9 +36,12 @@ import mage.Constants.Rarity;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -57,7 +60,9 @@ public class ElspethTirel extends CardImpl<ElspethTirel> {
|
|||
this.expansionSetCode = "SOM";
|
||||
this.subtype.add("Elspeth");
|
||||
this.color.setWhite(true);
|
||||
this.loyalty = new MageInt(4);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), ""));
|
||||
|
||||
|
||||
this.addAbility(new LoyaltyAbility(new ElspethTirelFirstEffect(), 2));
|
||||
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new SoldierToken(), 3), -2));
|
||||
this.addAbility(new LoyaltyAbility(new ElspethTirelThirdEffect(), -5));
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.Constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
|
@ -45,7 +46,9 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.ManaEffect;
|
||||
import mage.abilities.effects.common.UntapTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -70,7 +73,8 @@ public class KothoftheHammer extends CardImpl<KothoftheHammer> {
|
|||
this.expansionSetCode = "SOM";
|
||||
this.subtype.add("Koth");
|
||||
this.color.setRed(true);
|
||||
this.loyalty = new MageInt(3);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), ""));
|
||||
|
||||
Ability ability = new LoyaltyAbility(new UntapTargetEffect(), 1);
|
||||
ability.addEffect(new KothoftheHammerFirstEffect());
|
||||
ability.addTarget(new TargetLandPermanent(filter));
|
||||
|
|
|
@ -107,7 +107,7 @@ public class QuicksilverGargantuan extends CardImpl<QuicksilverGargantuan> {
|
|||
for (Ability ability : card.getAbilities()) {
|
||||
permanent.addAbility(ability);
|
||||
}
|
||||
permanent.getLoyalty().setValue(card.getLoyalty().getValue());
|
||||
//permanent.getLoyalty().setValue(card.getLoyalty().getValue());
|
||||
permanent.setArt(card.getArt());
|
||||
|
||||
return true;
|
||||
|
|
|
@ -33,12 +33,15 @@ import mage.Constants.CardType;
|
|||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.DestroyAllControlledTargetEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.SkipNextUntapTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.TargetPlayer;
|
||||
|
@ -56,7 +59,8 @@ public class AjaniVengeant extends CardImpl<AjaniVengeant> {
|
|||
this.subtype.add("Ajani");
|
||||
this.color.setRed(true);
|
||||
this.color.setWhite(true);
|
||||
this.loyalty = new MageInt(3);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), ""));
|
||||
|
||||
|
||||
LoyaltyAbility ability1 = new LoyaltyAbility(new SkipNextUntapTargetEffect(), 1);
|
||||
ability1.addTarget(new TargetPermanent());
|
||||
|
|
|
@ -38,14 +38,17 @@ import mage.Constants.SubLayer;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.common.continious.BoostTargetEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.IndestructibleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter.ComparisonScope;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -66,7 +69,7 @@ public class ElspethKnightErrant extends CardImpl<ElspethKnightErrant> {
|
|||
this.expansionSetCode = "ALA";
|
||||
this.subtype.add("Elspeth");
|
||||
this.color.setWhite(true);
|
||||
this.loyalty = new MageInt(4);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), ""));
|
||||
|
||||
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(soldierToken), 1));
|
||||
|
||||
|
|
|
@ -34,14 +34,17 @@ import mage.Constants.Duration;
|
|||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.common.continious.*;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.common.continious.GainControlTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.UntapTargetEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.permanent.token.DragonToken;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
@ -60,7 +63,7 @@ public class SarkhanVol extends CardImpl<SarkhanVol> {
|
|||
this.subtype.add("Sarkhan");
|
||||
this.color.setRed(true);
|
||||
this.color.setGreen(true);
|
||||
this.loyalty = new MageInt(4);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), ""));
|
||||
|
||||
Effects effects1 = new Effects();
|
||||
effects1.add(new BoostControlledEffect(1, 1, Duration.EndOfTurn));
|
||||
|
|
|
@ -36,12 +36,15 @@ import mage.Constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -61,7 +64,8 @@ public class JaceTheMindSculptor extends CardImpl<JaceTheMindSculptor> {
|
|||
this.expansionSetCode = "WWK";
|
||||
this.subtype.add("Jace");
|
||||
this.color.setBlue(true);
|
||||
this.loyalty = new MageInt(3);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), ""));
|
||||
|
||||
|
||||
LoyaltyAbility ability1 = new LoyaltyAbility(new JaceTheMindSculptorEffect1(), 2);
|
||||
ability1.addTarget(new TargetPlayer());
|
||||
|
|
|
@ -34,9 +34,12 @@ import mage.Constants.Rarity;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -63,7 +66,7 @@ public class NissaRevane extends CardImpl<NissaRevane> {
|
|||
super(ownerId, 170, "Nissa Revane", Rarity.MYTHIC, new CardType[]{ CardType.PLANESWALKER }, "{2}{G}{G}");
|
||||
this.expansionSetCode = "ZEN";
|
||||
this.subtype.add("Nissa");
|
||||
this.loyalty = new MageInt(2);
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(2)), ""));
|
||||
|
||||
this.color.setGreen(true);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
|
@ -94,19 +95,15 @@ class VampireHexmageEffect extends OneShotEffect<VampireHexmageEffect> {
|
|||
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
|
||||
if ( permanent != null ) {
|
||||
String[ ] counterNames = permanent.getCounters().keySet().toArray(new String[0]);
|
||||
if (permanent != null) {
|
||||
String[] counterNames = permanent.getCounters().keySet().toArray(new String[0]);
|
||||
|
||||
if ( permanent.getLoyalty() != null ) {
|
||||
permanent.getLoyalty().setValue(0);
|
||||
}
|
||||
for (String counterName : counterNames) {
|
||||
permanent.getCounters().remove(counterName);
|
||||
}
|
||||
|
||||
for ( String counterName : counterNames ) {
|
||||
permanent.getCounters().remove(counterName);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public interface MageObject extends MageItem, Serializable {
|
|||
|
||||
public MageInt getPower();
|
||||
public MageInt getToughness();
|
||||
public MageInt getLoyalty();
|
||||
|
||||
public void adjustCosts(Ability ability, Game game);
|
||||
|
||||
|
|
|
@ -31,14 +31,16 @@ package mage;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
|
||||
import mage.Constants.CardType;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.common.LoyaltyCounter;
|
||||
import mage.game.Game;
|
||||
|
||||
public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements MageObject {
|
||||
|
@ -55,7 +57,6 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements Mag
|
|||
protected String text;
|
||||
protected MageInt power;
|
||||
protected MageInt toughness;
|
||||
protected MageInt loyalty;
|
||||
|
||||
@Override
|
||||
public abstract T copy();
|
||||
|
@ -68,7 +69,6 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements Mag
|
|||
objectId = id;
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
loyalty = new MageInt(0);
|
||||
color = new ObjectColor();
|
||||
manaCost = new ManaCostsImpl<ManaCost>("");
|
||||
abilities = new AbilitiesImpl<Ability>();
|
||||
|
@ -82,7 +82,6 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements Mag
|
|||
color = object.color.copy();
|
||||
power = object.power.copy();
|
||||
toughness = object.toughness.copy();
|
||||
loyalty = object.loyalty.copy();
|
||||
abilities = object.abilities.copy();
|
||||
for (CardType cType: object.cardType) {
|
||||
cardType.add(cType);
|
||||
|
@ -140,11 +139,6 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements Mag
|
|||
return toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageInt getLoyalty() {
|
||||
return loyalty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectColor getColor() {
|
||||
return color;
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.abilities.costs.common;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -54,7 +55,7 @@ public class PayLoyaltyCost extends CostImpl<PayLoyaltyCost> {
|
|||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
Permanent planeswalker = game.getPermanent(sourceId);
|
||||
if (planeswalker.getLoyalty().getValue() + amount >= 0 && !planeswalker.isLoyaltyUsed())
|
||||
if (planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && !planeswalker.isLoyaltyUsed())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -62,8 +63,12 @@ public class PayLoyaltyCost extends CostImpl<PayLoyaltyCost> {
|
|||
@Override
|
||||
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
Permanent planeswalker = game.getPermanent(sourceId);
|
||||
if (planeswalker.getLoyalty().getValue() + amount >= 0 && !planeswalker.isLoyaltyUsed()) {
|
||||
planeswalker.getLoyalty().boostValue(amount);
|
||||
if (planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && !planeswalker.isLoyaltyUsed()) {
|
||||
if (amount > 0) {
|
||||
planeswalker.getCounters().addCounter(CounterType.LOYALTY.createInstance(amount));
|
||||
} else if (amount < 0) {
|
||||
planeswalker.getCounters().removeCounter(CounterType.LOYALTY, Math.abs(amount));
|
||||
}
|
||||
planeswalker.setLoyaltyUsed(true);
|
||||
this.paid = true;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ package mage.abilities.costs.common;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -62,8 +63,12 @@ public class PayVariableLoyaltyCost extends CostImpl<PayVariableLoyaltyCost> imp
|
|||
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
Permanent planeswalker = game.getPermanent(sourceId);
|
||||
Player player = game.getPlayer(planeswalker.getControllerId());
|
||||
this.amountPaid = player.getAmount(0, planeswalker.getLoyalty().getValue(), "", game);
|
||||
planeswalker.getLoyalty().boostValue(-amountPaid);
|
||||
this.amountPaid = player.getAmount(0, planeswalker.getCounters().getCount(CounterType.LOYALTY), "Choose X", game);
|
||||
if (this.amountPaid> 0) {
|
||||
planeswalker.getCounters().removeCounter(CounterType.LOYALTY, this.amountPaid);
|
||||
} else if (this.amountPaid < 0) {
|
||||
planeswalker.getCounters().addCounter(CounterType.LOYALTY.createInstance(Math.abs(this.amountPaid)));
|
||||
}
|
||||
planeswalker.setLoyaltyUsed(true);
|
||||
this.paid = true;
|
||||
return paid;
|
||||
|
|
|
@ -80,7 +80,7 @@ public class CopyEffect extends ContinuousEffectImpl<CopyEffect> {
|
|||
}
|
||||
permanent.getPower().setValue(card.getPower().getValue());
|
||||
permanent.getToughness().setValue(card.getToughness().getValue());
|
||||
permanent.getLoyalty().setValue(card.getLoyalty().getValue());
|
||||
//permanent.getLoyalty().setValue(card.getLoyalty().getValue());
|
||||
permanent.setArt(card.getArt());
|
||||
|
||||
return true;
|
||||
|
|
|
@ -54,13 +54,15 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
|
|||
super(Outcome.Benefit);
|
||||
this.name = counter.getName();
|
||||
this.counter = counter.copy();
|
||||
this.amount = counter.getCount();
|
||||
}
|
||||
|
||||
public AddCountersSourceEffect(final AddCountersSourceEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
this.name = effect.name;
|
||||
this.counter = effect.counter;
|
||||
if (effect.counter != null)
|
||||
this.counter = effect.counter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,6 +40,7 @@ public enum CounterType {
|
|||
M1M1(new MinusOneCounter().name),
|
||||
POISON(new PoisonCounter().name),
|
||||
CHARGE(new ChargeCounter().name),
|
||||
LOYALTY(new LoyaltyCounter().name),
|
||||
LEVEL(new LevelCounter().name),
|
||||
TIME(new TimeCounter().name),
|
||||
FADE(new FadeCounter().name),
|
||||
|
@ -89,6 +90,8 @@ public enum CounterType {
|
|||
return new PoisonCounter(amount);
|
||||
case CHARGE:
|
||||
return new ChargeCounter(amount);
|
||||
case LOYALTY:
|
||||
return new LoyaltyCounter(amount);
|
||||
case LEVEL:
|
||||
return new LevelCounter(amount);
|
||||
case TIME:
|
||||
|
|
55
Mage/src/mage/counters/common/LoyaltyCounter.java
Normal file
55
Mage/src/mage/counters/common/LoyaltyCounter.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.counters.common;
|
||||
|
||||
import mage.counters.Counter;
|
||||
|
||||
/**
|
||||
* Loyalty counter.
|
||||
*
|
||||
* 208. Loyalty
|
||||
*
|
||||
* 208.1. Each planeswalker card has a loyalty number printed in its lower right corner. This indicates its loyalty while it's not on the battlefield, and it also indicates that the planeswalker enters the battlefield with that many loyalty counters on it.
|
||||
*
|
||||
* 208.2. An activated ability with a loyalty symbol in its cost is a loyalty ability. Loyalty abilities follow special rules: A player may activate a loyalty ability of a permanent he or she controls any time he or she has priority and the stack is empty during a main phase of his or her turn, but only if none of that permanent's loyalty abilities have been activated that turn. See rule 606, "Loyalty Abilities."
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class LoyaltyCounter extends Counter<LoyaltyCounter> {
|
||||
|
||||
public LoyaltyCounter() {
|
||||
super("Loyalty");
|
||||
this.count = 1;
|
||||
}
|
||||
|
||||
public LoyaltyCounter(int amount) {
|
||||
super("Loyalty");
|
||||
this.count = amount;
|
||||
}
|
||||
}
|
|
@ -630,7 +630,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
}
|
||||
//20091005 - 704.5i
|
||||
for (Permanent perm: getBattlefield().getAllActivePermanents(CardType.PLANESWALKER)) {
|
||||
if (perm.getLoyalty().getValue() == 0) {
|
||||
if (perm.getCounters().getCount(CounterType.LOYALTY) == 0) {
|
||||
if (perm.moveToZone(Zone.GRAVEYARD, null, this, false))
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
|
|||
|
||||
protected void init(Card card) {
|
||||
copyFromCard(card);
|
||||
if (card.getCardType().contains(CardType.PLANESWALKER)) {
|
||||
/*if (card.getCardType().contains(CardType.PLANESWALKER)) {
|
||||
this.loyalty = new MageInt(card.getLoyalty().getValue());
|
||||
}
|
||||
}*/
|
||||
if (card instanceof LevelerCard) {
|
||||
levelerRules = ((LevelerCard)card).getRules();
|
||||
}
|
||||
|
|
|
@ -456,10 +456,11 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
|
|||
if (!game.replaceEvent(event)) {
|
||||
int actualDamage = event.getAmount();
|
||||
if (actualDamage > 0) {
|
||||
if (event.getAmount() > this.loyalty.getValue()) {
|
||||
actualDamage = this.loyalty.getValue();
|
||||
int countersToRemove = actualDamage;
|
||||
if (countersToRemove > getCounters().getCount(CounterType.LOYALTY)) {
|
||||
countersToRemove = getCounters().getCount(CounterType.LOYALTY);
|
||||
}
|
||||
this.loyalty.boostValue(-actualDamage);
|
||||
getCounters().removeCounter(CounterType.LOYALTY, countersToRemove);
|
||||
game.fireEvent(new DamagedPlaneswalkerEvent(objectId, sourceId, controllerId, actualDamage, combat));
|
||||
return actualDamage;
|
||||
}
|
||||
|
|
|
@ -224,11 +224,6 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
return card.getToughness();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageInt getLoyalty() {
|
||||
return card.getLoyalty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return ability.getId();
|
||||
|
|
|
@ -147,11 +147,6 @@ public class StackAbility implements StackObject, Ability {
|
|||
return MageInt.EmptyMageInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageInt getLoyalty() {
|
||||
return MageInt.EmptyMageInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Zone getZone() {
|
||||
return this.ability.getZone();
|
||||
|
|
Loading…
Add table
Reference in a new issue