Exemplo n.º 1
0
  /** A Wizard with a smattering of problems */
  protected static CharacterWrapper _testScenario1(GameData data) {
    GameObject character = data.getGameObjectByName("Wizard");
    GameObject f1 = data.getGameObjectByName("Test Fly Chit 1");
    character.add(f1);
    System.out.println(character);

    CharacterWrapper wrapper = new CharacterWrapper(character);
    wrapper.setCharacterLevel(4);
    wrapper.initChits();

    // artifically fatigue and wound some chits
    ArrayList list = new ArrayList(wrapper.getAllChits());
    Collections.sort(list);
    int n = 0;
    for (Iterator i = list.iterator(); i.hasNext(); ) {
      CharacterActionChitComponent aChit = (CharacterActionChitComponent) i.next();
      System.out.println((n++) + " " + aChit.getGameObject().getName());
    }

    CharacterActionChitComponent aChit = (CharacterActionChitComponent) list.get(1);
    aChit.getGameObject().setThisAttribute("action", "FLY");
    aChit.getGameObject().setThisAttribute("effort", "1");

    //		aChit.makeFatigued();
    //		for (int i=4;i<11;i++) {
    //			aChit = (CharacterActionChitComponent)list.get(i);
    //			aChit.makeWounded();
    //		}
    aChit = (CharacterActionChitComponent) list.get(11);
    aChit.enchant();
    //		(new Curse(new JFrame())).applyThree(wrapper);
    return wrapper;
  }
Exemplo n.º 2
0
 private int getMoveModifier() {
   int mod = 0;
   GameObject go = getGameObject().getHeldBy();
   if (go != null && go.hasThisAttribute(CHARACTER)) {
     CharacterWrapper character = new CharacterWrapper(go);
     ArrayList<GameObject> list =
         character.getAllActiveInventoryThisKeyAndValue(Constants.HORSE_MOD, null);
     for (GameObject item : list) {
       mod +=
           item.getThisInt(
               Constants.HORSE_MOD); // cumulative... though there's really only the Horse Trainer
       // (Traveler) at this time
     }
   }
   alteredMoveSpeed = mod != 0;
   return mod;
 }
Exemplo n.º 3
0
 public SteedChitComponent(GameObject obj) {
   super(obj);
   try {
     lightColor = MagicRealmColor.getColor(getAttribute("trot", "chit_color"));
     darkColor = MagicRealmColor.getColor(getAttribute("gallop", "chit_color"));
   } catch (Exception ex) {
     System.out.println("problem with " + obj.getName() + ": " + ex);
   }
 }
Exemplo n.º 4
0
 public static SpellMasterWrapper getSpellMaster(GameData data) {
   // System.out.println("MASTER_ID = "+MASTER_ID+", dataid = "+data.dataid);
   if (MASTER_ID == null) {
     // System.out.println(data.toIdentifier()+": MASTER_ID is null");
     GamePool pool = new GamePool(data.getGameObjects());
     ArrayList list = pool.find(SPELL_MASTER_KEY);
     GameObject gm = null;
     if (list != null && list.size() == 1) {
       gm = (GameObject) list.iterator().next();
       // System.out.println(data.toIdentifier()+": Found a SpellMaster!");
     }
     if (gm == null) {
       gm = data.createNewObject();
       gm.setName(SPELL_MASTER_KEY);
       gm.setThisAttribute(SPELL_MASTER_KEY);
       // System.out.println(data.toIdentifier()+": Creating a new SpellMaster!");
     }
     MASTER_ID = new Long(gm.getId());
     return new SpellMasterWrapper(gm);
   } else {
     return new SpellMasterWrapper(data.getGameObject(MASTER_ID));
   }
 }
 public Object getValueAt(int row, int col) {
   if (row < data.size()) {
     GameObject obj = (GameObject) data.get(row);
     switch (col) {
       case 0:
         return new Long(obj.getId());
       case 1:
         return obj.getName();
       case 2:
         GameObject hb = obj.getHeldBy();
         return hb == null ? "" : hb.toString();
       case 3:
         return new Integer(obj.getHoldCount());
       default:
         throw new IllegalArgumentException("Invalid column index");
     }
   }
   return null;
 }