public static Aspect lastPassingAspect(List<Aspect> aspects, PlayerCharacter pc, Ability a) { Aspect retAspect = null; if (aspects != null) { for (int i = 0; i < aspects.size(); i++) { Aspect testAspect = aspects.get(i); if (testAspect.qualifies(pc, a)) { retAspect = testAspect; } } } return retAspect; }
public static String printAspect( PlayerCharacter pc, AspectName key, List<CNAbility> abilities, boolean printName) { if (abilities.size() == 0) { return ""; } Ability sampleAbilityObject = abilities.get(0).getAbility(); StringBuilder buff = new StringBuilder(); List<Aspect> aspects = sampleAbilityObject.get(MapKey.ASPECT, key); Aspect aspect = lastPassingAspect(aspects, pc, sampleAbilityObject); if (aspect != null) { if (printName) { buff.append(aspect.getName()).append(": "); } buff.append(aspect.getAspectText(pc, abilities)); } return buff.toString(); }