forked from External/mage
Implemented Fully Grown
This commit is contained in:
parent
75414cef2e
commit
2483fd9c8d
7 changed files with 119 additions and 20 deletions
|
|
@ -1,45 +1,57 @@
|
|||
|
||||
|
||||
package mage.abilities.effects;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.*;
|
||||
import mage.counters.AbilityCounter;
|
||||
import mage.counters.BoostCounter;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ApplyCountersEffect extends ContinuousEffectImpl {
|
||||
|
||||
public ApplyCountersEffect() {
|
||||
super(Duration.EndOfGame, Layer.PTChangingEffects_7, SubLayer.Counters_7d, Outcome.BoostCreature);
|
||||
ApplyCountersEffect() {
|
||||
super(Duration.EndOfGame, Outcome.BoostCreature);
|
||||
}
|
||||
|
||||
public ApplyCountersEffect(ApplyCountersEffect effect) {
|
||||
private ApplyCountersEffect(ApplyCountersEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) {
|
||||
for (BoostCounter counter: permanent.getCounters(game).getBoostCounters()) {
|
||||
permanent.addPower(counter.getPower() * counter.getCount());
|
||||
permanent.addToughness(counter.getToughness() * counter.getCount());
|
||||
return false;
|
||||
}
|
||||
|
||||
@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 ? null : source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (layer == Layer.PTChangingEffects_7 && sublayer == SubLayer.Counters_7d) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) {
|
||||
for (BoostCounter counter : permanent.getCounters(game).getBoostCounters()) {
|
||||
permanent.addPower(counter.getPower() * counter.getCount());
|
||||
permanent.addToughness(counter.getToughness() * counter.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplyCountersEffect copy() {
|
||||
return new ApplyCountersEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue