Search in sources :

Example 76 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class ExportHandlerTest method testWpnLoop.

/**
	 * Test the behaviour of the weapon loop
	 * @throws IOException
	 */
public void testWpnLoop() throws IOException {
    PlayerCharacter character = getCharacter();
    // Test each token for old and new syntax processing.
    assertEquals("New format SKILL Token", "****", evaluateToken("FOR.0,100,1,**\\WEAPON.%.NAME\\**,NONE,NONE,1", character));
    // Now assign a weapon
    character.addEquipment(weapon);
    EquipSet es = new EquipSet("1", "Default", "", weapon);
    character.addEquipSet(es);
    assertEquals("New format SKILL Token", "**TestWpn**", evaluateToken("FOR.0,100,1,**\\WEAPON.%.NAME\\**,NONE,NONE,1", character));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) EquipSet(pcgen.core.character.EquipSet)

Example 77 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class ExportHandlerTest method testEqtypeLoop.

/**
	 * Test the export of equipment using the eqtype token in a loop.
	 * 
	 * @throws Exception
	 */
public void testEqtypeLoop() throws Exception {
    PlayerCharacter character = getCharacter();
    final String gemLoop = "FOR.0,COUNT[EQTYPE.Gem],1,\\EQTYPE.Gem.%.NAME\\: \\EQTYPE.Gem.%.QTY\\, ,<br/>,1";
    assertEquals("Gem Loop - no gems", "", evaluateToken(gemLoop, character));
    // Now assign a gem
    character.addEquipment(gem);
    EquipSet es = new EquipSet("1", "Default", "", gem);
    character.addEquipSet(es);
    character.setDirty(true);
    assertEquals("Gem loop - 1 gem", " TestGem: 1<br/>", evaluateToken(gemLoop, character));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) EquipSet(pcgen.core.character.EquipSet)

Example 78 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class ExportHandlerTest method testJepIif.

public void testJepIif() throws IOException {
    PlayerCharacter character = getCharacter();
    assertEquals("Basic JEP boolean", new Float(1.0), character.getVariableValue("max(0,2)==2", ""));
    assertEquals("JEP boolean in IF", "true", evaluateToken("OIF(max(0,2)==2,true,false)", character));
//		assertEquals("JEP boolean in IF", "true", evaluateToken(
//			"|OIF(max(0,2)==2)|\ntrue\n|ELSE|\nfalse\n|ENDIF|", character));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter)

Example 79 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class ExportHandlerTest method testForNoMoreItems.

public void testForNoMoreItems() throws IOException {
    PlayerCharacter pc = getCharacter();
    assertEquals("Test for evaluates correctly", "SF", evaluateToken("FOR.0,100,1,\\ARMOR.SUIT.ALL.%.NAME\\,S,F,1", pc));
    // Now assign a gem
    pc.addEquipment(armor);
    EquipSet es = new EquipSet("1", "Default", "", armor);
    pc.addEquipSet(es);
    assertEquals("Test for evaluates correctly", "STestArmorSuitFSF", evaluateToken("FOR.0,100,1,\\ARMOR.SUIT.ALL.%.NAME\\,S,F,1", pc));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) EquipSet(pcgen.core.character.EquipSet)

Example 80 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class TextTokenTest method testTextFormatting.

/**
	 * Test the output for positive numbers with fractions.
	 */
public void testTextFormatting() {
    TextToken tok = new TextToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("TEXT.LOWER.NAME", "the vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.LOWER.NAME", character, eh));
    assertEquals("TEXT.UPPER.NAME", "THE VITAMINS ARE IN MY FRESH BRUSSELS SPROUTS", tok.getToken("TEXT.UPPER.NAME", character, eh));
    assertEquals("TEXT.SENTENCE.NAME", "The vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.SENTENCE.NAME", character, eh));
    assertEquals("TEXT.SENTENCE.NAME", "The vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.SENTENCE.NAME", character, eh));
    character.setPCAttribute(PCAttribute.NAME, "The Vitamins are in my Fresh Brussels Sprouts");
    assertEquals("TEXT.SENTENCE.INTERESTS", "One potatoe. Two potatoe. More", tok.getToken("TEXT.SENTENCE.INTERESTS", character, eh));
    assertEquals("TEXT.TITLE.NAME", "The Vitamins Are In My Fresh Brussels Sprouts", tok.getToken("TEXT.TITLE.NAME", getCharacter(), eh));
    assertEquals("TEXT.TITLE.NAME", "One Potatoe. Two Potatoe. More", tok.getToken("TEXT.TITLE.INTERESTS", character, eh));
}
Also used : TextToken(plugin.exporttokens.TextToken) PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Aggregations

PlayerCharacter (pcgen.core.PlayerCharacter)438 PreParserFactory (pcgen.persistence.lst.prereq.PreParserFactory)89 PCClass (pcgen.core.PCClass)61 LoadContext (pcgen.rules.context.LoadContext)58 Ability (pcgen.core.Ability)54 Equipment (pcgen.core.Equipment)41 PCTemplate (pcgen.core.PCTemplate)38 EquipSet (pcgen.core.character.EquipSet)32 BonusObj (pcgen.core.bonus.BonusObj)29 Race (pcgen.core.Race)28 CharID (pcgen.cdom.enumeration.CharID)25 ExportHandler (pcgen.io.ExportHandler)24 Test (org.junit.Test)20 ArrayList (java.util.ArrayList)16 PreClassTester (plugin.pretokens.test.PreClassTester)16 CDOMObject (pcgen.cdom.base.CDOMObject)15 Skill (pcgen.core.Skill)14 CNAbility (pcgen.cdom.content.CNAbility)13 URI (java.net.URI)11 URISyntaxException (java.net.URISyntaxException)11