Update *.sh and *.java files to use Unix line endings

This commit is contained in:
arcox 2020-07-09 13:07:26 -04:00
parent a6d03c925f
commit 9c7982e8f6
273 changed files with 26704 additions and 26704 deletions

View file

@ -1,113 +1,113 @@
package mage.target.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetCard;
import java.util.Set;
import java.util.UUID;
/**
* @author LevelX2
*/
public class TargetCardInGraveyardOrBattlefield extends TargetCard {
protected final FilterPermanent filterBattlefield;
public TargetCardInGraveyardOrBattlefield(int minNumTargets, int maxNumTargets, FilterCard filterGraveyard, FilterPermanent filterBattlefield) {
super(minNumTargets, maxNumTargets, Zone.GRAVEYARD, filterGraveyard); // zone for card in graveyard, don't change
this.filterBattlefield = filterBattlefield;
this.targetName = filter.getMessage()
+ " in a graveyard "
+ (maxNumTargets > 1 ? " and/or " : " or ")
+ this.filterBattlefield.getMessage()
+ " on the battlefield";
}
public TargetCardInGraveyardOrBattlefield(final TargetCardInGraveyardOrBattlefield target) {
super(target);
this.filterBattlefield = target.filterBattlefield;
}
@Override
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
if (!super.canChoose(sourceId, sourceControllerId, game)) {
MageObject targetSource = game.getObject(sourceId);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterBattlefield, sourceControllerId, game)) {
if ((notTarget || permanent.canBeTargetedBy(targetSource, sourceControllerId, game))
&& filterBattlefield.match(permanent, sourceId, sourceControllerId, game)) {
return true;
}
}
return false;
}
return true;
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
if (!super.canTarget(id, source, game)) { // in graveyard first
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
return filterBattlefield.match(permanent, game);
}
}
return true;
}
@Override
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
if (!super.canTarget(playerId, id, source, game)) { // in graveyard first
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
return filterBattlefield.match(permanent, source != null ? source.getSourceId() : null, playerId, game);
}
}
return true;
}
@Override
public boolean canTarget(UUID id, Game game) {
if (!super.canTarget(id, game)) { // in graveyard first
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
return filterBattlefield.match(permanent, game);
}
}
return true;
}
@Override
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = super.possibleTargets(sourceControllerId, game); // in graveyard first
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterBattlefield, sourceControllerId, game)) {
if (filterBattlefield.match(permanent, null, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
}
return possibleTargets;
}
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); // in graveyard first
MageObject targetSource = game.getObject(sourceId);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterBattlefield, sourceControllerId, sourceId, game)) {
if ((notTarget || permanent.canBeTargetedBy(targetSource, sourceControllerId, game)) && filterBattlefield.match(permanent, sourceId, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
}
return possibleTargets;
}
@Override
public TargetCardInGraveyardOrBattlefield copy() {
return new TargetCardInGraveyardOrBattlefield(this);
}
}
package mage.target.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetCard;
import java.util.Set;
import java.util.UUID;
/**
* @author LevelX2
*/
public class TargetCardInGraveyardOrBattlefield extends TargetCard {
protected final FilterPermanent filterBattlefield;
public TargetCardInGraveyardOrBattlefield(int minNumTargets, int maxNumTargets, FilterCard filterGraveyard, FilterPermanent filterBattlefield) {
super(minNumTargets, maxNumTargets, Zone.GRAVEYARD, filterGraveyard); // zone for card in graveyard, don't change
this.filterBattlefield = filterBattlefield;
this.targetName = filter.getMessage()
+ " in a graveyard "
+ (maxNumTargets > 1 ? " and/or " : " or ")
+ this.filterBattlefield.getMessage()
+ " on the battlefield";
}
public TargetCardInGraveyardOrBattlefield(final TargetCardInGraveyardOrBattlefield target) {
super(target);
this.filterBattlefield = target.filterBattlefield;
}
@Override
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
if (!super.canChoose(sourceId, sourceControllerId, game)) {
MageObject targetSource = game.getObject(sourceId);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterBattlefield, sourceControllerId, game)) {
if ((notTarget || permanent.canBeTargetedBy(targetSource, sourceControllerId, game))
&& filterBattlefield.match(permanent, sourceId, sourceControllerId, game)) {
return true;
}
}
return false;
}
return true;
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
if (!super.canTarget(id, source, game)) { // in graveyard first
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
return filterBattlefield.match(permanent, game);
}
}
return true;
}
@Override
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
if (!super.canTarget(playerId, id, source, game)) { // in graveyard first
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
return filterBattlefield.match(permanent, source != null ? source.getSourceId() : null, playerId, game);
}
}
return true;
}
@Override
public boolean canTarget(UUID id, Game game) {
if (!super.canTarget(id, game)) { // in graveyard first
Permanent permanent = game.getPermanent(id);
if (permanent != null) {
return filterBattlefield.match(permanent, game);
}
}
return true;
}
@Override
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = super.possibleTargets(sourceControllerId, game); // in graveyard first
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterBattlefield, sourceControllerId, game)) {
if (filterBattlefield.match(permanent, null, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
}
return possibleTargets;
}
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); // in graveyard first
MageObject targetSource = game.getObject(sourceId);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterBattlefield, sourceControllerId, sourceId, game)) {
if ((notTarget || permanent.canBeTargetedBy(targetSource, sourceControllerId, game)) && filterBattlefield.match(permanent, sourceId, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
}
return possibleTargets;
}
@Override
public TargetCardInGraveyardOrBattlefield copy() {
return new TargetCardInGraveyardOrBattlefield(this);
}
}

