mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[SNC] removed unnnecessary ConniveTargetEffect class
This commit is contained in:
parent
cf885a3312
commit
a27a59355b
2 changed files with 43 additions and 72 deletions
|
|
@ -4,9 +4,9 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.AttackingCreatureCount;
|
||||
import mage.abilities.effects.keyword.ConniveTargetEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.keyword.ConniveSourceEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
|
@ -14,8 +14,12 @@ import mage.abilities.keyword.WardAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetAttackingCreature;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -25,8 +29,9 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class RaffineSchemingSeer extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue = new AttackingCreatureCount("attacking creatures");
|
||||
private static final Hint hint = new ValueHint("Attacking creatures", xValue);
|
||||
private static final Hint hint = new ValueHint(
|
||||
"Attacking creatures", new AttackingCreatureCount("attacking creatures")
|
||||
);
|
||||
|
||||
public RaffineSchemingSeer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}");
|
||||
|
|
@ -44,9 +49,9 @@ public final class RaffineSchemingSeer extends CardImpl {
|
|||
this.addAbility(new WardAbility(new ManaCostsImpl<>("{1}")));
|
||||
|
||||
// Whenever you attack, target creature connives X, where X is the number of attacking creatures.
|
||||
Ability ability = new AttacksWithCreaturesTriggeredAbility(new ConniveTargetEffect(xValue), 1);
|
||||
Ability ability = new AttacksWithCreaturesTriggeredAbility(new RaffineSchemingSeerEffect(), 1);
|
||||
ability.addTarget(new TargetAttackingCreature());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(ability.addHint(hint));
|
||||
}
|
||||
|
||||
private RaffineSchemingSeer(final RaffineSchemingSeer card) {
|
||||
|
|
@ -58,3 +63,35 @@ public final class RaffineSchemingSeer extends CardImpl {
|
|||
return new RaffineSchemingSeer(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RaffineSchemingSeerEffect extends OneShotEffect {
|
||||
|
||||
RaffineSchemingSeerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "target creature connives X, where X is the number of attacking creatures. " +
|
||||
"<i>(Draw X cards, then discard X cards. Put a +1/+1 counter on that creature " +
|
||||
"for each nonland card discarded this way.)</i>";
|
||||
}
|
||||
|
||||
private RaffineSchemingSeerEffect(final RaffineSchemingSeerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaffineSchemingSeerEffect copy() {
|
||||
return new RaffineSchemingSeerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
int amount = game.getBattlefield().count(
|
||||
StaticFilters.FILTER_ATTACKING_CREATURES,
|
||||
source.getControllerId(), source, game
|
||||
);
|
||||
return ConniveSourceEffect.connive(permanent, amount, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ConniveTargetEffect extends OneShotEffect {
|
||||
|
||||
private final DynamicValue xValue;
|
||||
|
||||
public ConniveTargetEffect(int amount) {
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public ConniveTargetEffect(DynamicValue xValue) {
|
||||
super(Outcome.Benefit);
|
||||
this.xValue = xValue;
|
||||
}
|
||||
|
||||
private ConniveTargetEffect(final ConniveTargetEffect effect) {
|
||||
super(effect);
|
||||
this.xValue = effect.xValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConniveTargetEffect copy() {
|
||||
return new ConniveTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
int amount = xValue.calculate(game, source, this);
|
||||
return amount > 0 && ConniveSourceEffect.connive(permanent, amount, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("target creature connives ");
|
||||
sb.append(xValue);
|
||||
if (!(xValue instanceof StaticValue)) {
|
||||
sb.append(", where X is ");
|
||||
sb.append(xValue.getMessage());
|
||||
}
|
||||
sb.append(" <i>(Draw ");
|
||||
sb.append(xValue);
|
||||
sb.append(" cards, then discard ");
|
||||
sb.append(xValue);
|
||||
sb.append(" cards. Put a +1/+1 counter on that creature for each nonland card discarded this way.)</i>");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue