MCPcopy Create free account
hub / github.com/PCGen/pcgen / testGetBonusSpellSplots

Method testGetBonusSpellSplots

code/src/test/pcgen/core/PCClassTest.java:553–632  ·  view source on GitHub ↗

Test if SPELLCAST bonus handles high stat bonus spells well @throws PersistenceLayerException the persistence layer exception

()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

getContextMethod · 0.95
setFactMethod · 0.95
getOriginalClassLevelMethod · 0.95
getReferenceContextMethod · 0.95
incrementClassLevelMethod · 0.95
getClassKeyedMethod · 0.95
getDefaultSpellBookMethod · 0.95
parseLineMethod · 0.95
setCDOMCategoryMethod · 0.95
getFeatCatMethod · 0.95
applyAbilityMethod · 0.95

Tested by

no test coverage detected