View file

@ -1,50 +1,50 @@
package mage.target.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class TargetCreaturePermanentSameController extends TargetCreaturePermanent {
public TargetCreaturePermanentSameController(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
}
public TargetCreaturePermanentSameController(final TargetCreaturePermanentSameController target) {
super(target);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (super.canTarget(controllerId, id, source, game)) {
Permanent firstTargetPermanent = game.getPermanent(id);
if (firstTargetPermanent != null) {
for (Object object : getTargets()) {
UUID targetId = (UUID) object;
Permanent targetPermanent = game.getPermanent(targetId);
if (targetPermanent != null) {
if (!firstTargetPermanent.getId().equals(targetPermanent.getId())) {
if (!firstTargetPermanent.isControlledBy(targetPermanent.getOwnerId())) {
return false;
}
}
}
}
return true;
}
}
return false;
}
@Override
public TargetCreaturePermanentSameController copy() {
return new TargetCreaturePermanentSameController(this);
}
}
package mage.target.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class TargetCreaturePermanentSameController extends TargetCreaturePermanent {
public TargetCreaturePermanentSameController(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
}
public TargetCreaturePermanentSameController(final TargetCreaturePermanentSameController target) {
super(target);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (super.canTarget(controllerId, id, source, game)) {
Permanent firstTargetPermanent = game.getPermanent(id);
if (firstTargetPermanent != null) {
for (Object object : getTargets()) {
UUID targetId = (UUID) object;
Permanent targetPermanent = game.getPermanent(targetId);
if (targetPermanent != null) {
if (!firstTargetPermanent.getId().equals(targetPermanent.getId())) {
if (!firstTargetPermanent.isControlledBy(targetPermanent.getOwnerId())) {
return false;
}
}
}
}
return true;
}
}
return false;
}
@Override
public TargetCreaturePermanentSameController copy() {
return new TargetCreaturePermanentSameController(this);
}
}

View file

