use of main.content.enums.GenericEnums.ROLL_TYPES in project Eidolons by IDemiurge.
the class RollMaster method generateRollsFromString.
public static Rolls generateRollsFromString(String rollString) {
boolean or = false;
if (rollString.contains(StringMaster.AND_SEPARATOR)) {
or = true;
}
Rolls rolls = new Rolls(or);
String separator = StringMaster.AND_SEPARATOR;
if (!or) {
separator = StringMaster.AND;
}
for (String s : StringMaster.open(rollString, separator)) {
String varPart = VariableManager.getVarPart(s);
if (StringMaster.isEmpty(varPart)) {
rolls.add(new Roll(new EnumMaster<ROLL_TYPES>().retrieveEnumConst(ROLL_TYPES.class, s), null, null));
continue;
}
s = s.replace(varPart, "");
varPart = StringMaster.cropParenthesises(varPart);
String success = StringMaster.openContainer(varPart, StringMaster.VAR_SEPARATOR).get(0);
String fail = StringMaster.openContainer(varPart, StringMaster.VAR_SEPARATOR).get(1);
ROLL_TYPES type = new EnumMaster<ROLL_TYPES>().retrieveEnumConst(ROLL_TYPES.class, s);
rolls.add(new Roll(type, success, fail));
}
return rolls;
}
use of main.content.enums.GenericEnums.ROLL_TYPES in project Eidolons by IDemiurge.
the class ActivesConstructor method wrapInSaveRollEffect.
public static void wrapInSaveRollEffect(Effects effects, String saveRoll) {
// TODO
ArrayList<ROLL_TYPES> rolls = new ArrayList<>();
ArrayList<String> vars = new ArrayList<>();
for (String roll : StringMaster.open(saveRoll, StringMaster.AND_SEPARATOR)) {
String varArgs = VariableManager.getVarPart(roll);
roll = roll.replace(varArgs, "");
rolls.add(new EnumMaster<ROLL_TYPES>().retrieveEnumConst(ROLL_TYPES.class, roll));
vars.add(varArgs);
}
int i = 0;
for (Effect e : effects) {
for (ROLL_TYPES roll : rolls) {
String args = StringMaster.cropParenthesises(vars.get(i));
e = wrapInRoll(e, roll, args);
i++;
}
}
}
use of main.content.enums.GenericEnums.ROLL_TYPES in project Eidolons by IDemiurge.
the class RollMaster method rollForceKnockdown.
/*
* apply *Push* effect always if sufficient force
* apply *Knockdown* instead plus damage for force if roll (?) failed
TODO reflex? defense vs force? forceResistance - strength, armor,
shield,
rollLogged(roll_type, success, fail, ref, logString, rollSource)
resist if reflex win
draw if strength win
*/
public static Boolean rollForceKnockdown(Unit target, DC_ActiveObj attack, int force) {
ROLL_TYPES roll_type = GenericEnums.ROLL_TYPES.FORCE;
String success = "3*" + getStdFormula(GenericEnums.ROLL_TYPES.BODY_STRENGTH, true);
String fail = "" + force / ForceRule.ROLL_FACTOR;
// Ref ref = Ref.getSelfTargetingRefCopy(target);
// ref.setSource(attack.getRef().getSource());
Boolean result = new Roll(GenericEnums.ROLL_TYPES.FORCE, success, fail, 25).roll(attack.getRef());
if (result == null) {
}
return result;
}
Aggregations