Ejemplo n.º 1
0
 @Test
 public void testDefaultFreePicksPredicate() throws Exception {
   Element templateElement = DocumentUtilities.read(xml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   assertTrue(
       template.canBuyFromFreePicks(
           DummyCharmUtilities.createCharm("TestCharm", "Group"))); // $NON-NLS-1$ //$NON-NLS-2$
 }
Ejemplo n.º 2
0
 @Test
 public void testMortalCharmTemplate() throws Exception {
   Element templateElement = DocumentUtilities.read(xml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   ICharmTemplate charmTemplate = template.getCharmTemplate();
   assertEquals(MartialArtsLevel.Mortal, charmTemplate.getMartialArtsRules().getStandardLevel());
   assertFalse(charmTemplate.canLearnCharms());
 }
Ejemplo n.º 3
0
 @Test
 public void testFavoringTraitTypeModified() throws Exception {
   String typeXml =
       "<magicTemplate>" //$NON-NLS-1$
           + "<freePicksPredicate type=\"Default\"/>" //$NON-NLS-1$
           + "<favoringTraitType type =\"AttributeType\"/>" //$NON-NLS-1$
           + "</magicTemplate>"; //$NON-NLS-1$
   Element templateElement = DocumentUtilities.read(typeXml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   assertEquals(FavoringTraitType.AttributeType, template.getFavoringTraitType());
 }
Ejemplo n.º 4
0
 @Test
 public void picksUpMartialArtsRules() throws Exception {
   String celestialXml =
       "<magicTemplate>"
           + //$NON-NLS-1$
           "<charmTemplate charmType=\"None\" ><martialArts rulesClass=\"net.sf.anathema.character.generic.dummy.magic.DummyMartialArtsRules\" level=\"Terrestrial\" /></charmTemplate>" //$NON-NLS-1$
           + "</magicTemplate>"; //$NON-NLS-1$
   Element templateElement = DocumentUtilities.read(celestialXml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   Assert.assertTrue(
       template.getCharmTemplate().getMartialArtsRules() instanceof DummyMartialArtsRules);
 }
Ejemplo n.º 5
0
 @Test
 public void testDefaultRulesSetting() throws Exception {
   String celestialXml =
       "<magicTemplate>"
           + //$NON-NLS-1$
           "<charmTemplate charmType=\"None\" ><martialArts level=\"Terrestrial\" /></charmTemplate>" //$NON-NLS-1$
           + "</magicTemplate>"; //$NON-NLS-1$
   Element templateElement = DocumentUtilities.read(celestialXml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   Assert.assertTrue(
       template.getCharmTemplate().getMartialArtsRules() instanceof DefaultMartialArtsRules);
 }
Ejemplo n.º 6
0
 @Test
 public void testFalseFreePicksPredicate() throws Exception {
   String customXml =
       "<magicTemplate>" //$NON-NLS-1$
           + "<freePicksPredicate defaultResponse=\"false\"/>" //$NON-NLS-1$
           + "<charmTemplate charmType=\"None\">" //$NON-NLS-1$
           + "<martialArts level=\"Mortal\"/></charmTemplate>" //$NON-NLS-1$
           + "<spellTemplate maximumSorceryCircle=\"None\" maximumNecromancyCircle=\"None\"/>" //$NON-NLS-1$
           + "</magicTemplate>"; //$NON-NLS-1$
   Element templateElement = DocumentUtilities.read(customXml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   assertFalse(
       template.canBuyFromFreePicks(
           DummyCharmUtilities.createCharm("TestCharm", "Group"))); // $NON-NLS-1$ //$NON-NLS-2$
 }
Ejemplo n.º 7
0
 @Test
 public void testAlienCharmsAllowed() throws Exception {
   String typeXml =
       "<magicTemplate>" //$NON-NLS-1$
           + "<charmTemplate charmType=\"None\">" //$NON-NLS-1$
           + " <alienCharms> <caste type=\"DummyCaste\"/></alienCharms>" //$NON-NLS-1$
           + "<martialArts level=\"Celestial\" highLevel=\"false\" />" //$NON-NLS-1$
           + "</charmTemplate>" //$NON-NLS-1$
           + "</magicTemplate>"; //$NON-NLS-1$
   Element templateElement = DocumentUtilities.read(typeXml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   assertTrue(
       template
           .getCharmTemplate()
           .isAllowedAlienCharms(new DummyCasteType("DummyCaste"))); // $NON-NLS-1$
 }
Ejemplo n.º 8
0
 @Test
 public void testParsesMaximumNecromancyCircle() throws Exception {
   String celestialXml =
       "<magicTemplate>"
           + //$NON-NLS-1$
           "<spellTemplate maximumSorceryCircle=\"Solar\" maximumNecromancyCircle=\"Labyrinth\"/>" //$NON-NLS-1$
           + "</magicTemplate>"; //$NON-NLS-1$
   Element templateElement = DocumentUtilities.read(celestialXml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   assertTrue(
       net.sf.anathema.lib.lang.ArrayUtilities.containsValue(
           template.getSpellMagic().getNecromancyCircles(), CircleType.Shadowlands));
   assertTrue(
       net.sf.anathema.lib.lang.ArrayUtilities.containsValue(
           template.getSpellMagic().getNecromancyCircles(), CircleType.Labyrinth));
   assertFalse(
       net.sf.anathema.lib.lang.ArrayUtilities.containsValue(
           template.getSpellMagic().getNecromancyCircles(), CircleType.Void));
 }
Ejemplo n.º 9
0
 @Test
 public void testHighLevelSettingModified() throws Exception {
   String celestialXml =
       "<magicTemplate>"
           + //$NON-NLS-1$
           "<charmTemplate charmType=\"None\" ><martialArts level=\"Terrestrial\" highLevel=\"true\"/></charmTemplate>" //$NON-NLS-1$
           + "</magicTemplate>"; //$NON-NLS-1$
   Element templateElement = DocumentUtilities.read(celestialXml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   DummyCharm dummyMartialArtsCharm = new DummyCharm("Dummy") { // $NON-NLS-1$
         @Override
         public boolean hasAttribute(Identified attribute) {
           return attribute.getId().equals("MartialArts")
               || attribute.getId().equals("Celestial"); // $NON-NLS-1$ //$NON-NLS-2$
         }
       };
   assertTrue(
       template
           .getCharmTemplate()
           .getMartialArtsRules()
           .isCharmAllowed(dummyMartialArtsCharm, null, false));
 }
Ejemplo n.º 10
0
 @Test
 public void testFavoringTraitTypeUnmodified() throws Exception {
   Element templateElement = DocumentUtilities.read(xml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   assertEquals(FavoringTraitType.AbilityType, template.getFavoringTraitType());
 }
Ejemplo n.º 11
0
 @Test
 public void testMortalSpellTemplate() throws Exception {
   Element templateElement = DocumentUtilities.read(xml).getRootElement();
   GenericMagicTemplate template = parser.parseTemplate(templateElement);
   assertFalse(template.getSpellMagic().canLearnSpellMagic());
 }