various files converted from CRLF to LF

This commit is contained in:
Evan Kranzler 2021-09-23 19:37:47 -04:00
parent ea561892f5
commit 3a3e3fda48
36 changed files with 8696 additions and 8696 deletions

View file

@ -1,28 +1,28 @@
package mage;
import mage.abilities.Ability;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class ApprovingObject {
private final Ability approvingAbility;
private final MageObjectReference approvingMageObjectReference;
public ApprovingObject(Ability source, Game game) {
this.approvingAbility = source;
this.approvingMageObjectReference = new MageObjectReference(source.getSourceId(), game);
}
public Ability getApprovingAbility() {
return approvingAbility;
}
public MageObjectReference getApprovingMageObjectReference() {
return approvingMageObjectReference;
}
}
package mage;
import mage.abilities.Ability;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class ApprovingObject {
private final Ability approvingAbility;
private final MageObjectReference approvingMageObjectReference;
public ApprovingObject(Ability source, Game game) {
this.approvingAbility = source;
this.approvingMageObjectReference = new MageObjectReference(source.getSourceId(), game);
}
public Ability getApprovingAbility() {
return approvingAbility;
}
public MageObjectReference getApprovingMageObjectReference() {
return approvingMageObjectReference;
}
}

View file

@ -1,124 +1,124 @@
/*
* 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.abilities.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import static mage.game.events.GameEvent.EventType.END_COMBAT_STEP_POST;
import static mage.game.events.GameEvent.EventType.REMOVED_FROM_COMBAT;
import static mage.game.events.GameEvent.EventType.ZONE_CHANGE;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
*
* @author weirddan455 and jeffwadsworth
*/
public class AttackingCreaturePutIntoGraveyardTriggeredAbility extends TriggeredAbilityImpl {
protected FilterPermanent filterPermanent;
private final boolean onlyToControllerGraveyard;
private final boolean itDies;
public AttackingCreaturePutIntoGraveyardTriggeredAbility(Effect effect, FilterPermanent filterPermanent, Boolean onlyToControllerGraveyard, Boolean itDies, Boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
this.filterPermanent = filterPermanent;
this.onlyToControllerGraveyard = onlyToControllerGraveyard;
this.itDies = itDies;
}
private AttackingCreaturePutIntoGraveyardTriggeredAbility(final AttackingCreaturePutIntoGraveyardTriggeredAbility ability) {
super(ability);
this.filterPermanent = ability.filterPermanent;
this.onlyToControllerGraveyard = ability.onlyToControllerGraveyard;
this.itDies = ability.itDies;
}
@Override
public AttackingCreaturePutIntoGraveyardTriggeredAbility copy() {
return new AttackingCreaturePutIntoGraveyardTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
switch (event.getType()) {
case ATTACKER_DECLARED:
case END_COMBAT_STEP_POST:
case ZONE_CHANGE:
case REMOVED_FROM_COMBAT:
return true;
default:
return false;
}
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
switch (event.getType()) {
case ATTACKER_DECLARED:
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null
&& !filterPermanent.match(permanent, game)) {
return false;
}
List<UUID> attackersList = new ArrayList<>();
List<UUID> attackersListCopy = (List<UUID>) game.getState().getValue(this.getSourceId() + "Attackers");
if (attackersListCopy == null) {
attackersListCopy = attackersList;
}
attackersListCopy.add(event.getSourceId()); // add the filtered creature to the list
game.getState().setValue(this.getSourceId() + "Attackers", attackersListCopy);
return false;
case END_COMBAT_STEP_POST:
game.getState().setValue(this.getSourceId() + "Attackers", null);
return false;
case ZONE_CHANGE:
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD
&& zEvent.getToZone() == Zone.GRAVEYARD) {
if (onlyToControllerGraveyard
&& !this.isControlledBy(game.getOwnerId(zEvent.getTargetId()))) {
return false;
}
if (itDies
&& !zEvent.isDiesEvent()) {
return false;
}
List<UUID> attackers = (List<UUID>) game.getState().getValue(this.getSourceId() + "Attackers");
return attackers != null
&& attackers.contains(zEvent.getTargetId());
}
case REMOVED_FROM_COMBAT:
// a card removed from combat is no longer an attacker or blocker so remove it from the list
List<UUID> attackersListRFC = (List<UUID>) game.getState().getValue(this.getSourceId() + "Attackers");
if (attackersListRFC != null
&& attackersListRFC.contains(event.getTargetId())) {
attackersListRFC.remove(event.getTargetId());
game.getState().setValue(this.getSourceId() + "Attackers", attackersListRFC);
}
default:
return false;
}
}
@Override
public String getTriggerPhrase() {
if (itDies) {
return "Whenever " + filterPermanent.getMessage() + " dies, ";
}
return "Whenever " + filterPermanent.getMessage() + " is put into " + (onlyToControllerGraveyard ? "your" : "a")
+ " graveyard from the battlefield, ";
}
}
/*
* 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.abilities.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import static mage.game.events.GameEvent.EventType.END_COMBAT_STEP_POST;
import static mage.game.events.GameEvent.EventType.REMOVED_FROM_COMBAT;
import static mage.game.events.GameEvent.EventType.ZONE_CHANGE;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
*
* @author weirddan455 and jeffwadsworth
*/
public class AttackingCreaturePutIntoGraveyardTriggeredAbility extends TriggeredAbilityImpl {
protected FilterPermanent filterPermanent;
private final boolean onlyToControllerGraveyard;
private final boolean itDies;
public AttackingCreaturePutIntoGraveyardTriggeredAbility(Effect effect, FilterPermanent filterPermanent, Boolean onlyToControllerGraveyard, Boolean itDies, Boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
this.filterPermanent = filterPermanent;
this.onlyToControllerGraveyard = onlyToControllerGraveyard;
this.itDies = itDies;
}
private AttackingCreaturePutIntoGraveyardTriggeredAbility(final AttackingCreaturePutIntoGraveyardTriggeredAbility ability) {
super(ability);
this.filterPermanent = ability.filterPermanent;
this.onlyToControllerGraveyard = ability.onlyToControllerGraveyard;
this.itDies = ability.itDies;
}
@Override
public AttackingCreaturePutIntoGraveyardTriggeredAbility copy() {
return new AttackingCreaturePutIntoGraveyardTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
switch (event.getType()) {
case ATTACKER_DECLARED:
case END_COMBAT_STEP_POST:
case ZONE_CHANGE:
case REMOVED_FROM_COMBAT:
return true;
default:
return false;
}
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
switch (event.getType()) {
case ATTACKER_DECLARED:
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null
&& !filterPermanent.match(permanent, game)) {
return false;
}
List<UUID> attackersList = new ArrayList<>();
List<UUID> attackersListCopy = (List<UUID>) game.getState().getValue(this.getSourceId() + "Attackers");
if (attackersListCopy == null) {
attackersListCopy = attackersList;
}
attackersListCopy.add(event.getSourceId()); // add the filtered creature to the list
game.getState().setValue(this.getSourceId() + "Attackers", attackersListCopy);
return false;
case END_COMBAT_STEP_POST:
game.getState().setValue(this.getSourceId() + "Attackers", null);
return false;
case ZONE_CHANGE:
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD
&& zEvent.getToZone() == Zone.GRAVEYARD) {
if (onlyToControllerGraveyard
&& !this.isControlledBy(game.getOwnerId(zEvent.getTargetId()))) {
return false;
}
if (itDies
&& !zEvent.isDiesEvent()) {
return false;
}
List<UUID> attackers = (List<UUID>) game.getState().getValue(this.getSourceId() + "Attackers");
return attackers != null
&& attackers.contains(zEvent.getTargetId());
}
case REMOVED_FROM_COMBAT:
// a card removed from combat is no longer an attacker or blocker so remove it from the list
List<UUID> attackersListRFC = (List<UUID>) game.getState().getValue(this.getSourceId() + "Attackers");
if (attackersListRFC != null
&& attackersListRFC.contains(event.getTargetId())) {
attackersListRFC.remove(event.getTargetId());
game.getState().setValue(this.getSourceId() + "Attackers", attackersListRFC);
}
default:
return false;
}
}
@Override
public String getTriggerPhrase() {
if (itDies) {
return "Whenever " + filterPermanent.getMessage() + " dies, ";
}
return "Whenever " + filterPermanent.getMessage() + " is put into " + (onlyToControllerGraveyard ? "your" : "a")
+ " graveyard from the battlefield, ";
}
}