@ -1,50 +1,50 @@
package mage.target.common;
import mage.abilities.Ability;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class TargetCreaturePermanentWithDifferentTypes extends TargetCreaturePermanent {
public TargetCreaturePermanentWithDifferentTypes(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
}
public TargetCreaturePermanentWithDifferentTypes(final TargetCreaturePermanentWithDifferentTypes target) {
super(target);
}
@Override
public TargetCreaturePermanentWithDifferentTypes copy() {
return new TargetCreaturePermanentWithDifferentTypes(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (super.canTarget(controllerId, id, source, game)) {
Permanent creature = game.getPermanent(id);
if (creature != null) {
for (Object object : getTargets()) {
UUID targetId = (UUID) object;
Permanent selectedCreature = game.getPermanent(targetId);
if (selectedCreature != null
&& !creature.getId().equals(selectedCreature.getId())) {
if (creature.shareSubtypes(selectedCreature, game)) {
return false;
}
}
}
return true;
}
}
return false;
}
}
package mage.target.common;
import mage.abilities.Ability;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class TargetCreaturePermanentWithDifferentTypes extends TargetCreaturePermanent {
public TargetCreaturePermanentWithDifferentTypes(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
}
public TargetCreaturePermanentWithDifferentTypes(final TargetCreaturePermanentWithDifferentTypes target) {
super(target);
}
@Override
public TargetCreaturePermanentWithDifferentTypes copy() {
return new TargetCreaturePermanentWithDifferentTypes(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (super.canTarget(controllerId, id, source, game)) {
Permanent creature = game.getPermanent(id);
if (creature != null) {
for (Object object : getTargets()) {
UUID targetId = (UUID) object;
Permanent selectedCreature = game.getPermanent(targetId);
if (selectedCreature != null
&& !creature.getId().equals(selectedCreature.getId())) {
if (creature.shareSubtypes(selectedCreature, game)) {
return false;
}
}
}
return true;
}
}
return false;
}
}

View file

@ -1,45 +1,45 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.target.common;
import mage.filter.common.FilterOpponentsCreaturePermanent;
/**
*
* @author Styxo
*/
public class TargetOpponentsCreaturePermanent extends TargetCreaturePermanent {
public TargetOpponentsCreaturePermanent() {
this(1, 1, new FilterOpponentsCreaturePermanent(), false);
}
public TargetOpponentsCreaturePermanent(int numTargets) {
this(numTargets, numTargets, new FilterOpponentsCreaturePermanent(), false);
}
public TargetOpponentsCreaturePermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, new FilterOpponentsCreaturePermanent(), false);
}
public TargetOpponentsCreaturePermanent(FilterOpponentsCreaturePermanent filter) {
super(1, 1, filter, false);
}
public TargetOpponentsCreaturePermanent(int minNumTargets, int maxNumTargets, FilterOpponentsCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage();
}
public TargetOpponentsCreaturePermanent(final TargetOpponentsCreaturePermanent target) {
super(target);
}
@Override
public TargetOpponentsCreaturePermanent copy() {
return new TargetOpponentsCreaturePermanent(this);
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.target.common;
import mage.filter.common.FilterOpponentsCreaturePermanent;
/**
*
* @author Styxo
*/
public class TargetOpponentsCreaturePermanent extends TargetCreaturePermanent {
public TargetOpponentsCreaturePermanent() {
this(1, 1, new FilterOpponentsCreaturePermanent(), false);
}
public TargetOpponentsCreaturePermanent(int numTargets) {
this(numTargets, numTargets, new FilterOpponentsCreaturePermanent(), false);
}
public TargetOpponentsCreaturePermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, new FilterOpponentsCreaturePermanent(), false);
}
public TargetOpponentsCreaturePermanent(FilterOpponentsCreaturePermanent filter) {
super(1, 1, filter, false);
}
public TargetOpponentsCreaturePermanent(int minNumTargets, int maxNumTargets, FilterOpponentsCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage();
}
public TargetOpponentsCreaturePermanent(final TargetOpponentsCreaturePermanent target) {
super(target);
}
@Override
public TargetOpponentsCreaturePermanent copy() {
return new TargetOpponentsCreaturePermanent(this);
}
}

View file

