Package games.stendhal.server.core.rule.defaultruleset

Examples of games.stendhal.server.core.rule.defaultruleset.DefaultSpell


  @Test
  public void testLoad() throws URISyntaxException, SAXException, IOException {
    SpellGroupsXMLLoader loader = new SpellGroupsXMLLoader(new URI("testspells.xml"));
    List<DefaultSpell> list = loader.load();
    assertThat(Boolean.valueOf(list.isEmpty()), is(Boolean.FALSE));
    DefaultSpell spell = list.get(0);
    assertThat(spell.getName(), is("heal"));
    assertThat(spell.getNature(), is(Nature.LIGHT));
    assertThat(spell.getImplementationClass(), notNullValue());
    assertThat(spell.getImplementationClass().getName(), is("games.stendhal.server.entity.spell.HealingSpell"));
    assertThat(spell.getAmount(),is(Integer.valueOf(100)));
    assertThat(spell.getAtk(),is(Integer.valueOf(0)));
    assertThat(spell.getCooldown(),is(Integer.valueOf(3)));
    assertThat(spell.getDef(),is(Integer.valueOf(0)));
    assertThat(spell.getLifesteal(),is(Double.valueOf(0.5)));
    assertThat(spell.getMana(),is(Integer.valueOf(5)));
    assertThat(spell.getMinimumLevel(),is(Integer.valueOf(0)));
    assertThat(spell.getRange(),is(Integer.valueOf(10)));
    assertThat(spell.getRate(),is(Integer.valueOf(1)));
    assertThat(spell.getRegen(),is(Integer.valueOf(100)));
    SingletonRepository.getEntityManager().addSpell(spell);
    Spell entity = SingletonRepository.getEntityManager().getSpell("heal");
    assertThat(entity, notNullValue());
    assertThat(entity.getName(), is("heal"));
    assertThat(entity.getNature(), is(Nature.LIGHT));
View Full Code Here


  @Override
  public void endElement(String uri, String localName, String qName)
      throws SAXException {
    if(qName.equals("spell")) {
      DefaultSpell spell = new DefaultSpell(name, implementation);
      spell.setNature(nature);
      spell.setAmount(attributeValues.get("amount"));
      spell.setAtk(attributeValues.get("atk"));
      spell.setCooldown(attributeValues.get("cooldown"));
      spell.setDef(attributeValues.get("def"));
      spell.setLifesteal(attributeValues.get("lifesteal"));
      spell.setMana(attributeValues.get("mana"));
      spell.setMinimumLevel(attributeValues.get("minimum-level"));
      spell.setRange(attributeValues.get("range"));
      spell.setRate(attributeValues.get("rate"));
      spell.setRegen(attributeValues.get("regen"));
      loadedSpells.add(spell);
    }
    if(qName.equals("attributes")) {
      attributeTagFound = false;
    }
View Full Code Here

TOP

Related Classes of games.stendhal.server.core.rule.defaultruleset.DefaultSpell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.