use of eidolons.game.battlecraft.rules.combat.attack.AttackCalculator.MOD_IDENTIFIER in project Eidolons by IDemiurge.
the class ActionAnimation method getImageMapFromIds.
protected Map<Image, String> getImageMapFromIds(Attack attack, Map<MOD_IDENTIFIER, String> map) {
Map<Image, String> iconMap = new XLinkedMap<>();
subPhaseTypeMap = new XLinkedMap<>();
for (MOD_IDENTIFIER modId : map.keySet()) {
Image image = modId.getImage(map.get(modId), attack);
PHASE_TYPE phaseType = getSubPhaseTypeForKey(modId);
if (phaseType == null) {
getSubPhaseTooltipMap().put(image, getTooltip(modId));
}
subPhaseTypeMap.put(image, phaseType);
iconMap.put(image, map.get(modId));
}
return iconMap;
}
use of eidolons.game.battlecraft.rules.combat.attack.AttackCalculator.MOD_IDENTIFIER in project Eidolons by IDemiurge.
the class ActionAnimation method drawDamageFormulaBonuses.
// TODO include RESISTANCE; add EXTENDED MAP that will update things like
// SIDE_MOD, CLOSE_QUARTERS...
protected boolean drawDamageFormulaBonuses(AnimPhase phase) {
Attack attack = (Attack) phase.getArgs()[0];
Map<MOD_IDENTIFIER, Integer> modsMap = (Map<MOD_IDENTIFIER, Integer>) phase.getArgs()[1];
Map<MOD_IDENTIFIER, Integer> bonusesMap = (Map<MOD_IDENTIFIER, Integer>) phase.getArgs()[2];
drawIconMap(getImageMapFromIds(attack, new ListMaster<MOD_IDENTIFIER>().getStringMap(bonusesMap)));
Integer totalMod = 0;
for (Integer mod : modsMap.values()) {
totalMod += mod;
}
if (totalMod == 0) {
return true;
}
String text = StringMaster.getModifierString(totalMod);
int y = (h - fontHeight) / 2;
drawTextOnTarget(text, font, w, y, getColorForModifier(totalMod));
addMouseItem(false, w, y, FontMaster.getStringWidth(font, text), fontHeight, new MouseItemImpl(MOUSE_ITEM.SUB_PHASE, PHASE_TYPE.DAMAGE_FORMULA_MODS));
return true;
}
use of eidolons.game.battlecraft.rules.combat.attack.AttackCalculator.MOD_IDENTIFIER in project Eidolons by IDemiurge.
the class AttackAnimation method drawDamageFormulaOld.
protected boolean drawDamageFormulaOld(AnimPhase phase) {
// concise extendable form:
// atk/def ; action dmg mods; weapon dmg mods;
Map<MOD_IDENTIFIER, Integer> modsMap = (Map<MOD_IDENTIFIER, Integer>) phase.getArgs()[0];
Map<MOD_IDENTIFIER, Integer> bonusesMap = (Map<MOD_IDENTIFIER, Integer>) phase.getArgs()[1];
// key: +/- mod% (+/- bonus)
// icon? clickable!
int i = 0;
int y_base = 0;
int wrap = 3;
Font font = getFontNeutral();
for (MOD_IDENTIFIER id : bonusesMap.keySet()) {
String text = StringMaster.getBonusString(bonusesMap.get(id));
// string += map.getOrCreate(s) + "" + StringMaster.wrapInParenthesis(s);
Image image = id.getImage(bonusesMap.get(id), attack);
if (image == null) {
image = ImageManager.getDeadIcon();
}
// ImageManager.getImageForDamageFormulaKey(s);
int height = image.getHeight(null);
int width = image.getWidth(null);
int y = y_base;
int x = 0;
if (i == 1) {
x = MigMaster.getCenteredPosition(w, width);
} else if (i == 2) {
x = w - width;
}
drawOnTarget(image, x, y);
if (getSubPhaseTypeForKey(id) == null) {
getSubPhaseTypeForKey(id);
}
addMouseItem(false, x, y, width, height, new MouseItemImpl(MOUSE_ITEM.SUB_PHASE, getSubPhaseTypeForKey(id)));
// addToolTip(s+modsMap.getOrCreate(s));
y += MAX_MINI_ICON_SIZE + 3;
Integer mod = bonusesMap.get(id);
Color color = getColorForModifier(mod);
x += (width - FontMaster.getStringWidth(font, StringMaster.getModifierString(mod))) / 2;
drawTextOnTarget(text, font, x, y, color);
i++;
if (i >= wrap) {
i = 0;
y_base = h / 2;
}
// mods for main attack damage
}
// what about the additional / specialEffects?
return true;
}
use of eidolons.game.battlecraft.rules.combat.attack.AttackCalculator.MOD_IDENTIFIER in project Eidolons by IDemiurge.
the class ActionAnimation method drawDamageFormulaMods.
protected boolean drawDamageFormulaMods(AnimPhase phase) {
Attack attack = (Attack) phase.getArgs()[0];
Map<MOD_IDENTIFIER, Integer> modsMap = (Map<MOD_IDENTIFIER, Integer>) phase.getArgs()[1];
drawIconMap(getImageMapFromIds(attack, new ListMaster<MOD_IDENTIFIER>().getStringMap(modsMap)));
return true;
}
Aggregations