mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09:00
This commit is contained in:
parent
0fa82ad368
commit
930d18a77d
2 changed files with 50 additions and 7 deletions
|
@ -26,7 +26,9 @@ public final class AlluringSiren extends CardImpl {
|
||||||
this.subtype.add(SubType.SIREN);
|
this.subtype.add(SubType.SIREN);
|
||||||
this.power = new MageInt(1);
|
this.power = new MageInt(1);
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AttacksIfAbleTargetEffect(Duration.EndOfTurn), new TapSourceCost());
|
|
||||||
|
// {T}: Target creature an opponent controls attacks you this turn if able.
|
||||||
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AttacksIfAbleTargetEffect(Duration.EndOfTurn, TargetController.YOU), new TapSourceCost());
|
||||||
ability.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
|
ability.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,21 +5,39 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.RequirementEffect;
|
import mage.abilities.effects.RequirementEffect;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.TargetController;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
||||||
|
|
||||||
|
TargetController mustAttacks;
|
||||||
|
|
||||||
public AttacksIfAbleTargetEffect(Duration duration) {
|
public AttacksIfAbleTargetEffect(Duration duration) {
|
||||||
|
this(duration, TargetController.ANY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AttacksIfAbleTargetEffect(Duration duration, TargetController mustAttacks) {
|
||||||
super(duration);
|
super(duration);
|
||||||
|
this.mustAttacks = mustAttacks;
|
||||||
|
|
||||||
|
if (!EnumSet.of(
|
||||||
|
TargetController.YOU,
|
||||||
|
TargetController.ANY
|
||||||
|
).contains(this.mustAttacks)) {
|
||||||
|
throw new IllegalArgumentException("Unsupported type in mustAttacks");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttacksIfAbleTargetEffect(final AttacksIfAbleTargetEffect effect) {
|
public AttacksIfAbleTargetEffect(final AttacksIfAbleTargetEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.mustAttacks = effect.mustAttacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,6 +55,17 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID mustAttackDefender(Ability source, Game game) {
|
||||||
|
switch (this.mustAttacks) {
|
||||||
|
case YOU:
|
||||||
|
return source.getControllerId();
|
||||||
|
case ANY:
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mustBlock(Game game) {
|
public boolean mustBlock(Game game) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -47,11 +76,23 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
||||||
if (staticText != null && !staticText.isEmpty()) {
|
if (staticText != null && !staticText.isEmpty()) {
|
||||||
return staticText;
|
return staticText;
|
||||||
}
|
}
|
||||||
if (this.duration == Duration.EndOfTurn) {
|
StringBuilder sb = new StringBuilder();
|
||||||
return "target " + mode.getTargets().get(0).getTargetName() + " attacks this turn if able";
|
sb.append("target ");
|
||||||
} else {
|
sb.append(mode.getTargets().get(0).getTargetName());
|
||||||
return "target " + mode.getTargets().get(0).getTargetName() + " attacks each combat if able";
|
switch (this.mustAttacks) {
|
||||||
|
case YOU:
|
||||||
|
sb.append(" attacks you");
|
||||||
|
break;
|
||||||
|
case ANY:
|
||||||
|
default:
|
||||||
|
sb.append(" attacks");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (this.duration == Duration.EndOfTurn) {
|
||||||
|
sb.append(" this turn if able");
|
||||||
|
} else {
|
||||||
|
sb.append(" each combat if able");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue