Test if SPELLCAST bonus handles high stat bonus spells well @throws PersistenceLayerException the persistence layer exception
()
| 551 | * @throws PersistenceLayerException the persistence layer exception |
| 552 | */ |
| 553 | @Test |
| 554 | void testGetBonusSpellSplots() throws PersistenceLayerException |
| 555 | { |
| 556 | LoadContext context = Globals.getContext(); |
| 557 | PCClass megaCasterClass = new PCClass(); |
| 558 | megaCasterClass.setName("MegaCaster"); |
| 559 | BuildUtilities.setFact(megaCasterClass, "SpellType", "Arcane"); |
| 560 | context.unconditionallyProcess(megaCasterClass, "SPELLSTAT", "CHA"); |
| 561 | megaCasterClass.put(ObjectKey.SPELLBOOK, false); |
| 562 | megaCasterClass.put(ObjectKey.MEMORIZE_SPELLS, false); |
| 563 | context.unconditionallyProcess(megaCasterClass.getOriginalClassLevel(1), "KNOWN", "4,2,2,3,4,5"); |
| 564 | context.unconditionallyProcess(megaCasterClass.getOriginalClassLevel(1), "CAST", "3,1,2,3,4,5"); |
| 565 | context.unconditionallyProcess(megaCasterClass.getOriginalClassLevel(2), "KNOWN", "4,2,2,3,4,5,6,7,8,9,10"); |
| 566 | context.unconditionallyProcess(megaCasterClass.getOriginalClassLevel(2), "CAST", "3,1,2,3,4,5,6,7,8,9,10"); |
| 567 | Globals.getContext().getReferenceContext().importObject(megaCasterClass); |
| 568 | |
| 569 | finishLoad(); |
| 570 | |
| 571 | PlayerCharacter character = getCharacter(); |
| 572 | |
| 573 | character.incrementClassLevel(1, megaCasterClass); |
| 574 | PCClass charClass = |
| 575 | character.getClassKeyed(megaCasterClass.getKeyName()); |
| 576 | |
| 577 | String sbook = Globals.getDefaultSpellBook(); |
| 578 | |
| 579 | Ability casterFeat = new Ability(); |
| 580 | FeatLoader featLoader = new FeatLoader(); |
| 581 | CampaignSourceEntry source; |
| 582 | try |
| 583 | { |
| 584 | source = new CampaignSourceEntry(new Campaign(), |
| 585 | new URI("file:/" + getClass().getName() + ".java")); |
| 586 | } |
| 587 | catch (URISyntaxException e) |
| 588 | { |
| 589 | throw new UnreachableError(e); |
| 590 | } |
| 591 | featLoader |
| 592 | .parseLine( |
| 593 | Globals.getContext(), |
| 594 | casterFeat, |
| 595 | "CasterBoost TYPE:General BONUS:SPELLCAST|CLASS=MegaCaster;LEVEL=11|1", source); |
| 596 | casterFeat.setCDOMCategory(BuildUtilities.getFeatCat()); |
| 597 | context.getReferenceContext().importObject(casterFeat); |
| 598 | |
| 599 | AbstractCharacterTestCase.applyAbility(character, BuildUtilities.getFeatCat(), casterFeat, null); |
| 600 | String cast = |
| 601 | character.getSpellSupport(charClass).getCastForLevel(11, sbook, true, false, character) |
| 602 | + character.getSpellSupport(charClass).getBonusCastForLevelString(11, sbook, character); |
| 603 | assertEquals("1", |
| 604 | cast, "Should be able to cast 11th level spells with feat" |
| 605 | ); |
| 606 | assertEquals(11, |
| 607 | character.getSpellSupport(charClass).getHighestLevelSpell(character), |
| 608 | "Should be able to cast 11th level spells with feat" |
| 609 | ); |
| 610 |
nothing calls this directly
no test coverage detected