Package games.stendhal.server.entity.spell

Examples of games.stendhal.server.entity.spell.Spell


    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));
    assertThat(entity.getAmount(),is(Integer.valueOf(100)));
    assertThat(entity.getAtk(),is(Integer.valueOf(0)));
    assertThat(entity.getCooldown(),is(Integer.valueOf(3)));
    assertThat(entity.getDef(),is(Integer.valueOf(0)));
    assertThat(entity.getLifesteal(),is(Double.valueOf(0.5)));
    assertThat(entity.getMana(),is(Integer.valueOf(5)));
    assertThat(entity.getMinimumLevel(),is(Integer.valueOf(0)));
    assertThat(entity.getRange(),is(Integer.valueOf(10)));
    assertThat(entity.getRate(),is(Integer.valueOf(1)));
    assertThat(entity.getRegen(),is(Integer.valueOf(100)));
    assertThat(entity.getClass().getName(), is("games.stendhal.server.entity.spell.HealingSpell"));
    entity.setID(new ID(1, "some_zone"))
    RPObject object = new SpellTransformer().transform(entity);
    assertThat(object, is((RPObject)entity));
  }
View Full Code Here


      // clear the slot
      slot.clear();
      SpellTransformer transformer = new SpellTransformer();
      //transform rpobjects in slot to spell
      for(RPObject o : objects) {
        Spell s = (Spell) transformer.transform(o);
        //only add to slot if transforming was successful
        if(s != null) {
          slot.add(s);
        }
      }
View Full Code Here

    if(spell == null) {
      throw new IllegalArgumentException("spell name is null");
    }
    DefaultSpell defaultSpell = nameToSpell.get(spell);
    if (defaultSpell != null) {
      Spell spellEntity = defaultSpell.getSpell();
      if(!createdSpell.containsKey(spell)) {
        createdSpell.put(spell, spellEntity);
      }
      return spellEntity;
    }
View Full Code Here

* @author madmetzger
*/
public class SpellTransformer implements Transformer {

  public RPObject transform(RPObject object) {
    Spell spell = SingletonRepository.getEntityManager().getSpell(object.get("subclass"));
    if(spell != null) {
      //preserve the id of the transformed spell
      spell.setID(object.getID());
    }
    return spell;
  }
View Full Code Here

  public void onAction(Player player, RPAction action) {
    //base object is always the player sending the action
    action.put("baseobject", player.getID().getObjectID());
    Entity target = EntityHelper.entityFromTargetName(action.get(TARGET), player);
    Spell spell = (Spell) EntityHelper.entityFromSlot(player, action);
    spell.cast(player, target);
  }
View Full Code Here

    if(args.size() != 2) {
      admin.sendPrivateText("Usage: [character] [spell name].");
      return;
    }
    EntityManager em = SingletonRepository.getEntityManager();
    Spell spell = em.getSpell(args.get(1));
    String name = args.get(0);
    Player player = SingletonRepository.getRuleProcessor().getPlayer(name);
    RPSlot slot = player.getSlot("spells");
    ID id = null;
    for(RPObject o : slot) {
      if(spell.getName().equalsIgnoreCase(o.get("name"))) {
        id = o.getID();
      }
    }
    if (id != null) {
      slot.remove(id);
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.spell.Spell

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.