public static final DamageResists getDamageResistsByName(final String pName) { for (final Field field : CreepConstants.class.getDeclaredFields()) { if (field.getName().equals(pName)) { try { return (DamageResists) field.get(field); } catch (IllegalArgumentException e) { Debug.e(e); } catch (IllegalAccessException e) { Debug.e(e); } } } return CREEP_RESIST_NONE; }
public static final float getFloatByName(final String pName) { for (final Field field : CreepConstants.class.getDeclaredFields()) { if (field.getName().equals(pName)) { try { return field.getFloat(field); } catch (IllegalArgumentException e) { Debug.e(e); } catch (IllegalAccessException e) { Debug.e(e); } } } return 0f; }