mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00: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.power = 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));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -5,21 +5,39 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
||||
|
||||
TargetController mustAttacks;
|
||||
|
||||
public AttacksIfAbleTargetEffect(Duration duration) {
|
||||
this(duration, TargetController.ANY);
|
||||
}
|
||||
|
||||
public AttacksIfAbleTargetEffect(Duration duration, TargetController mustAttacks) {
|
||||
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) {
|
||||
super(effect);
|
||||
this.mustAttacks = effect.mustAttacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,6 +55,17 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID mustAttackDefender(Ability source, Game game) {
|
||||
switch (this.mustAttacks) {
|
||||
case YOU:
|
||||
return source.getControllerId();
|
||||
case ANY:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustBlock(Game game) {
|
||||
return false;
|
||||
|
@ -47,11 +76,23 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (this.duration == Duration.EndOfTurn) {
|
||||
return "target " + mode.getTargets().get(0).getTargetName() + " attacks this turn if able";
|
||||
} else {
|
||||
return "target " + mode.getTargets().get(0).getTargetName() + " attacks each combat if able";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("target ");
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
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…
Reference in a new issue