private boolean hasTBA(IGenericCharacter character) { for (ICharm charm : character.getLearnedCharms()) { if (charm.getId().equals(TERRIFYING_BEASTMAN_ALTERATION)) { return true; } } return false; }
private void initSpecialCharmConfigurations() { ICharmIdMap charmIdMap = getCharmIdMap(); ISpecialCharm[] specialCharms = getSpecialCharms(); for (ISpecialCharm specialCharm : specialCharms) { ICharm charm = charmIdMap.getCharmById(specialCharm.getCharmId()); if (charm == null) { continue; } ILearningCharmGroup group = getGroupById(charm.getCharacterType(), charm.getGroupId()); manager.registerSpecialCharmConfiguration(specialCharm, charm, group); } }
public int getCharmCosts(ICharm charm, ICostAnalyzer analyzer) { boolean favored = analyzer.isMagicFavored(charm); for (ICharmAttribute attribute : charm.getAttributes()) { Map<String, Integer> set = favored ? favoredKeywordCosts : generalKeywordCosts; if (set != null && set.get(attribute.getId()) != null) return set.get(attribute.getId()); } return getCharmCosts(favored, analyzer.getMartialArtsLevel(charm)); }
@Override public final boolean isLearnable(ICharm charm) { if (isAlienCharm(charm)) { ICasteType casteType = context.getBasicCharacterContext().getCasteType(); if (!getCharmTemplateForCharacterType().isAllowedAlienCharms(casteType)) { return false; } if (charm.hasAttribute(ICharmData.NATIVE)) { return false; } } if (charm.isBlockedByAlternative(context.getMagicCollection())) { return false; } if (isMartialArtsCharm(charm)) { boolean isSiderealFormCharm = isFormCharm(charm) && hasLevel(Sidereal, charm); MartialArtsCharmConfiguration martialArtsConfiguration = new DefaultMartialArtsCharmConfiguration( this, context.getMagicCollection(), context.getBasicCharacterContext()); if (isSiderealFormCharm && !martialArtsConfiguration.isAnyCelestialStyleCompleted()) { return false; } if (!getMartialArtsRulesForCharacterType() .isCharmAllowed(charm, martialArtsConfiguration, isExperienced())) { return false; } } ICharm[] learnedCharms = getLearnedCharms(true); for (IndirectCharmRequirement requirement : charm.getAttributeRequirements()) { if (!requirement.isFulfilled(learnedCharms)) { return false; } } if (!(new CharmTraitRequirementChecker(getPrerequisiteModifyingCharms(), context, this) .areTraitMinimumsSatisfied(charm))) { return false; } for (ICharm parentCharm : charm.getLearnPrerequisitesCharms(this)) { if (!isLearnable(parentCharm)) { return false; } } return true; }
protected boolean isLearnableWithoutPrereqs(ICharm charm) { if (!isLearnable(charm)) { return false; } for (ICharm parentCharm : charm.getLearnPrerequisitesCharms(this)) { if (!isLearned(parentCharm)) { return false; } } return true; }
private boolean costsExperience( ICharmConfiguration charmConfiguration, ICharm charm, Set<ICharm> charmsCalculated) { if (charmConfiguration.getGroup(charm).isLearned(charm, true)) { for (ICharm mergedCharm : charm.getMergedCharms()) { if (charmsCalculated.contains(mergedCharm) && !isSpecialCharm(charm)) { return false; } } return true; } return false; }
public final boolean isLearnable(ICharm charm) { if (isAlienCharm(charm)) { ICasteType casteType = context.getBasicCharacterContext().getCasteType(); if (!getCharmTemplate(getNativeCharacterType()).isAllowedAlienCharms(casteType)) { return false; } if (charm.hasAttribute(ICharmData.NOT_ALIEN_LEARNABLE)) { return false; } } if (charm.isBlockedByAlternative(context.getMagicCollection())) { return false; } if (MartialArtsUtilities.isMartialArtsCharm(charm)) { boolean isSiderealFormCharm = MartialArtsUtilities.isFormCharm(charm) && MartialArtsUtilities.hasLevel(MartialArtsLevel.Sidereal, charm); if (isSiderealFormCharm && !arbitrator.isCelestialMartialArtsGroupCompleted(getMartialArtsGroups())) { return false; } if (!getCharmTemplate(getNativeCharacterType()) .getMartialArtsRules() .isCharmAllowed( charm, context.getCharmContext().getCharmConfiguration(), context.getBasicCharacterContext().isExperienced())) { return false; } } for (ICharmAttributeRequirement requirement : charm.getAttributeRequirements()) { if (!requirement.isFulfilled(getLearnedCharms(true))) { return false; } } for (IGenericTrait prerequisite : charm.getPrerequisites()) { IGenericTrait prerequisiteTrait = context.getTraitCollection().getTrait(prerequisite.getType()); int prereq = prerequisite.getCurrentValue(); for (ISpecialCharm specialCharm : getPrerequisiteModifyingCharms()) if (specialCharm instanceof IPrerequisiteModifyingCharm && isLearned(specialCharm.getCharmId())) prereq = ((IPrerequisiteModifyingCharm) specialCharm) .getTraitModifier(charm, prerequisiteTrait.getType(), prereq); if (prerequisiteTrait == null || prereq > prerequisiteTrait.getCurrentValue()) { return false; } } IGenericTrait essenceTrait = context.getTraitCollection().getTrait(OtherTraitType.Essence); int essencePrereq = charm.getEssence().getCurrentValue(); for (ISpecialCharm specialCharm : getPrerequisiteModifyingCharms()) if (specialCharm instanceof IPrerequisiteModifyingCharm && isLearned(specialCharm.getCharmId())) essencePrereq = ((IPrerequisiteModifyingCharm) specialCharm) .getTraitModifier(charm, OtherTraitType.Essence, essencePrereq); if (essencePrereq > essenceTrait.getCurrentValue()) { return false; } for (ICharm parentCharm : charm.getLearnPrerequisitesCharms(this)) { if (!isLearnable(parentCharm)) { return false; } } return true; }
@Override public void colorCharm(ICharm charm) { view.setCharmVisuals(charm.getId(), RGBColor.White); }
private boolean hasAttributePrerequisite(ICharm charm) { return charm.getPrimaryTraitType() instanceof AttributeType; }
public final boolean isCompulsiveCharm(ICharm charm) { String[] compulsiveCharmIDs = context.getAdditionalRules().getCompulsiveCharmIDs(); return ArrayUtilities.containsValue(compulsiveCharmIDs, charm.getId()); }
@Override public boolean isAlienCharm(ICharm charm) { return !isMartialArtsCharm(charm) && isAlienType(charm.getCharacterType()); }
public String transform(ICharm input) { return resources.getString(input.getId()); }
protected final boolean haveSamePrerequisite(ICharm charm1, ICharm charm2) { return charm1.getPrimaryTraitType() == charm2.getPrimaryTraitType(); }
private boolean selectAbilitiesCombo(ICharm charm1, ICharm charm2) { return hasAbilityPrerequisite(charm2) && charm1.getComboRules().combosSelectAbility((AbilityType) charm2.getPrimaryTraitType()); }
private boolean allAbiltiesCombo(ICharm charm1, ICharm charm2) { return charm1.getComboRules().combosAllAbilities() && hasAbilityPrerequisite(charm2); }
public boolean isAlienCharm(ICharm charm) { return !MartialArtsUtilities.isMartialArtsCharm(charm) && isAlienType(charm.getCharacterType()); }
@Override public final boolean isCompulsiveCharm(ICharm charm) { String[] compulsiveCharmIDs = context.getAdditionalRules().getCompulsiveCharmIDs(); return net.sf.anathema.lib.lang.ArrayUtilities.containsValue(compulsiveCharmIDs, charm.getId()); }
public final ILearningCharmGroup getGroup(ICharm charm) { return getGroupById(charm.getCharacterType(), charm.getGroupId()); }
private boolean hasAbilityPrerequisite(ICharm charm) { return charm.getPrimaryTraitType() instanceof AbilityType; }