public float encode(PdfContentByte directContent, IGenericCharacter character, Bounds bounds) {
    String joinLabel = resources.getString("Sheet.Combat.JoinBattle"); // $NON-NLS-1$
    String dodgeLabel = resources.getString("Sheet.Combat.DodgeDV"); // $NON-NLS-1$
    String knockdownLabel = resources.getString("Sheet.Combat.Knockdown"); // $NON-NLS-1$
    String stunningLabel = resources.getString("Sheet.Combat.Stunning"); // $NON-NLS-1$
    IGenericTraitCollection traitCollection = character.getTraitCollection();
    IEquipmentModifiers equipment = character.getEquipmentModifiers();
    ICharacterType characterType = character.getTemplate().getTemplateType().getCharacterType();

    int joinBattle = CharacterUtilties.getJoinBattle(traitCollection, equipment);
    int dodgeDV = CharacterUtilties.getDodgeDv(characterType, traitCollection, equipment);
    int knockdownThreshold = CharacterUtilties.getKnockdownThreshold(traitCollection, equipment);
    int knockdownPool = CharacterUtilties.getKnockdownPool(character, traitCollection, equipment);
    int stunningThreshold = CharacterUtilties.getStunningThreshold(traitCollection, equipment);
    int stunningPool = CharacterUtilties.getStunningPool(traitCollection, equipment);

    Position upperLeftCorner = new Position(bounds.x, bounds.getMaxY());
    LabelledValueEncoder encoder =
        new LabelledValueEncoder(baseFont, 4, upperLeftCorner, bounds.width, 3);
    encoder.addLabelledValue(directContent, 0, joinLabel, joinBattle);
    encoder.addLabelledValue(directContent, 1, dodgeLabel, dodgeDV);
    encoder.addLabelledValue(directContent, 2, knockdownLabel, knockdownThreshold, knockdownPool);
    encoder.addLabelledValue(directContent, 3, stunningLabel, stunningThreshold, stunningPool);
    // String mobilityPenaltyLabel = "-" + resources.getString("Sheet.Combat.MobilityPenalty");
    // //$NON-NLS-1$ //$NON-NLS-2$
    String thresholdPoolLabel = resources.getString("Sheet.Combat.ThresholdPool"); // $NON-NLS-1$
    // encoder.addComment(directContent, mobilityPenaltyLabel, 1);
    encoder.addComment(directContent, thresholdPoolLabel, 2);
    encoder.addComment(directContent, thresholdPoolLabel, 3);
    return encoder.getHeight();
  }
 public boolean canSpendOn(IMagic magic) {
   IGenericTraitCollection traitCollection = character.getTraitCollection();
   if (!pool.isAllowedFor(traitCollection, magic)) {
     return false;
   }
   return pointsSpent < pool.getAdditionalMagicCount(traitCollection);
 }
 public int getTraitMax() {
   IIdentifiedTraitTypeGroup group = getIdentifiedTraitTypeGroups()[0];
   ITraitType traitType = group.getAllGroupTypes()[0];
   ITraitTemplate template =
       character.getTemplate().getTraitTemplateCollection().getTraitTemplate(traitType);
   return template.getLimitation().getAbsoluteLimit(character);
 }
 public void encode(
     PdfContentByte directContent,
     IGenericCharacter character,
     IGenericDescription description,
     Bounds bounds)
     throws DocumentException {
   IVirtueFlaw resonance =
       ((IVirtueFlawModel) character.getAdditionalModel(AbyssalResonanceTemplate.ID))
           .getVirtueFlaw();
   Bounds textBounds =
       traitEncoder.encode(directContent, bounds, resonance.getLimitTrait().getCurrentValue());
   Font font = createFont(getBaseFont());
   Font nameFont = createNameFont(getBaseFont());
   Phrase phrase = new Phrase("", font); // $NON-NLS-1$
   phrase.add(
       new Chunk(
           resources.getString("Sheet.GreatCurse.FlawedVirtue") + ": ",
           nameFont)); //$NON-NLS-1$ //$NON-NLS-2$
   if (resonance.isFlawComplete()) {
     phrase.add(resonance.getRoot().getId() + ".\n");
   } else {
     Font undefinedFont = new Font(font);
     undefinedFont.setStyle(Font.UNDERLINE);
     phrase.add(
         new Chunk("                                          ", undefinedFont)); // $NON-NLS-1$
     phrase.add(".\n");
   }
   phrase.add(resources.getString("Sheet.GreatCurse.ResonanceReference")); // $NON-NLS-1$
   encodeTextWithReducedLineHeight(directContent, textBounds, phrase);
 }
 public void spendPointsFor(IMagic magic) {
   if (canSpendOn(magic)) {
     if (magic instanceof ICharm && character.isAlienCharm((ICharm) magic)) {
       pointsSpent++;
     }
     pointsSpent++;
   }
 }
 private boolean hasTBA(IGenericCharacter character) {
   for (ICharm charm : character.getLearnedCharms()) {
     if (charm.getId().equals(TERRIFYING_BEASTMAN_ALTERATION)) {
       return true;
     }
   }
   return false;
 }
 private boolean hasDBT(IGenericCharacter character) {
   for (IMagic magic : character.getAllLearnedMagic()) {
     if (magic instanceof ICharm && magic.getId().equals("Lunar.DeadlyBeastmanTransformation")) {
       return true;
     }
   }
   return false;
 }
예제 #8
0
 public float encode(
     SheetGraphics graphics, ReportContent content, Position position, float width, float height) {
   IGenericCharacter character = content.getCharacter();
   String title = getResources().getString("Sheet.AbilitySubHeader.Specialties"); // $NON-NLS-1$
   List<IValuedTraitReference> references = new ArrayList<IValuedTraitReference>();
   for (IIdentifiedTraitTypeGroup group : character.getAbilityTypeGroups()) {
     for (ITraitType traitType : group.getAllGroupTypes()) {
       Collections.addAll(
           references, getTraitReferences(character.getSpecialties(traitType), traitType));
     }
   }
   IValuedTraitReference[] specialties =
       references.toArray(new IValuedTraitReference[references.size()]);
   if (specialtyCount > 0) {
     return _drawNamedTraitSection(
         graphics, title, specialties, position, width, specialtyCount, 3);
   } else {
     return drawNamedTraitSection(graphics, title, specialties, position, width, height, 3);
   }
 }
 public boolean[] hasExcellenciesLearned(ITraitType traitType) {
   IMagicStats[] excellencies = getExcellencies();
   List<IMagic> allLearnedMagic = character.getAllLearnedMagic();
   boolean[] excellencyLearned = new boolean[excellencies.length];
   for (int i = 0; i < excellencies.length; i++) {
     final String charmId =
         excellencies[i].getName().getId() + "." + traitType.getId(); // $NON-NLS-1$
     excellencyLearned[i] =
         CollectionUtilities.getFirst(
                 allLearnedMagic,
                 new IPredicate<IMagic>() {
                   @Override
                   public boolean evaluate(IMagic value) {
                     return charmId.equals(value.getId());
                   }
                 })
             != null;
   }
   return excellencyLearned;
 }
 public int getTotalPoints() {
   return pool.getAdditionalMagicCount(character.getTraitCollection());
 }