This commit is contained in:
Loki 2011-11-06 16:41:43 +04:00
commit 1b51ecd2e5

View file

@ -46,65 +46,63 @@ import java.util.UUID;
*/ */
public class BlasphemousAct extends CardImpl<BlasphemousAct> { public class BlasphemousAct extends CardImpl<BlasphemousAct> {
public BlasphemousAct(UUID ownerId) { public BlasphemousAct(UUID ownerId) {
super(ownerId, 130, "Blasphemous Act", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{8}{R}"); super(ownerId, 130, "Blasphemous Act", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{8}{R}");
this.expansionSetCode = "ISD"; this.expansionSetCode = "ISD";
this.color.setRed(true); this.color.setRed(true);
// Blasphemous Act costs {1} less to cast for each creature on the battlefield. // Blasphemous Act costs {1} less to cast for each creature on the battlefield.
// Blasphemous Act deals 13 damage to each creature. // Blasphemous Act deals 13 damage to each creature.
// need to override DamageAllEffect because of rules string // need to override DamageAllEffect because of rules string
this.getSpellAbility().addEffect(new BlasphemousActEffect()); this.getSpellAbility().addEffect(new BlasphemousActEffect());
} }
@Override @Override
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
if (MetalcraftCondition.getInstance().apply(game, ability)) { int creatureCount = game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent()).size();
int creatureCount = game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent()).size(); int cost = 8 - creatureCount;
int cost = 8 - creatureCount; String adjustedCost = "{R}";
String adjustedCost = "{R}"; if (cost > 0) {
if (cost > 0) { adjustedCost = "{" + String.valueOf(cost) + "}" + adjustedCost;
adjustedCost = "{" + String.valueOf(cost) + "}" + adjustedCost; }
} ability.getManaCostsToPay().clear();
ability.getManaCostsToPay().clear(); ability.getManaCostsToPay().load(adjustedCost);
ability.getManaCostsToPay().load(adjustedCost); }
}
}
public BlasphemousAct(final BlasphemousAct card) { public BlasphemousAct(final BlasphemousAct card) {
super(card); super(card);
} }
@Override @Override
public BlasphemousAct copy() { public BlasphemousAct copy() {
return new BlasphemousAct(this); return new BlasphemousAct(this);
} }
} }
class BlasphemousActEffect extends OneShotEffect<BlasphemousActEffect> { class BlasphemousActEffect extends OneShotEffect<BlasphemousActEffect> {
public BlasphemousActEffect() { public BlasphemousActEffect() {
super(Constants.Outcome.Damage); super(Constants.Outcome.Damage);
staticText = "{this} costs {1} less to cast for each creature on the battlefield.\n {this} deals 13 damage to each creature"; staticText = "{this} costs {1} less to cast for each creature on the battlefield.\n {this} deals 13 damage to each creature";
} }
public BlasphemousActEffect(final BlasphemousActEffect effect) { public BlasphemousActEffect(final BlasphemousActEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game); List<Permanent> permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game);
for (Permanent permanent : permanents) { for (Permanent permanent : permanents) {
permanent.damage(13, source.getId(), game, true, false); permanent.damage(13, source.getId(), game, true, false);
} }
return true; return true;
} }
@Override @Override
public BlasphemousActEffect copy() { public BlasphemousActEffect copy() {
return new BlasphemousActEffect(this); return new BlasphemousActEffect(this);
} }
} }