private void populateSkillsTable() { TableLayout tableSkills = (TableLayout) findViewById(R.id.tableSkills); tableSkills.setShrinkAllColumns(false); tableSkills.setStretchAllColumns(false); tableSkills.removeAllViews(); skillEditorFactory.resetEditors(); Map<String, SkillCategoryEditor> categoryEditors = new HashMap<String, SkillCategoryEditor>(); for (ISkill skill : investigator.getSkills().list()) { if (skill.isCategory()) { SkillCategoryEditor editor = skillEditorFactory.newSkillCategoryEditor( this, investigator.getSkills(), (SkillCategory) skill); categoryEditors.put(skill.getName(), editor); editor.addOnSkillChangedListener(this); tableSkills.addView(editor); } else { Skill sk = (Skill) skill; if (sk.isAdded()) continue; SkillEditor editor = skillEditorFactory.newSkillEditor(investigator.getSkills(), sk); editor.addOnSkillChangedListener(this); tableSkills.addView(editor); } } skillChanged(null); }
// This sucks but it's pretty straightforward for now private void calculateDynamicSkills(Attribute attribute, boolean updateEditor) { ISkill sk = null; if (attribute.getName().equals("DEX")) { sk = investigator.getSkills().get("Dodge"); if (sk != null) sk.setBaseValue(attribute.getTotal() * 2); } else if (attribute.getName().equals("EDU")) { sk = investigator.getSkills().get("Own Language"); if (sk != null) sk.setBaseValue(Math.min(99, attribute.getTotal() * 5)); } if (updateEditor && sk != null) { BaseSkillEditor editor = findSkillEditor(sk); editor.updateBaseValue(); } }