@ -1,98 +1,98 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.target.targetpointer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.game.Game;
/**
*
* @author Ludwig.Hirth
*/
public class ThirdTargetPointer implements TargetPointer {
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
public static ThirdTargetPointer getInstance() {
return new ThirdTargetPointer();
}
public ThirdTargetPointer() {
}
public ThirdTargetPointer(ThirdTargetPointer targetPointer) {
this.zoneChangeCounter = new HashMap<>();
for (Map.Entry<UUID, Integer> entry : targetPointer.zoneChangeCounter.entrySet()) {
this.zoneChangeCounter.put(entry.getKey(), entry.getValue());
}
}
@Override
public void init(Game game, Ability source) {
if (source.getTargets().size() > 2) {
for (UUID target : source.getTargets().get(2).getTargets()) {
Card card = game.getCard(target);
if (card != null) {
this.zoneChangeCounter.put(target, card.getZoneChangeCounter(game));
}
}
}
}
@Override
public List<UUID> getTargets(Game game, Ability source) {
List<UUID> target = new ArrayList<>();
if (source.getTargets().size() > 2) {
for (UUID targetId : source.getTargets().get(2).getTargets()) {
Card card = game.getCard(targetId);
if (card != null && zoneChangeCounter.containsKey(targetId)
&& card.getZoneChangeCounter(game) != zoneChangeCounter.get(targetId)) {
continue;
}
target.add(targetId);
}
}
return target;
}
@Override
public UUID getFirst(Game game, Ability source) {
if (source.getTargets().size() > 2) {
UUID targetId = source.getTargets().get(2).getFirstTarget();
if (zoneChangeCounter.containsKey(targetId)) {
Card card = game.getCard(targetId);
if (card != null && zoneChangeCounter.containsKey(targetId)
&& card.getZoneChangeCounter(game) != zoneChangeCounter.get(targetId)) {
return null;
}
}
return targetId;
}
return null;
}
@Override
public TargetPointer copy() {
return new ThirdTargetPointer(this);
}
@Override
public FixedTarget getFixedTarget(Game game, Ability source) {
this.init(game, source);
UUID firstId = getFirst(game, source);
if (firstId != null) {
return new FixedTarget(firstId, game.getState().getZoneChangeCounter(firstId));
}
return null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.target.targetpointer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.game.Game;
/**
*
* @author Ludwig.Hirth
*/
public class ThirdTargetPointer implements TargetPointer {
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
public static ThirdTargetPointer getInstance() {
return new ThirdTargetPointer();
}
public ThirdTargetPointer() {
}
public ThirdTargetPointer(ThirdTargetPointer targetPointer) {
this.zoneChangeCounter = new HashMap<>();
for (Map.Entry<UUID, Integer> entry : targetPointer.zoneChangeCounter.entrySet()) {
this.zoneChangeCounter.put(entry.getKey(), entry.getValue());
}
}
@Override
public void init(Game game, Ability source) {
if (source.getTargets().size() > 2) {
for (UUID target : source.getTargets().get(2).getTargets()) {
Card card = game.getCard(target);
if (card != null) {
this.zoneChangeCounter.put(target, card.getZoneChangeCounter(game));
}
}
}
}
@Override
public List<UUID> getTargets(Game game, Ability source) {
List<UUID> target = new ArrayList<>();
if (source.getTargets().size() > 2) {
for (UUID targetId : source.getTargets().get(2).getTargets()) {
Card card = game.getCard(targetId);
if (card != null && zoneChangeCounter.containsKey(targetId)
&& card.getZoneChangeCounter(game) != zoneChangeCounter.get(targetId)) {
continue;
}
target.add(targetId);
}
}
return target;
}
@Override
public UUID getFirst(Game game, Ability source) {
if (source.getTargets().size() > 2) {
UUID targetId = source.getTargets().get(2).getFirstTarget();
if (zoneChangeCounter.containsKey(targetId)) {
Card card = game.getCard(targetId);
if (card != null && zoneChangeCounter.containsKey(targetId)
&& card.getZoneChangeCounter(game) != zoneChangeCounter.get(targetId)) {
return null;
}
}
return targetId;
}
return null;
}
@Override
public TargetPointer copy() {
return new ThirdTargetPointer(this);
}
@Override
public FixedTarget getFixedTarget(Game game, Ability source) {
this.init(game, source);
UUID firstId = getFirst(game, source);
if (firstId != null) {
return new FixedTarget(firstId, game.getState().getZoneChangeCounter(firstId));
}
return null;
}
}