mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
Restructured Mage module
This commit is contained in:
parent
727d62babb
commit
46eb6c0525
1502 changed files with 11 additions and 9 deletions
|
|
@ -0,0 +1,60 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class CardsInControllerGraveyardCount implements DynamicValue {
|
||||
|
||||
private FilterCard filter;
|
||||
private Integer amount;
|
||||
|
||||
public CardsInControllerGraveyardCount() {
|
||||
this(new FilterCard(), 1);
|
||||
}
|
||||
|
||||
public CardsInControllerGraveyardCount(FilterCard filter) {
|
||||
this(filter, 1);
|
||||
}
|
||||
|
||||
public CardsInControllerGraveyardCount(FilterCard filter, Integer amount) {
|
||||
this.filter = filter;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public CardsInControllerGraveyardCount(final CardsInControllerGraveyardCount dynamicValue) {
|
||||
this.filter = dynamicValue.filter;
|
||||
this.amount = dynamicValue.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Player player = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (player != null) {
|
||||
return amount * player.getGraveyard().count(filter, game);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardsInControllerGraveyardCount copy() {
|
||||
return new CardsInControllerGraveyardCount(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return amount.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return filter.getMessage() + " in your graveyard";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue