Пример #1
0
 static void lootCollision() {
   if (standingOnLoot(MadSand.x, MadSand.y)) {
     addLootToInv(MadSand.x, MadSand.y);
     removeLoot(MadSand.x, MadSand.y);
     MadSand.print("You picked some things up");
   }
 }
Пример #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;
 }