Test the function of adding a bonus each time an associated value is chosen.
()
| 162 | * Test the function of adding a bonus each time an associated value is chosen. |
| 163 | */ |
| 164 | @Test |
| 165 | public void testAssociatedBonus() |
| 166 | { |
| 167 | Ability pObj = new Ability(); |
| 168 | pObj.setCDOMCategory(BuildUtilities.getFeatCat()); |
| 169 | pObj.setName("My PObject"); |
| 170 | pObj.setCDOMCategory(BuildUtilities.getFeatCat()); |
| 171 | Globals.getContext().unconditionallyProcess(pObj, "CHOOSE", "LANG|ALL"); |
| 172 | Globals.getContext().unconditionallyProcess(pObj, "MULT", "YES"); |
| 173 | Globals.getContext().unconditionallyProcess(pObj, "STACK", "YES"); |
| 174 | Globals.getContext().getReferenceContext().constructCDOMObject(Language.class, "TestPsion 1"); |
| 175 | |
| 176 | PlayerCharacter aPC = getCharacter(); |
| 177 | CNAbility cna = AbstractCharacterTestCase.applyAbility(aPC, |
| 178 | BuildUtilities.getFeatCat(), pObj, "TestPsion 1"); |
| 179 | pObj = cna.getAbility(); |
| 180 | BonusAddition.applyBonus("SPELLKNOWN|CLASS=TestPsion;LEVEL=1|1", "TestPsion 1", |
| 181 | aPC, pObj); |
| 182 | aPC.calcActiveBonuses(); |
| 183 | assertEquals("Should get 1 bonus known spells", 1, (int) aPC |
| 184 | .getTotalBonusTo("SPELLKNOWN", "CLASS.TestPsion;LEVEL.1")); |
| 185 | AbstractCharacterTestCase.applyAbility(aPC, BuildUtilities.getFeatCat(), pObj, "TestPsion 1"); |
| 186 | BonusAddition.applyBonus("SPELLKNOWN|CLASS=TestPsion;LEVEL=1|1", "TestPsion 1", |
| 187 | aPC, pObj); |
| 188 | aPC.calcActiveBonuses(); |
| 189 | assertEquals("Should get 4 bonus known spells", (2 * 2), (int) aPC |
| 190 | .getTotalBonusTo("SPELLKNOWN", "CLASS.TestPsion;LEVEL.1")); |
| 191 | AbstractCharacterTestCase.applyAbility(aPC, BuildUtilities.getFeatCat(), pObj, "TestPsion 1"); |
| 192 | BonusAddition.applyBonus("SPELLKNOWN|CLASS=TestPsion;LEVEL=1|1", "TestPsion 1", |
| 193 | aPC, pObj); |
| 194 | aPC.calcActiveBonuses(); |
| 195 | assertEquals("Should get 9 bonus known spells", (3 * 3), (int) aPC |
| 196 | .getTotalBonusTo("SPELLKNOWN", "CLASS.TestPsion;LEVEL.1")); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Test the function of adding an ability multiple times which has |
nothing calls this directly
no test coverage detected