View file

@ -1,31 +1,31 @@
package mage.abilities.condition.common;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedThisTurnWatcher;
/**
*
* @author jeffwadsworth
*/
public enum DidNotAttackThisTurnEnchantedCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent auraPermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (auraPermanent != null) {
Permanent enchantedPermanent = game.getPermanent(auraPermanent.getAttachedTo());
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
return enchantedPermanent != null
&& watcher != null
&& !watcher.getAttackedThisTurnCreatures().contains(
new MageObjectReference(enchantedPermanent, game));
}
return false;
}
}
package mage.abilities.condition.common;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedThisTurnWatcher;
/**
*
* @author jeffwadsworth
*/
public enum DidNotAttackThisTurnEnchantedCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent auraPermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (auraPermanent != null) {
Permanent enchantedPermanent = game.getPermanent(auraPermanent.getAttachedTo());
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
return enchantedPermanent != null
&& watcher != null
&& !watcher.getAttackedThisTurnCreatures().contains(
new MageObjectReference(enchantedPermanent, game));
}
return false;
}
}

View file

@ -1,48 +1,48 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class ControllerLifeDividedValue implements DynamicValue {
private final Integer divider;
public ControllerLifeDividedValue(Integer divider) {
this.divider = divider;
}
public ControllerLifeDividedValue(final ControllerLifeDividedValue dynamicValue) {
this.divider = dynamicValue.divider;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player p = game.getPlayer(sourceAbility.getControllerId());
if (p != null) {
return p.getLife() / divider;
}
return 0;
}
@Override
public ControllerLifeDividedValue copy() {
return new ControllerLifeDividedValue(this);
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "";
}
}
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class ControllerLifeDividedValue implements DynamicValue {
private final Integer divider;
public ControllerLifeDividedValue(Integer divider) {
this.divider = divider;
}
public ControllerLifeDividedValue(final ControllerLifeDividedValue dynamicValue) {
this.divider = dynamicValue.divider;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player p = game.getPlayer(sourceAbility.getControllerId());
if (p != null) {
return p.getLife() / divider;
}
return 0;
}
@Override
public ControllerLifeDividedValue copy() {
return new ControllerLifeDividedValue(this);
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -1,62 +1,62 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class HighestCMCOfPermanentValue implements DynamicValue {
private final FilterPermanent filter;
private final boolean onlyIfCanBeSacrificed;
public HighestCMCOfPermanentValue(FilterPermanent filter, boolean onlyIfCanBeSacrificed) {
super();
this.filter = filter;
this.onlyIfCanBeSacrificed = onlyIfCanBeSacrificed;
}
public HighestCMCOfPermanentValue(final HighestCMCOfPermanentValue dynamicValue) {
this.filter = dynamicValue.filter;
this.onlyIfCanBeSacrificed = dynamicValue.onlyIfCanBeSacrificed;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int value = 0;
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller != null) {
for (Permanent permanent : game.getBattlefield()
.getActivePermanents(filter, sourceAbility.getControllerId(), sourceAbility.getSourceId(), game)) {
if ((!onlyIfCanBeSacrificed || controller.canPaySacrificeCost(permanent, sourceAbility, sourceAbility.getControllerId(), game))
&& permanent.getManaValue() > value) {
value = permanent.getManaValue();
}
}
}
return value;
}
@Override
public HighestCMCOfPermanentValue copy() {
return new HighestCMCOfPermanentValue(this);
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return filter.getMessage();
}
}
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class HighestCMCOfPermanentValue implements DynamicValue {
private final FilterPermanent filter;
private final boolean onlyIfCanBeSacrificed;
public HighestCMCOfPermanentValue(FilterPermanent filter, boolean onlyIfCanBeSacrificed) {
super();
this.filter = filter;
this.onlyIfCanBeSacrificed = onlyIfCanBeSacrificed;
}
public HighestCMCOfPermanentValue(final HighestCMCOfPermanentValue dynamicValue) {
this.filter = dynamicValue.filter;
this.onlyIfCanBeSacrificed = dynamicValue.onlyIfCanBeSacrificed;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int value = 0;
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller != null) {
for (Permanent permanent : game.getBattlefield()
.getActivePermanents(filter, sourceAbility.getControllerId(), sourceAbility.getSourceId(), game)) {
if ((!onlyIfCanBeSacrificed || controller.canPaySacrificeCost(permanent, sourceAbility, sourceAbility.getControllerId(), game))
&& permanent.getManaValue() > value) {
value = permanent.getManaValue();
}
}
}
return value;
}
@Override
public HighestCMCOfPermanentValue copy() {
return new HighestCMCOfPermanentValue(this);
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return filter.getMessage();
}
}

File diff suppressed because it is too large Load diff