Refactor: extract card names compare logic (is empty name, is same name)

Fixed last broken tests
This commit is contained in:
Oleg Agafonov 2018-12-07 00:26:50 +04:00
parent 96187ad3c0
commit 02b7e2cf10
63 changed files with 614 additions and 466 deletions

View file

@ -1,15 +1,15 @@
package mage.game.permanent;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCost;
import mage.constants.EmptyNames;
import mage.game.Game;
import mage.game.permanent.token.Token;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class PermanentToken extends PermanentImpl {
@ -42,6 +42,15 @@ public class PermanentToken extends PermanentImpl {
this.toughness.resetToBaseValue();
}
@Override
public String getName() {
if (name.isEmpty()) {
return EmptyNames.FACE_DOWN_TOKEN.toString();
} else {
return name;
}
}
private void copyFromToken(Token token, Game game, boolean reset) {
this.name = token.getName();
this.abilities.clear();