Examples of Cat


Examples of games.stendhal.server.entity.creature.Cat

        found(type, entity);
      } else if ("cat".equals(type)) {
        if (player.hasPet()) {
          error("You already own a pet!");
        } else {
          final Cat cat = new Cat(player);
          found(type, cat);
        }
      } else if ("baby dragon".equals(type)) {
        if (player.hasPet()) {
          error("You already own a pet!");
View Full Code Here

Examples of games.stendhal.server.entity.creature.Cat

        slot.remove(object.getID());

        player.removeSlot("#pets");

        if (object.get("type").equals("cat")) {
          return new Cat(object, player);
        } else if (object.get("type").equals("baby_dragon")) {
          return new BabyDragon(object, player);
        }
      }
    }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Cat

    assertEquals(0.2, (new SpeakerNPC("bob")).getBaseSpeed(), 0.001);
    assertEquals(0.0, (new Creature()).getBaseSpeed(), 0.001);
    assertEquals(1.0, (PlayerTestHelper.createPlayer("player")).getBaseSpeed(),
        0.001);
    assertEquals(0.9, (new Cat()).getBaseSpeed(), 0.001);
    assertEquals(0.25, (new Sheep()).getBaseSpeed(), 0.001);

  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Cat

                seller.say("You don't seem to have enough money.");
                return false;
              }
              seller.say("Here you go, a cute little kitten! Your kitten will eat any piece of chicken or fish you place on the ground. Enjoy her!");

              final Cat cat = new Cat(player);
             
              Entity sellerEntity = seller.getEntity();
              cat.setPosition(sellerEntity.getX(), sellerEntity.getY() + 1);

              player.setPet(cat);
              player.notifyWorldAboutChanges();

              return true;
            }
          }
        }

        final Map<String, Integer> items = new HashMap<String, Integer>();
        items.put("cat", BUYING_PRICE);

        addGreeting();
        addJob("I sell cats. Well, really they are just little kittens when I sell them to you but if you #care for them well they grow into cats.");
        addHelp("I sell cats. To buy one, just tell me you want to #buy #cat. If you're new to this business, I can tell you how to #travel with her and take #care of her. If you find any wild cat, incidentally, you can make them your #own.");
        addGoodbye();
        new SellerAdder().addSeller(this, new CatSellerBehaviour(items));
        addReply("care",
            "Cats love chicken and fish. Just place a piece on the ground and your cat will run over to eat it. You can right-click on her and choose 'Look' at any time, to check up on her weight; she will gain one unit of weight for every piece of chicken she eats.");
        addReply("travel",
            "You'll need your cat to be close by in order for her to follow you when you change zones; you can say #cat to call her if she's not paying attention. If you decide to abandon her instead, you can right-click on yourself and select 'Leave Pet'; but frankly I think that sort of behaviour is disgraceful.");
        addReply("sell",
            "Sell??? What kind of a monster are you? Why would you ever sell your beautiful cat?");
        addReply("own",
            "If you find any wild or abandoned cat, you can right-click on them and select 'Own' to tame them. It will start following you immediately. Cats go a bit crazy without an owner!");
      }
    };

    npc.setEntityClass("woman_009_npc");
    npc.setPosition(6, 8);
    npc.initHP(100);
    npc.setDescription("Felina is walking around while taking care of her kittens. They are purring out of all corners.");
    zone.add(npc);
   
    // Also put a cat in her bedroom (people can't Own it as it is behind a fence)
    final Cat hercat = new Cat();
                hercat.setPosition(19, 3);
                zone.add(hercat);

  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Cat

                seller.say("You don't seem to have enough money.");
                return false;
              }
              seller.say("Here you go, a cute little kitten! Your kitten will eat any piece of chicken or fish you place on the ground. Enjoy her!");

              final Cat cat = new Cat(player);
             
              Entity sellerEntity = seller.getEntity();
              cat.setPosition(sellerEntity.getX(), sellerEntity.getY() + 1);

              player.setPet(cat);
              player.notifyWorldAboutChanges();

              return true;
View Full Code Here

Examples of lesson07.objects.Cat

        }
        cats = storage.list(Cat.class);
        if (!cats.isEmpty()) throw new Exception("Cats should not be in database!");

        for(int i = 1; i <= 20; i++) {
            Cat cat = new Cat();
            cat.setName("cat" + i);
            cat.setAge(i);
            storage.save(cat);
        }

        cats = storage.list(Cat.class);
        if (cats.size() != 20) throw new Exception("Number of cats in storage should be 20!");
View Full Code Here

Examples of lesson7.objects.Cat

        }
        cats = storage.list(Cat.class);
        if (!cats.isEmpty()) throw new Exception("Cats should not be in database!");

        for(int i = 1; i <= 20; i++) {
            Cat cat = new Cat();
            cat.setName("cat" + i);
            cat.setAge(i);
            storage.save(cat);
        }

        cats = storage.list(Cat.class);
        if (cats.size() != 20) throw new Exception("Number of cats in storage should be 20!");
