forked from External/mage
Update *.sh and *.java files to use Unix line endings
This commit is contained in:
parent
a6d03c925f
commit
9c7982e8f6
273 changed files with 26704 additions and 26704 deletions
|
|
@ -1,51 +1,51 @@
|
|||
|
||||
package mage.abilities.dynamicvalue;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* The first calculated value is used as long as the class instance is in use
|
||||
*
|
||||
* IMPORTANT: If used the ability / effect that uses a locked in dynamic value
|
||||
* has to really copy the dnamic value in its copy method (not reference)
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class LockedInDynamicValue implements DynamicValue {
|
||||
|
||||
private boolean valueChecked = false;
|
||||
private int lockedInValue;
|
||||
private final DynamicValue basicDynamicValue;
|
||||
|
||||
public LockedInDynamicValue(DynamicValue dynamicValue) {
|
||||
this.basicDynamicValue = dynamicValue;
|
||||
}
|
||||
|
||||
public LockedInDynamicValue(LockedInDynamicValue dynamicValue, final boolean copy) {
|
||||
this.basicDynamicValue = dynamicValue.basicDynamicValue;
|
||||
this.lockedInValue = dynamicValue.lockedInValue;
|
||||
this.valueChecked = dynamicValue.valueChecked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
if (!valueChecked) {
|
||||
lockedInValue = basicDynamicValue.calculate(game, sourceAbility, effect);
|
||||
valueChecked = true;
|
||||
}
|
||||
return lockedInValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockedInDynamicValue copy() {
|
||||
return new LockedInDynamicValue(this, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return basicDynamicValue.getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package mage.abilities.dynamicvalue;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* The first calculated value is used as long as the class instance is in use
|
||||
*
|
||||
* IMPORTANT: If used the ability / effect that uses a locked in dynamic value
|
||||
* has to really copy the dnamic value in its copy method (not reference)
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class LockedInDynamicValue implements DynamicValue {
|
||||
|
||||
private boolean valueChecked = false;
|
||||
private int lockedInValue;
|
||||
private final DynamicValue basicDynamicValue;
|
||||
|
||||
public LockedInDynamicValue(DynamicValue dynamicValue) {
|
||||
this.basicDynamicValue = dynamicValue;
|
||||
}
|
||||
|
||||
public LockedInDynamicValue(LockedInDynamicValue dynamicValue, final boolean copy) {
|
||||
this.basicDynamicValue = dynamicValue.basicDynamicValue;
|
||||
this.lockedInValue = dynamicValue.lockedInValue;
|
||||
this.valueChecked = dynamicValue.valueChecked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
if (!valueChecked) {
|
||||
lockedInValue = basicDynamicValue.calculate(game, sourceAbility, effect);
|
||||
valueChecked = true;
|
||||
}
|
||||
return lockedInValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockedInDynamicValue copy() {
|
||||
return new LockedInDynamicValue(this, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return basicDynamicValue.getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,58 +1,58 @@
|
|||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class CountersCount implements DynamicValue {
|
||||
|
||||
private CounterType counter;
|
||||
private FilterPermanent filter;
|
||||
|
||||
public CountersCount(CounterType counterType) {
|
||||
this(counterType, new FilterPermanent());
|
||||
}
|
||||
|
||||
public CountersCount(CounterType counter, FilterPermanent filter) {
|
||||
this.counter = counter;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public CountersCount(final CountersCount countersCount) {
|
||||
this.counter = countersCount.counter;
|
||||
this.filter = countersCount.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||
count += permanent.getCounters(game).getCount(counter);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CountersCount copy() {
|
||||
return new CountersCount(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return counter.getName() + " counter on " + filter.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class CountersCount implements DynamicValue {
|
||||
|
||||
private CounterType counter;
|
||||
private FilterPermanent filter;
|
||||
|
||||
public CountersCount(CounterType counterType) {
|
||||
this(counterType, new FilterPermanent());
|
||||
}
|
||||
|
||||
public CountersCount(CounterType counter, FilterPermanent filter) {
|
||||
this.counter = counter;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public CountersCount(final CountersCount countersCount) {
|
||||
this.counter = countersCount.counter;
|
||||
this.filter = countersCount.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||
count += permanent.getCounters(game).getCount(counter);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CountersCount copy() {
|
||||
return new CountersCount(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return counter.getName() + " counter on " + filter.getMessage();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +1,44 @@
|
|||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author Styxo
|
||||
*/
|
||||
public enum GreatestPowerAmongControlledCreaturesValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = 0;
|
||||
for (Permanent p : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, sourceAbility.getControllerId(), game
|
||||
)) {
|
||||
amount = Math.max(p.getPower().getValue(), amount);
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GreatestPowerAmongControlledCreaturesValue copy() {
|
||||
return GreatestPowerAmongControlledCreaturesValue.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest power among creatures you control";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author Styxo
|
||||
*/
|
||||
public enum GreatestPowerAmongControlledCreaturesValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = 0;
|
||||
for (Permanent p : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, sourceAbility.getControllerId(), game
|
||||
)) {
|
||||
amount = Math.max(p.getPower().getValue(), amount);
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GreatestPowerAmongControlledCreaturesValue copy() {
|
||||
return GreatestPowerAmongControlledCreaturesValue.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest power among creatures you control";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum GreatestToughnessAmongControlledCreaturesValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = 0;
|
||||
for (Permanent p : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, sourceAbility.getControllerId(), game
|
||||
)) {
|
||||
amount = Math.max(p.getToughness().getValue(), amount);
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GreatestToughnessAmongControlledCreaturesValue copy() {
|
||||
return GreatestToughnessAmongControlledCreaturesValue.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest toughness among creatures you control";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum GreatestToughnessAmongControlledCreaturesValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = 0;
|
||||
for (Permanent p : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, sourceAbility.getControllerId(), game
|
||||
)) {
|
||||
amount = Math.max(p.getToughness().getValue(), amount);
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GreatestToughnessAmongControlledCreaturesValue copy() {
|
||||
return GreatestToughnessAmongControlledCreaturesValue.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest toughness among creatures you control";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue