Ejemplo n.º 1
0
 public static int addLootToInv(int x, int y) {
   int i = 1;
   String temp;
   temp = lootLayer[x][y][MadSand.curxwpos][MadSand.curywpos];
   String[] block = temp.split(":");
   String[] attr = {};
   while (i < block.length) {
     attr = block[i].split("/");
     InvUtils.putItem(Integer.parseInt(attr[0]), Integer.parseInt(attr[1]));
     i++;
   }
   return Integer.parseInt(attr[0]);
 }
Ejemplo n.º 2
0
 public static boolean interact(int x, int y, String direction) {
   boolean ret = false;
   if (isCollision(x, y, direction)) {
     MadSand.turn++;
     MadSand.exp += 3;
     if (getBlock(x, y, direction) == 5) {
       QuestUtils.invokeQuest(0);
     }
     if (getBlock(x, y, direction) == 2) {
       Random random = new Random();
       if (MadSand.hand == 3) {
         MadSand.print("You hit a tree with the axe");
         InvUtils.putItem(1, random.nextInt(3) + 1);
       } else {
         MadSand.print("You got some sticks from tree");
         InvUtils.putItem(8, random.nextInt(4) + 1);
       }
       dmgObj(x, y, direction);
     }
     if (getBlock(x, y, direction) == 3) {
       MadSand.print("Cake is a lie... or not");
       InvUtils.putItem(4, 1);
       delObject(MadSand.x, MadSand.y, MadSand.look);
     }
     if (getBlock(x, y, direction) == 1) {
       Random random = new Random();
       MadSand.print("You tried to pick up a small rock");
       if (random.nextInt(2) == 1) {
         int picked = random.nextInt(3) + 1;
         InvUtils.putItem(2, picked);
         MadSand.print("You picked up " + picked + " rocks");
       } else {
         MadSand.print("You failed to pick up a rock.");
       }
       dmgObj(x, y, direction);
     }
     if (getBlock(x, y, direction) == 4) {
       Random random = new Random();
       MadSand.print("You picked some berries from a bush");
       InvUtils.putItem(7, 1);
       InvUtils.putItem(8, random.nextInt(2) + 1);
       dmgObj(x, y, direction);
     }
   }
   return ret;
 }