View Full Code Here

Examples of org.codehaus.enunciate.examples.c.schema.animals.Cat

    if (this.skipCTests) {
      System.out.println("C tests have been disabled.");
      return;
    }

    Cat cat = new Cat();
    Circle face = new Circle();
    face.setRadius(20);
    cat.setFace(face);
    Triangle ear = new Triangle();
    ear.setBase(5);
    ear.setHeight(10);
    ear.setId("earId");
    cat.setEars(Arrays.asList(ear, ear));

    // The eyes are the same as the ears, but so it needs to be for this test.
    cat.setEyes(new Triangle[] {ear, ear});

    Line noseLine = new Line();
    noseLine.setId("noseId");
    Line mouthLine = new Line();
    mouthLine.setId("mouthLine");

    cat.setNose(noseLine);
    cat.setMouth(mouthLine);
    cat.setWhiskers(Arrays.asList(noseLine, mouthLine));

    cat = processThroughXml(cat);

    face = cat.getFace();
    assertEquals(20, face.getRadius());
    assertEquals(2, cat.getEars().size());
    Triangle[] ears = cat.getEars().toArray(new Triangle[2]);
    assertSame("referential integrity should have been preserved (same object for ears)", ears[0], ears[1]);
    assertEquals(5, ears[0].getBase());
    assertEquals(10, ears[0].getHeight());
    assertEquals("earId", ears[0].getId());

    Triangle[] eyes = cat.getEyes();
    assertEquals(2, eyes.length);
    assertNotSame(eyes[0], eyes[1]);
    assertEquals(5, eyes[0].getBase());
    assertEquals(10, eyes[0].getHeight());
    assertEquals("earId", eyes[0].getId());
    assertEquals(5, eyes[1].getBase());
    assertEquals(10, eyes[1].getHeight());
    assertEquals("earId", eyes[1].getId());
    assertTrue("The ears should be the same object as one of the eyes (preserve referential integrity).", ears[0] == eyes[0] || ears[0] == eyes[1]);

    Line nose = cat.getNose();
    assertEquals("noseId", nose.getId());
    Line mouth = cat.getMouth();
    assertEquals("mouthLine", mouth.getId());
    assertTrue("The nose line should also be one of the whiskers (preserve referential integrity)", cat.getWhiskers().contains(nose));
    assertTrue("The mouth line should also be one of the whiskers (preserve referential integrity)", cat.getWhiskers().contains(mouth));

  }
View Full Code Here

Examples of org.codehaus.enunciate.examples.csharp.schema.animals.Cat

    if (this.skipCSharpTests) {
      System.out.println("CSharp tests have been disabled.");
      return;
    }

    Cat cat = new Cat();
    Circle face = new Circle();
    face.setRadius(20);
    cat.setFace(face);
    Triangle ear = new Triangle();
    ear.setBase(5);
    ear.setHeight(10);
    ear.setId("earId");
    cat.setEars(Arrays.asList(ear, ear));

    // The eyes are the same as the ears, but so it needs to be for this test.
    cat.setEyes(new Triangle[] {ear, ear});

    Line noseLine = new Line();
    noseLine.setId("noseId");
    Line mouthLine = new Line();
    mouthLine.setId("mouthLine");

    cat.setNose(noseLine);
    cat.setMouth(mouthLine);
    cat.setWhiskers(Arrays.asList(noseLine, mouthLine));

    cat = processThroughXml(cat);

    face = cat.getFace();
    assertEquals(20, face.getRadius());
    assertEquals(2, cat.getEars().size());
    Triangle[] ears = cat.getEars().toArray(new Triangle[2]);
    assertSame("referential integrity should have been preserved (same object for ears)", ears[0], ears[1]);
    assertEquals(5, ears[0].getBase());
    assertEquals(10, ears[0].getHeight());
    assertEquals("earId", ears[0].getId());

    Triangle[] eyes = cat.getEyes();
    assertEquals(2, eyes.length);
    assertNotSame(eyes[0], eyes[1]);
    assertEquals(5, eyes[0].getBase());
    assertEquals(10, eyes[0].getHeight());
    assertEquals("earId", eyes[0].getId());
    assertEquals(5, eyes[1].getBase());
    assertEquals(10, eyes[1].getHeight());
    assertEquals("earId", eyes[1].getId());
    assertTrue("The ears should be the same object as one of the eyes (preserve referential integrity).", ears[0] == eyes[0] || ears[0] == eyes[1]);

    Line nose = cat.getNose();
    assertEquals("noseId", nose.getId());
    Line mouth = cat.getMouth();
    assertEquals("mouthLine", mouth.getId());
    assertTrue("The nose line should also be one of the whiskers (preserve referential integrity)", cat.getWhiskers().contains(nose));
    assertTrue("The mouth line should also be one of the whiskers (preserve referential integrity)", cat.getWhiskers().contains(mouth));

  }
View Full Code Here

