Package cz.matfyz.aai.fantom.game

Examples of cz.matfyz.aai.fantom.game.Actor


    for(MessageMove.ActorMove m : detectiveMoves.getMoves()) {
      TransportType transport = m.getTransportType();

      if(transport.isUsedByPhantom()) {
        int lucky = rnd.nextInt(phantoms.size()); //TODO: With multiple phantoms, how should the tickets be distributed?
        Actor luckyActor = phantoms.get(lucky);
        logger.info(String.format("Phantom %s gets one ticket for transport %s", luckyActor.getId(), transport.getName()));
        phantoms.get(lucky).addTicket(transport);
      }
    }

    // Inform the phantom.
View Full Code Here


    if(movement == null)
      throw new IllegalArgumentException("movement must not be null");
   
    logger.debug(String.format("Moving actors (%s)", client.getClientName()));
    for(ActorMove move : movement.getMoves()) {
      Actor actor = move.getActor();
      logger.info(String.format("Actor %s moved from node %s to node %s",
                      actor.getId(), actor.getCurrentPosition().getId(),
                      move.getTargetNode().getId()));
    }
  }
View Full Code Here

    for(Properties record : messageData) {
      if(record.containsKey(PROPERTY_CAPTURED)) {
        String actorId = record.getProperty(PROPERTY_CAPTURED);
        if(actorId == null || actorId.isEmpty())
          throw new ProtocolException("Actor ID was not specified", null);
        Actor capturedActor = graph.getActor(actorId);
        if(capturedActor == null)
          throw new ProtocolException("Unknown actor ID: " + actorId, null);
        capturedPhantoms.add(capturedActor);
      }
      else if(record.containsKey(PROPERTY_TICKETS)) {
View Full Code Here

  };
 
  public void testCreateActorMoveMissingValues() throws Exception {
    Graph g = new Graph(TEST_GRAPH);
   
    Actor fantomas = g.getActor("Fantomas");
    assertNotNull(fantomas);
   
    try {
      new ActorMove(null, null, null);
      fail("ActorMove was successfully created with null values");
View Full Code Here

  }
 
  public void testSerializeActorMove() throws Exception {
    Graph g = new Graph(TEST_GRAPH);
   
    Actor fantomas = g.getActor("Fantomas");
    assertNotNull(fantomas);
   
    Node nd1 = g.getNode("1");
    assertNotNull(nd1);
   
View Full Code Here

  }
 
  public void testSerializeMessageUpdate() throws Exception {
    Graph g = new Graph(TEST_GRAPH);
   
    Actor fantomas = g.getActor("Fantomas");
    assertNotNull(fantomas);
    Actor poirot = g.getActor("Poirot");
    assertNotNull(poirot);
    Actor batman = g.getActor("Batman");
    assertNotNull(batman);
    Actor joker = g.getActor("Joker");
    assertNotNull(joker);
   
    TransportType bus = g.getTransportType("bus");
    assertNotNull(bus);
    TransportType tram = g.getTransportType("tram");
    assertNotNull(tram);
   
    Node n3 = g.getNode("3");
    assertNotNull(n3);
    Node n4 = g.getNode("4");
    assertNotNull(n4);
   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n3, null),
        new ActorMove(poirot, null, bus),
        new ActorMove(batman, n4, tram),
    };
   
    joker.capture();
   
    MessageUpdate msg = new MessageUpdate(g, moves, null);
    Properties[] msgData = msg.serialize();
   
    assertNotNull(msgData);
View Full Code Here

TOP

Related Classes of cz.matfyz.aai.fantom.game.Actor

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.