use of mage.counters.BoostCounter in project mage by magefree.
the class GameStateEvaluator method evaluatePermanent.
public static int evaluatePermanent(Permanent permanent, Game game, boolean ignoreTapped) {
int value = 0;
if (ignoreTapped) {
value = 5;
} else {
value = permanent.isTapped() ? 4 : 5;
}
if (permanent.getCardType(game).contains(CardType.CREATURE)) {
value += evaluateCreature(permanent, game) * CREATURE_FACTOR;
}
value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size();
for (ActivatedAbility ability : permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
if (!(ability instanceof ActivatedManaAbilityImpl) && ability.canActivate(ability.getControllerId(), game).canActivate()) {
value += ability.getEffects().size();
}
}
for (Counter counter : permanent.getCounters(game).values()) {
if (!(counter instanceof BoostCounter)) {
value += counter.getCount();
}
}
value += permanent.getAbilities().getStaticAbilities(Zone.BATTLEFIELD).size();
value += permanent.getAbilities().getTriggeredAbilities(Zone.BATTLEFIELD).size();
value += permanent.getManaCost().manaValue();
// TODO: add a difficulty to calculation to ManaCost - sort permanents by difficulty for casting when evaluating game states
return value;
}
use of mage.counters.BoostCounter in project mage by magefree.
the class LesserWerewolfEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
// must be valid target
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
if (controller != null && sourcePermanent != null && targetPermanent != null) {
if (sourcePermanent.getPower().getValue() >= 1) {
game.addEffect(new BoostSourceEffect(-1, 0, Duration.EndOfTurn), source);
new AddCountersTargetEffect(new BoostCounter(0, -1), outcome).apply(game, source);
}
return true;
}
return false;
}
use of mage.counters.BoostCounter in project mage by magefree.
the class ApplyCountersEffect method apply.
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
if (layer == Layer.AbilityAddingRemovingEffects_6) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
for (AbilityCounter counter : permanent.getCounters(game).getAbilityCounters()) {
permanent.addAbility(counter.getAbility(), source == null ? permanent.getId() : source.getSourceId(), game);
}
}
}
if (layer == Layer.PTChangingEffects_7 && sublayer == SubLayer.Counters_7d) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE, game)) {
for (BoostCounter counter : permanent.getCounters(game).getBoostCounters()) {
permanent.addPower(counter.getPower() * counter.getCount());
permanent.addToughness(counter.getToughness() * counter.getCount());
}
}
}
return true;
}
Aggregations