use of main.content.VALUE in project Eidolons by IDemiurge.
the class ValuePageManager method getAdditionalPage.
private static List<VALUE> getAdditionalPage(boolean av, List<List<VALUE>> list, OBJ_TYPE TYPE, boolean prop) {
List<VALUE> page = getAdditionalPages(av, prop).get(TYPE);
if (page == null) {
page = new ArrayList<>();
for (VALUE p : (!prop) ? ContentManager.getParamsForType(TYPE.getName(), !av) : ContentManager.getPropsForType(TYPE.getName(), !av)) {
if (!ContentManager.isValueForOBJ_TYPE(TYPE, p)) {
continue;
}
if (checkValueInPages(list, p)) {
continue;
}
page.add(p);
}
getAdditionalPages(av, prop).put(TYPE, page);
}
return page;
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class AttackTooltipFactory method createAttackTooltip.
public static AttackTooltip createAttackTooltip(DC_UnitAction el, boolean precalc, boolean costs, boolean additionalInfo, boolean combatMode, DC_Obj target) {
Pair<PARAMS, PARAMS> pair = ACTION_TOOLTIPS_PARAMS_MAP.get(ACTION_TOOLTIP_HEADER_KEY);
String name = ActionTooltipMaster.getStringForTableValue(ACTION_TOOLTIP_HEADER_KEY, el);
final String leftImage = ActionTooltipMaster.getIconPathForTableRow(pair.getLeft());
final String rightImage = ActionTooltipMaster.getIconPathForTableRow(pair.getRight());
MultiValueContainer head = new MultiValueContainer(name, leftImage, rightImage);
VALUE[] baseKeys = ACTION_TOOLTIP_BASE_KEYS;
final List<MultiValueContainer> base = extractActionValues(el, baseKeys);
baseKeys = ACTION_TOOLTIP_RANGE_KEYS;
final List<MultiValueContainer> range = extractActionValues(el, baseKeys);
List /*<List<MultiValueContainer>>*/
textsList = new ArrayList<>();
for (PARAMS[] params : ACTION_TOOLTIP_PARAMS_TEXT) {
textsList.add(Arrays.stream(params).map(p -> {
String textForTableValue = ActionTooltipMaster.getTextForTableValue(p, el);
textForTableValue = TextWrapper.wrapWithNewLine(textForTableValue, 50);
if (StringUtils.isEmpty(textForTableValue)) {
return null;
} else {
return new MultiValueContainer(textForTableValue, "");
}
}).filter(Objects::nonNull).collect(Collectors.toList()));
}
AttackTooltip toolTip = new AttackTooltip(el);
ValueContainer precalcRow = createPrecalcRow(precalc, el, target);
toolTip.setUserObject(new ActionTooltipSource() {
@Override
public MultiValueContainer getHead() {
return head;
}
@Override
public List<MultiValueContainer> getBase() {
return base;
}
@Override
public List<MultiValueContainer> getRange() {
return range;
}
@Override
public List<List<ValueContainer>> getText() {
return textsList;
}
@Override
public CostTableSource getCostsSource() {
return () -> ActionCostSourceImpl.getActionCostList(el);
}
@Override
public ValueContainer getPrecalcRow() {
return precalcRow;
}
});
return toolTip;
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class AttackTooltipFactory method extractActionValues.
private static List<MultiValueContainer> extractActionValues(DC_UnitAction el, VALUE[] baseKeys) {
List<MultiValueContainer> list = new ArrayList<>();
Pair<PARAMS, PARAMS> pair;
for (VALUE key : baseKeys) {
pair = ACTION_TOOLTIPS_PARAMS_MAP.get(key);
String name = ActionTooltipMaster.getStringForTableValue(key, el);
String imagePath = ActionTooltipMaster.getIconPathForTableRow(key);
final String leftVal = ActionTooltipMaster.getValueForTableParam(pair.getLeft(), el);
final String rightVal = ActionTooltipMaster.getValueForTableParam(pair.getRight(), el);
MultiValueContainer mvc;
if (!ImageManager.isImage(imagePath)) {
mvc = new MultiValueContainer(name, leftVal, rightVal);
} else {
mvc = new MultiValueContainer(TextureCache.getOrCreateR(imagePath), name, leftVal, rightVal);
}
list.add(mvc);
}
return list;
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class BackgroundChoiceView method applyBackground.
private void applyBackground(Unit hero, ObjType bgType) {
ObjType type = hero.getType();
type.setProperty(G_PROPS.BASE_TYPE, bgType.getName());
type.setProperty(G_PROPS.BACKGROUND_TYPE, bgType.getName());
List<VALUE> backgroundParams = DC_ContentManager.getBackgroundStaticValues();
for (VALUE v : backgroundParams) {
if (v instanceof PARAMETER) {
if (v.isWriteToType()) {
hero.modifyParameter((PARAMETER) v, bgType.getIntParam((PARAMETER) v));
} else {
type.modifyParameter((PARAMETER) v, bgType.getIntParam((PARAMETER) v));
}
// type.multiplyParamByPercent((PARAMETER) v, 50, false);// TODO
// feeble
// fix!
} else if (v instanceof PROPERTY) {
type.setProperty((PROPERTY) v, bgType.getProperty((PROPERTY) v));
}
}
hero.toBase();
}
use of main.content.VALUE in project Eidolons by IDemiurge.
the class TextGenerator method generatePerkParamBonuses.
public static String generatePerkParamBonuses(Entity e) {
List<List<VALUE>> pages = ValuePageManager.getValuesForHCInfoPages(e.getOBJ_TYPE_ENUM());
String string = PREFIX;
for (List<VALUE> list : pages) {
boolean prop = false;
for (VALUE v : list) {
if (v instanceof PARAMETER) {
if (!ContentManager.isValueForOBJ_TYPE(DC_TYPE.CHARS, v)) {
continue;
}
String amount = e.getValue(v);
amount = TextParser.parse(amount, e.getRef());
int n = new Formula(amount).getInt(e.getRef());
if (n != 0) {
string += n + " " + v.getName() + ", ";
}
} else {
prop = true;
break;
}
}
if (!prop && !list.equals(pages.get(pages.size() - 1))) {
string += StringMaster.NEW_LINE;
}
}
// StringMaster.replaceLast(" ," "and
string.substring(0, string.length() - 2);
return string;
}
Aggregations