forked from External/mage
various files converted from CRLF to LF
This commit is contained in:
parent
ea561892f5
commit
3a3e3fda48
36 changed files with 8696 additions and 8696 deletions
|
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue