* Some minor fixed, error handling.

This commit is contained in:
LevelX2 2015-07-04 16:44:36 +02:00
parent b481b2623f
commit 53e36c728c
3 changed files with 20 additions and 17 deletions

View file

@ -173,12 +173,11 @@ public class ComputerPlayer extends PlayerImpl implements Player {
public ComputerPlayer(String name, RangeOfInfluence range) {
super(name, range);
flagName = "computer";
human = false;
userData = UserData.getDefaultUserDataView();
userData.setAvatarId(64);
userData.setGroupId(UserGroup.COMPUTER.getGroupId());
userData.setFlagName("Computer.png");
userData.setFlagName("computer.png");
pickedCards = new ArrayList<>();
}

View file

@ -214,12 +214,16 @@ public class ContinuousEffects implements Serializable {
case WhileOnStack:
case WhileInGraveyard:
HashSet<Ability> abilities = layeredEffects.getAbility(effect.getId());
for (Ability ability : abilities) {
// If e.g. triggerd abilities (non static) created the effect, the ability must not be in usable zone (e.g. Unearth giving Haste effect)
if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, null)) {
layerEffects.add(effect);
break;
if (abilities != null) {
for (Ability ability : abilities) {
// If e.g. triggerd abilities (non static) created the effect, the ability must not be in usable zone (e.g. Unearth giving Haste effect)
if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, null)) {
layerEffects.add(effect);
break;
}
}
} else {
logger.error("No abilities for continuous effect: " + effect.toString());
}
break;
default:
@ -1058,14 +1062,16 @@ public class ContinuousEffects implements Serializable {
private void setControllerForEffect(ContinuousEffectsList<?> effects, UUID cardId, UUID controllerId) {
for (Effect effect : effects) {
HashSet<Ability> abilities = effects.getAbility(effect.getId());
for (Ability ability : abilities) {
if (ability.getSourceId() != null) {
if (ability.getSourceId().equals(cardId)) {
ability.setControllerId(controllerId);
}
} else {
if (!ability.getZone().equals(Zone.COMMAND)) {
logger.fatal(new StringBuilder("No sourceId Ability: ").append(ability));
if (abilities != null) {
for (Ability ability : abilities) {
if (ability.getSourceId() != null) {
if (ability.getSourceId().equals(cardId)) {
ability.setControllerId(controllerId);
}
} else {
if (!ability.getZone().equals(Zone.COMMAND)) {
logger.fatal(new StringBuilder("No sourceId Ability: ").append(ability));
}
}
}
}

View file

@ -227,8 +227,6 @@ public abstract class PlayerImpl implements Player, Serializable {
protected UserData userData;
protected MatchPlayer matchPlayer;
protected String flagName;
/**
* During some steps we can't play anything
*/