Returns DC for a spell and SpellInfo. @param sp the spell @param cs TODO @param si the spell info @return DC for a spell and SpellInfo
(final Spell sp, CharacterSpell cs, final SpellInfo si)
| 8186 | * @return DC for a spell and SpellInfo |
| 8187 | */ |
| 8188 | public int getDC(final Spell sp, CharacterSpell cs, final SpellInfo si) |
| 8189 | { |
| 8190 | CDOMObject ow; |
| 8191 | int spellLevel; |
| 8192 | int metaDC = 0; |
| 8193 | |
| 8194 | spellLevel = si.getActualLevel(); |
| 8195 | ow = cs.getOwner(); |
| 8196 | |
| 8197 | String fixedDC = si.getFixedDC(); |
| 8198 | // TODO Temp fix for 1223858, better fix would be to move fixedDC to |
| 8199 | // spellInfo |
| 8200 | /* |
| 8201 | * TODO Need to evaluate how duplicative this logic is and what is |
| 8202 | * really necessary |
| 8203 | */ |
| 8204 | if (fixedDC != null && "INNATE".equalsIgnoreCase(si.getBook())) |
| 8205 | { |
| 8206 | return getVariableValue(fixedDC, "").intValue(); |
| 8207 | } |
| 8208 | |
| 8209 | // Check for a non class based fixed DC |
| 8210 | if (fixedDC != null && ow != null && !(ow instanceof PCClass)) |
| 8211 | { |
| 8212 | return getVariableValue(fixedDC, "").intValue(); |
| 8213 | } |
| 8214 | |
| 8215 | if (si.getFeatList() != null) |
| 8216 | { |
| 8217 | for (Ability metaFeat : si.getFeatList()) |
| 8218 | { |
| 8219 | spellLevel -= metaFeat.getSafe(IntegerKey.ADD_SPELL_LEVEL); |
| 8220 | metaDC = (int) (metaDC + BonusCalc.charBonusTo(metaFeat, "DC", "FEATBONUS", this)); |
| 8221 | } |
| 8222 | } |
| 8223 | |
| 8224 | return getDC(sp, null, spellLevel, metaDC, ow); |
| 8225 | } |
| 8226 | |
| 8227 | public int getDC(final Spell sp, PCClass aClass, int spellLevel, int metaDC, CDOMObject ow) |
| 8228 | { |
no test coverage detected