Fix Pyramid of the Pantheon, added class for 'new cards' found in find_new_cards.pl

This commit is contained in:
spjspj 2017-04-16 21:19:40 +10:00
parent 5ed434ce8c
commit f43eb06953
2 changed files with 18 additions and 44 deletions

View file

@ -29,21 +29,18 @@ package mage.cards.p;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.mana.ActivateIfConditionManaAbility;
import mage.abilities.mana.AnyColorManaAbility; import mage.abilities.mana.AnyColorManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game;
/** /**
* *
@ -61,9 +58,10 @@ public class PyramidOfThePantheon extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// {T}: Add three mana of any one color to your mana pool. Activate this ability only of there are three or more brick counters on Pyramid of the Pantheon. // {T}: Add three mana of any one color to your mana pool. Activate this ability only of there are three or more brick counters on Pyramid of the Pantheon.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new TapSourceCost()); this.addAbility(new ActivateIfConditionManaAbility(Zone.BATTLEFIELD,
ability2.addCost(new SourceHasCountersCost(3, CounterType.BRICK)); new AddManaOfAnyColorEffect(3),
this.addAbility(ability2); new TapSourceCost(),
new SourceHasCounterCondition(CounterType.BRICK, 1)));
} }
public PyramidOfThePantheon(final PyramidOfThePantheon card) { public PyramidOfThePantheon(final PyramidOfThePantheon card) {
@ -75,37 +73,3 @@ public class PyramidOfThePantheon extends CardImpl {
return new PyramidOfThePantheon(this); return new PyramidOfThePantheon(this);
} }
} }
class SourceHasCountersCost extends CostImpl {
private final int counters;
private final CounterType counterType;
public SourceHasCountersCost(int counters, CounterType counterType) {
this.counters = counters;
this.counterType = counterType;
this.text = "Activate this ability only if {this} has " + counters + " or more " + counterType.getName() + " counters on it";
}
public SourceHasCountersCost(final SourceHasCountersCost cost) {
super(cost);
this.counters = cost.counters;
this.counterType = cost.counterType;
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return (game.getPermanent(sourceId).getCounters(game).getCount(counterType) >= counters);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
this.paid = true;
return paid;
}
@Override
public SourceHasCountersCost copy() {
return new SourceHasCountersCost(this);
}
}

View file

@ -48,7 +48,6 @@ chomp $cmd;
my %cn_classes; my %cn_classes;
sub read_all_card_names sub read_all_card_names
{ {
print ("find \"cards.add\" ../Mage.Sets/src/mage/sets/*.java\n");
print ("find \"add\" ..\\Mage.Sets\\src\\mage\\sets\\*.java\n"); print ("find \"add\" ..\\Mage.Sets\\src\\mage\\sets\\*.java\n");
my $all_cards = `find \"add\" ..\\Mage.Sets\\src\\mage\\sets\\*.java`; my $all_cards = `find \"add\" ..\\Mage.Sets\\src\\mage\\sets\\*.java`;
my @cards = split /\n/, $all_cards; my @cards = split /\n/, $all_cards;
@ -122,12 +121,23 @@ if (exists ($new_order{$cmd}))
$past_line = $line; $past_line = $line;
} }
open MTG_CARDS_DATA, "mtg-cards-data.txt";
my %all_cards;
while (<MTG_CARDS_DATA>)
{
my $val = $_;
$val =~ s/\|/xxxx/;
$val =~ s/\|.*//;
$val =~ m/^(.*)xxxx(.*)/;
$all_cards {$1} = $2;
}
print ("Found these new card names!\n"); print ("Found these new card names!\n");
foreach $line (sort keys (%new_cards)) foreach $line (sort keys (%new_cards))
{ {
if ($new_cards {$line} > 0) if ($new_cards {$line} > 0)
{ {
print ($line, "\n"); print ($line, " in ", $all_cards {$line}, "\n");
} }
} }
} }