Examples of org.codehaus.enunciate.examples.jaxws_client.schema.animals.Cat

  /**
   * tests cat.  This one has IDREFs.
   */
  public void testCat() throws Exception {
    Cat cat = new Cat();
    Circle face = new Circle();
    face.setRadius(20);
    cat.setFace(face);
    Triangle ear = new Triangle();
    ear.setBase(5);
    ear.setHeight(10);
    ear.setId("earId");
    cat.setEars(Arrays.asList(ear, ear));

    // The eyes are the same as the ears, but so it needs to be for this test.
    cat.setEyes(new Triangle[] {ear, ear});

    Line noseLine = new Line();
    noseLine.setId("noseId");
    Line mouthLine = new Line();
    mouthLine.setId("mouthLine");

    cat.setNose(noseLine);
    cat.setMouth(mouthLine);
    cat.setWhiskers(Arrays.asList(noseLine, mouthLine));

    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    ObjectMapper catMapper = provider.locateMapper(Cat.class, MediaType.APPLICATION_JSON_TYPE);
    ObjectMapper clientMapper = new ObjectMapper();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    catMapper.writeValue(out, cat);
    shapes.json.animals.Cat clientCat = clientMapper.readValue(new ByteArrayInputStream(out.toByteArray()), shapes.json.animals.Cat.class);

    shapes.json.Circle clientFace = clientCat.getFace();
    assertEquals(20, clientFace.getRadius());
    assertEquals(2, clientCat.getEars().size());
    shapes.json.Triangle[] clientEars = (shapes.json.Triangle[]) clientCat.getEars().toArray(new shapes.json.Triangle[2]);
    assertNotSame("referential integrity should NOT have been preserved since Jackson doesn't support it yet", clientEars[0], clientEars[1]);
    assertEquals(5, clientEars[0].getBase());
    assertEquals(10, clientEars[0].getHeight());
    assertEquals("earId", clientEars[0].getId());
    assertEquals(5, clientEars[1].getBase());
    assertEquals(10, clientEars[1].getHeight());
    assertEquals("earId", clientEars[1].getId());

    shapes.json.Triangle[] clientEyes = clientCat.getEyes();
    assertEquals(2, clientEyes.length);
    assertNotSame(clientEyes[0], clientEyes[1]);
    assertEquals(5, clientEyes[0].getBase());
    assertEquals(10, clientEyes[0].getHeight());
    assertEquals("earId", clientEyes[0].getId());
    assertEquals(5, clientEyes[1].getBase());
    assertEquals(10, clientEyes[1].getHeight());
    assertEquals("earId", clientEyes[1].getId());
    assertFalse("The ears should NOT be the same object as one of the eyes since Jackson doesn't support referential integrity.", clientEars[0] == clientEyes[0] || clientEars[0] == clientEyes[1]);

    shapes.json.Line clientNose = clientCat.getNose();
    assertEquals("noseId", clientNose.getId());
    shapes.json.Line clientMouth = clientCat.getMouth();
    assertEquals("mouthLine", clientMouth.getId());
    assertFalse("The nose line should NOT also be one of the whiskers since Jackson doesn't support referential integrity.", clientCat.getWhiskers().contains(clientNose));
    assertFalse("The mouth line should NOT also be one of the whiskers since Jackson doesn't support referential integrity.", clientCat.getWhiskers().contains(clientMouth));

    out = new ByteArrayOutputStream();
    clientMapper.writeValue(out, clientCat);
    cat = catMapper.readValue(new ByteArrayInputStream(out.toByteArray()), Cat.class);

    face = cat.getFace();
    assertEquals(20, face.getRadius());
    assertEquals(2, cat.getEars().size());
    Triangle[] ears = cat.getEars().toArray(new Triangle[2]);
    assertNotSame("referential integrity should NOT have been preserved since Jackson doesn't support referential integrity.", ears[0], ears[1]);
    assertEquals(5, ears[0].getBase());
    assertEquals(10, ears[0].getHeight());
    assertEquals("earId", ears[0].getId());

    Triangle[] eyes = cat.getEyes();
    assertEquals(2, eyes.length);
    assertNotSame(eyes[0], eyes[1]);
    assertEquals(5, eyes[0].getBase());
    assertEquals(10, eyes[0].getHeight());
    assertEquals("earId", eyes[0].getId());
    assertEquals(5, eyes[1].getBase());
    assertEquals(10, eyes[1].getHeight());
    assertEquals("earId", eyes[1].getId());
    assertFalse("The ears should NOT be the same object as one of the eyes since Jackson doesn't support referential integrity.", ears[0] == eyes[0] || ears[0] == eyes[1]);

    Line nose = cat.getNose();
    assertEquals("noseId", nose.getId());
    Line mouth = cat.getMouth();
    assertEquals("mouthLine", mouth.getId());
    assertFalse("The nose line should also be one of the whiskers since Jackson doesn't support referential integrity.", cat.getWhiskers().contains(nose));
    assertFalse("The mouth line should also be one of the whiskers since Jackson doesn't support referential integrity.", cat.getWhiskers().contains(mouth));

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.