mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 06:52:02 -08:00
Remove explicit set of required property in constructor
This commit is contained in:
parent
250909a464
commit
0a0983d7e9
2272 changed files with 2454 additions and 2538 deletions
|
|
@ -148,14 +148,16 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
// If there is more than one other player who could make such a choice, the spell or ability’s controller decides which of those players will make the choice.
|
||||
UUID playerId = null;
|
||||
if (modeChooser == TargetController.OPPONENT) {
|
||||
TargetOpponent targetOpponent = new TargetOpponent(true);
|
||||
TargetOpponent targetOpponent = new TargetOpponent();
|
||||
if (targetOpponent.choose(Outcome.Benefit, source.getControllerId(), source.getSourceId(), game)) {
|
||||
playerId = targetOpponent.getFirstTarget();
|
||||
}
|
||||
}
|
||||
if (playerId == null ) {
|
||||
} else {
|
||||
playerId = source.getControllerId();
|
||||
}
|
||||
if (playerId == null) {
|
||||
return false;
|
||||
}
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
||||
// player chooses modes manually
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class CipherEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(true);
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||
if (controller != null) {
|
||||
if (target.canChoose(source.getControllerId(), game)
|
||||
&& controller.chooseUse(outcome, "Cipher this spell to a creature?", game)) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
|
|||
public class EquipAbility extends ActivatedAbilityImpl {
|
||||
|
||||
public EquipAbility(Outcome outcome, Cost cost) {
|
||||
this(outcome, cost, new TargetControlledCreaturePermanent(true));
|
||||
this(outcome, cost, new TargetControlledCreaturePermanent());
|
||||
}
|
||||
|
||||
public EquipAbility(Outcome outcome, Cost cost, Target target) {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class HauntExileAbility extends ZoneChangeTriggeredAbility {
|
|||
public HauntExileAbility() {
|
||||
super(Zone.BATTLEFIELD, Zone.GRAVEYARD, new HauntEffect(), null, false);
|
||||
this.setRuleAtTheTop(true);
|
||||
this.addTarget(new TargetCreaturePermanent(true));
|
||||
this.addTarget(new TargetCreaturePermanent());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class ScavengeAbility extends ActivatedAbilityImpl {
|
|||
super(Zone.GRAVEYARD, new ScavengeEffect(), costs);
|
||||
this.timing = TimingRule.SORCERY;
|
||||
this.addCost(new ExileSourceFromGraveCost());
|
||||
this.addTarget(new TargetCreaturePermanent(true));
|
||||
this.addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
public ScavengeAbility(final ScavengeAbility ability) {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class TributeEffect extends OneShotEffect {
|
|||
if (game.getOpponents(controller.getId()).size() == 1) {
|
||||
opponentId = game.getOpponents(controller.getId()).iterator().next();
|
||||
} else {
|
||||
Target target = new TargetOpponent(true);
|
||||
Target target = new TargetOpponent();
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
opponentId = target.getFirstTarget();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,21 +50,11 @@ public class TargetPermanent extends TargetObject {
|
|||
public TargetPermanent() {
|
||||
this(1, 1, new FilterPermanent(), false);
|
||||
}
|
||||
|
||||
public TargetPermanent(boolean required) {
|
||||
this(1, 1, new FilterPermanent(), false);
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetPermanent(FilterPermanent filter) {
|
||||
this(1, 1, filter, false);
|
||||
}
|
||||
|
||||
public TargetPermanent(FilterPermanent filter, boolean required) {
|
||||
this(1, 1, filter, false);
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
public TargetPermanent(int numTargets, FilterPermanent filter) {
|
||||
this(numTargets, numTargets, filter, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@ public class TargetPlayer extends TargetImpl {
|
|||
|
||||
protected FilterPlayer filter;
|
||||
|
||||
public TargetPlayer(boolean required) {
|
||||
this();
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
public TargetPlayer() {
|
||||
this(1, 1, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,7 @@ import mage.target.TargetPermanent;
|
|||
* @author ayratn
|
||||
*/
|
||||
public class TargetArtifactPermanent extends TargetPermanent {
|
||||
|
||||
public TargetArtifactPermanent(boolean required) {
|
||||
this();
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetArtifactPermanent() {
|
||||
this(1, 1, new FilterArtifactPermanent(), false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,11 +40,6 @@ public class TargetAttackingCreature extends TargetPermanent {
|
|||
public TargetAttackingCreature() {
|
||||
this(1, 1, new FilterAttackingCreature(), false);
|
||||
}
|
||||
|
||||
public TargetAttackingCreature(boolean required) {
|
||||
this(1, 1, new FilterAttackingCreature(), false);
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetAttackingCreature(int numTargets) {
|
||||
this(numTargets, numTargets, new FilterAttackingCreature(), false);
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@ public class TargetCardInGraveyard extends TargetCard {
|
|||
this(1, 1, new FilterCard("card from a graveyard"));
|
||||
}
|
||||
|
||||
public TargetCardInGraveyard(boolean required) {
|
||||
this();
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCardInGraveyard(FilterCard filter) {
|
||||
this(1, 1, filter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,16 +46,6 @@ public class TargetCardInYourGraveyard extends TargetCard {
|
|||
this(1, 1, new FilterCard("card from your graveyard"));
|
||||
}
|
||||
|
||||
public TargetCardInYourGraveyard(boolean required) {
|
||||
this();
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCardInYourGraveyard(FilterCard filter, boolean required) {
|
||||
this(filter);
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCardInYourGraveyard(FilterCard filter) {
|
||||
this(1, 1, filter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,11 +40,6 @@ public class TargetControlledCreaturePermanent extends TargetControlledPermanent
|
|||
this(1, 1, new FilterControlledCreaturePermanent(), false);
|
||||
}
|
||||
|
||||
public TargetControlledCreaturePermanent(boolean required) {
|
||||
this(1, 1, new FilterControlledCreaturePermanent(), false);
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
public TargetControlledCreaturePermanent(int numTargets) {
|
||||
this(numTargets, numTargets, new FilterControlledCreaturePermanent(), false);
|
||||
}
|
||||
|
|
@ -54,11 +49,6 @@ public class TargetControlledCreaturePermanent extends TargetControlledPermanent
|
|||
this.targetName = filter.getMessage();
|
||||
}
|
||||
|
||||
public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets, FilterControlledCreaturePermanent filter, boolean notTarget, boolean required) {
|
||||
this(minNumTargets, maxNumTargets, filter, notTarget);
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
public TargetControlledCreaturePermanent(final TargetControlledCreaturePermanent target) {
|
||||
super(target);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@ public class TargetControlledPermanent extends TargetPermanent {
|
|||
this(1, 1, new FilterControlledPermanent(), false);
|
||||
}
|
||||
|
||||
public TargetControlledPermanent(boolean required) {
|
||||
this(1, 1, new FilterControlledPermanent(), false);
|
||||
this.setRequired(true);
|
||||
}
|
||||
|
||||
public TargetControlledPermanent(int numTargets) {
|
||||
this(numTargets, numTargets, new FilterControlledPermanent(), false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,11 +51,6 @@ public class TargetCreatureOrPlayer extends TargetImpl {
|
|||
|
||||
protected FilterCreatureOrPlayer filter;
|
||||
|
||||
public TargetCreatureOrPlayer(boolean required) {
|
||||
this();
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCreatureOrPlayer() {
|
||||
this(1, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,29 +41,14 @@ public class TargetCreaturePermanent extends TargetPermanent {
|
|||
this(1, 1, new FilterCreaturePermanent(), false);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanent(boolean required) {
|
||||
this();
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanent(FilterCreaturePermanent filter) {
|
||||
this(1, 1, filter, false);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanent(FilterCreaturePermanent filter, boolean required) {
|
||||
this(1, 1, filter, false);
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanent(int numTargets) {
|
||||
this(numTargets, numTargets, new FilterCreaturePermanent(), false);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanent(int numTargets, boolean required) {
|
||||
this(numTargets);
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets) {
|
||||
this(minNumTargets, maxNumTargets, new FilterCreaturePermanent(), false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ import mage.target.TargetPermanent;
|
|||
* @author LevelX2
|
||||
*/
|
||||
public class TargetEnchantmentPermanent extends TargetPermanent {
|
||||
|
||||
public TargetEnchantmentPermanent(boolean required) {
|
||||
this();
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetEnchantmentPermanent() {
|
||||
this(1, 1, new FilterEnchantmentPermanent(), false);
|
||||
|
|
|
|||
|
|
@ -45,17 +45,10 @@ public class TargetOpponent extends TargetPlayer {
|
|||
public TargetOpponent() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public TargetOpponent(boolean required) {
|
||||
super(1, 1, false, new FilterPlayer("opponent"));
|
||||
this.filter.add(new PlayerPredicate(TargetController.OPPONENT));
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
public TargetOpponent(boolean required, boolean notTarget) {
|
||||
public TargetOpponent(boolean notTarget) {
|
||||
super(1, 1, false, new FilterPlayer("opponent"));
|
||||
this.filter.add(new PlayerPredicate(TargetController.OPPONENT));
|
||||
setRequired(required);
|
||||
setNotTarget(notTarget);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue