Adding experimental chat output for AddKeyword effects to indicate their result (notably so that the Keeper of Isengard errata will record what it was used on)

This commit is contained in:
Christian 'ketura' McCarty
2022-07-22 14:07:07 -05:00
parent 0a60e55405
commit eb0456abd2
3 changed files with 34 additions and 2 deletions

View File

@@ -63,6 +63,13 @@ public enum Keyword implements Filterable {
return _humanReadable;
}
public String getHumanReadableGeneric() {
if(_multiples)
return _humanReadable + " bonus";
return _humanReadable;
}
public boolean isInfoDisplayable() {
return _infoDisplayable;
}

View File

@@ -13,6 +13,7 @@ import com.gempukku.lotro.cards.build.field.effect.appender.resolver.ValueResolv
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.AddUntilModifierEffect;
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
@@ -68,6 +69,12 @@ public class AddKeyword implements EffectAppenderProducer {
result.add(new AddUntilModifierEffect(
new KeywordModifier(actionContext.getSource(), physicalCard, keywordFunction.apply(actionContext), keywordCount), until));
}
actionContext.getGame().getGameState().sendMessage(
GameUtils.getCardLink(actionContext.getSource())
+ " adds " + keywordFunction.apply(actionContext).getHumanReadableGeneric()
+ " to " + GameUtils.getAppendedNames(cardsFromMemory)
+ " until " + until.getHumanReadable());
return result;
}
});

View File

@@ -17,13 +17,16 @@ public class TimeResolver {
if (value.startsWith("start(") && value.endsWith(")")) {
final String phaseName = value.substring(value.indexOf("(") + 1, value.lastIndexOf(")"));
return new Time(Phase.valueOf(phaseName.toUpperCase()), true, false);
} else if (value.startsWith("end(") && value.endsWith(")")) {
}
else if (value.startsWith("end(") && value.endsWith(")")) {
final String phaseName = value.substring(value.indexOf("(") + 1, value.lastIndexOf(")"));
if (phaseName.equals("current"))
return new Time(null, false, false);
return new Time(Phase.valueOf(phaseName.toUpperCase()), false, false);
} else if (value.equals("endofturn"))
}
else if (value.equals("endofturn"))
return new Time(null, false, true);
throw new InvalidCardDefinitionException("Unable to resolve time: " + value);
}
@@ -49,5 +52,20 @@ public class TimeResolver {
public boolean isEndOfTurn() {
return endOfTurn;
}
public String getHumanReadable() {
if (endOfTurn) {
return "the end of the turn";
}
else if (phase == null) {
return "the end of the current phase";
}
else if (start) {
return "the start of the " + phase.getHumanReadable() + " phase";
}
else {
return "the end of the " + phase.getHumanReadable() + " phase";
}
}
}
}