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;
|
package mage.cards.a;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
@ -11,24 +9,27 @@ import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.CardType;
|
||||||
import mage.filter.common.FilterLandPermanent;
|
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.game.Game;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
/**
|
import java.util.UUID;
|
||||||
*
|
|
||||||
* @author KholdFuzion
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author KholdFuzion
|
||||||
*/
|
*/
|
||||||
public final class AspectOfWolf extends CardImpl {
|
public final class AspectOfWolf extends CardImpl {
|
||||||
|
|
||||||
public AspectOfWolf(UUID ownerId, CardSetInfo setInfo) {
|
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);
|
this.subtype.add(SubType.AURA);
|
||||||
|
|
||||||
|
|
||||||
// Enchant creature
|
// Enchant creature
|
||||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||||
this.getSpellAbility().addTarget(auraTarget);
|
this.getSpellAbility().addTarget(auraTarget);
|
||||||
|
@ -36,7 +37,10 @@ public final class AspectOfWolf extends CardImpl {
|
||||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||||
this.addAbility(ability);
|
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.
|
// 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) {
|
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 {
|
AspectOfWolfValue(boolean up) {
|
||||||
filter.add(SubType.FOREST.getPredicate());
|
this.up = up;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
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
|
@Override
|
||||||
public HalfForestsDownCount copy() {
|
public AspectOfWolfValue copy() {
|
||||||
return new HalfForestsDownCount();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "X";
|
return up ? "X" : "Y";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return "half the number of Forests you control, rounded down";
|
return "half the number of Forests you control, rounded " + (up ? "up" : "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";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue