mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[LEA] reworked Aspect of Wolf, fixed text (fixes #8064)
This commit is contained in:
parent
65109a22b3
commit
b53c3a3004
1 changed files with 28 additions and 49 deletions
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
|
@ -11,24 +9,27 @@ import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
|||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author KholdFuzion
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author KholdFuzion
|
||||
*/
|
||||
public final class AspectOfWolf extends CardImpl {
|
||||
|
||||
public AspectOfWolf(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
|
@ -36,7 +37,10 @@ public final class AspectOfWolf extends CardImpl {
|
|||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
// Enchanted creature gets +X/+Y, where X is half the number of Forests you control, rounded down, and Y is half the number of Forests you control, rounded up.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(new HalfForestsDownCount(), new HalfForestsUpCount(), Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(
|
||||
AspectOfWolfValue.UP, AspectOfWolfValue.DOWN, Duration.WhileOnBattlefield
|
||||
).setText("enchanted creature gets +X/+Y, where X is half the number of Forests you control, " +
|
||||
"rounded down, and Y is half the number of Forests you control, rounded up")));
|
||||
}
|
||||
|
||||
private AspectOfWolf(final AspectOfWolf card) {
|
||||
|
@ -49,61 +53,36 @@ public final class AspectOfWolf extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class HalfForestsDownCount implements DynamicValue {
|
||||
enum AspectOfWolfValue implements DynamicValue {
|
||||
UP(true), DOWN(false);
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent();
|
||||
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.FOREST);
|
||||
private final boolean up;
|
||||
|
||||
static {
|
||||
filter.add(SubType.FOREST.getPredicate());
|
||||
AspectOfWolfValue(boolean up) {
|
||||
this.up = up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2;
|
||||
int forestCount = game.getBattlefield().count(
|
||||
filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game
|
||||
);
|
||||
return forestCount / 2 + (up ? forestCount % 2 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HalfForestsDownCount copy() {
|
||||
return new HalfForestsDownCount();
|
||||
public AspectOfWolfValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
return up ? "X" : "Y";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "half the number of Forests you control, rounded down";
|
||||
}
|
||||
}
|
||||
|
||||
class HalfForestsUpCount implements DynamicValue {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent();
|
||||
|
||||
static {
|
||||
filter.add(SubType.FOREST.getPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = (int) Math.ceil(game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2f);
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HalfForestsUpCount copy() {
|
||||
return new HalfForestsUpCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Y";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "half the number of Forests you control, rounded up";
|
||||
return "half the number of Forests you control, rounded " + (up ? "up" : "down");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue