mirror of
https://github.com/correl/mage.git
synced 2025-04-08 09:11:04 -09:00
Implemented Fully Grown
This commit is contained in:
parent
75414cef2e
commit
2483fd9c8d
7 changed files with 119 additions and 20 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage
abilities/effects
counters
36
Mage.Sets/src/mage/cards/f/FullyGrown.java
Normal file
36
Mage.Sets/src/mage/cards/f/FullyGrown.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class FullyGrown extends CardImpl {
|
||||
|
||||
public FullyGrown(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}");
|
||||
|
||||
// Target creature gets +3/+3 until end of turn. Put a trample counter on it.
|
||||
this.getSpellAbility().addEffect(new BoostTargetEffect(3, 3));
|
||||
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.TRAMPLE.createInstance())
|
||||
.setText("Put a +1/+1 counter on it"));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
private FullyGrown(final FullyGrown card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FullyGrown copy() {
|
||||
return new FullyGrown(this);
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
|
|||
|
||||
cards.add(new SetCardInfo("Bristling Boar", 146, Rarity.COMMON, mage.cards.b.BristlingBoar.class));
|
||||
cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class));
|
||||
cards.add(new SetCardInfo("Fully Grown", 154, Rarity.COMMON, mage.cards.f.FullyGrown.class));
|
||||
cards.add(new SetCardInfo("Gloom Pangolin", 89, Rarity.COMMON, mage.cards.g.GloomPangolin.class));
|
||||
cards.add(new SetCardInfo("Mosscoat Goriak", 167, Rarity.COMMON, mage.cards.m.MosscoatGoriak.class));
|
||||
cards.add(new SetCardInfo("Pacifism", 25, Rarity.COMMON, mage.cards.p.Pacifism.class));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -944,6 +944,8 @@ public class ContinuousEffects implements Serializable {
|
|||
boolean done = false;
|
||||
Map<ContinuousEffect, Set<UUID>> waitingEffects = new LinkedHashMap<>();
|
||||
Set<UUID> appliedEffects = new HashSet<>();
|
||||
applyCounters.apply(Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, null, game);
|
||||
|
||||
while (!done) { // loop needed if a added effect adds again an effect (e.g. Level 5- of Joraga Treespeaker)
|
||||
done = true;
|
||||
layer = filterLayeredEffects(activeLayerEffects, Layer.AbilityAddingRemovingEffects_6);
|
||||
|
|
34
Mage/src/main/java/mage/counters/AbilityCounter.java
Normal file
34
Mage/src/main/java/mage/counters/AbilityCounter.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package mage.counters;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class AbilityCounter extends Counter {
|
||||
|
||||
private final Ability ability;
|
||||
|
||||
AbilityCounter(Ability ability) {
|
||||
this(ability, 1);
|
||||
}
|
||||
|
||||
AbilityCounter(Ability ability, int count) {
|
||||
super(ability.getRule(), count);
|
||||
this.ability = ability;
|
||||
}
|
||||
|
||||
private AbilityCounter(final AbilityCounter counter) {
|
||||
super(counter);
|
||||
this.ability = counter.ability;
|
||||
}
|
||||
|
||||
public Ability getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityCounter copy() {
|
||||
return new AbilityCounter(this);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package mage.counters;
|
||||
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
||||
/**
|
||||
* Enum for counters, names and instances.
|
||||
*
|
||||
|
@ -131,6 +133,7 @@ public enum CounterType {
|
|||
TIME("time"),
|
||||
TOWER("tower"),
|
||||
TRAINING("training"),
|
||||
TRAMPLE("trample"),
|
||||
TRAP("trap"),
|
||||
TREASURE("treasure"),
|
||||
UNITY("unity"),
|
||||
|
@ -192,6 +195,8 @@ public enum CounterType {
|
|||
return new BoostCounter(-2, -1, amount);
|
||||
case M2M2:
|
||||
return new BoostCounter(-2, -2, amount);
|
||||
case TRAMPLE:
|
||||
return new AbilityCounter(TrampleAbility.getInstance());
|
||||
default:
|
||||
return new Counter(name, amount);
|
||||
}
|
||||
|
|
|
@ -96,9 +96,18 @@ public class Counters extends HashMap<String, Counter> implements Serializable {
|
|||
}
|
||||
|
||||
public List<BoostCounter> getBoostCounters() {
|
||||
return values().stream().
|
||||
filter(counter -> counter instanceof BoostCounter).
|
||||
map(counter -> (BoostCounter) counter).
|
||||
collect(Collectors.toList());
|
||||
return values()
|
||||
.stream()
|
||||
.filter(BoostCounter.class::isInstance)
|
||||
.map(BoostCounter.class::cast)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<AbilityCounter> getAbilityCounters() {
|
||||
return values()
|
||||
.stream()
|
||||
.filter(AbilityCounter.class::isInstance)
|
||||
.map(AbilityCounter.class::cast)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue