Skip to content

Commit

Permalink
Merge pull request #40 from marty30/24-win-conditions
Browse files Browse the repository at this point in the history
24 win conditions
  • Loading branch information
marty30 committed Nov 2, 2017
2 parents 4318292 + 836fd6f commit fbf11b8
Show file tree
Hide file tree
Showing 26 changed files with 466 additions and 281 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package org.inaetics.dronessimulator.common.protocol;


import java.util.ArrayList;
import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.List;

/**
* A message describing a collision between 2 entities
*/
@Getter
@Setter
public class CollisionMessage extends ProtocolMessage {
/**
* The type of the first entity
Expand All @@ -26,49 +31,13 @@ public class CollisionMessage extends ProtocolMessage {
*/
private String e2Identifier;

public EntityType getE1Type() {
return e1Type;
}

public void setE1Type(EntityType e1Type) {
this.e1Type = e1Type;
}

public String getE1Id() {
return e1Identifier;
}

public void setE1Id(String e1Id) {
this.e1Identifier = e1Id;
}

public EntityType getE2Type() {
return e2Type;
}

public void setE2Type(EntityType e2Type) {
this.e2Type = e2Type;
}

public String getE2Id() {
return e2Identifier;
}

public void setE2Id(String e2Id) {
this.e2Identifier = e2Id;
}

@Override
public String toString() {
return String.format("(CollisionMessage %s %s, %s, %s)", this.e1Identifier, this.e1Type, this.e2Identifier, this.e2Type);
}

@Override
public List<MessageTopic> getTopics() {
List<MessageTopic> topics = new ArrayList<>();

topics.add(MessageTopic.STATEUPDATES);

return topics;
return Collections.singletonList(MessageTopic.STATEUPDATES);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package org.inaetics.dronessimulator.common.protocol;

import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.List;

/**
* Protocol message describing that an entity has been damaged
*/
@Getter
@Setter
public class DamageMessage extends ProtocolMessage {
/**
* The id of the entity which is damaged
Expand All @@ -21,30 +26,6 @@ public class DamageMessage extends ProtocolMessage {
*/
private int damage;

public String getEntityId() {
return entityId;
}

public void setEntityId(String entityId) {
this.entityId = entityId;
}

public EntityType getEntityType() {
return entityType;
}

public void setEntityType(EntityType entityType) {
this.entityType = entityType;
}

public int getDamage() {
return damage;
}

public void setDamage(int damage) {
this.damage = damage;
}

@Override
public List<MessageTopic> getTopics() {
return Collections.singletonList(MessageTopic.STATEUPDATES);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package org.inaetics.dronessimulator.common.protocol;

import lombok.Getter;
import lombok.Setter;

/**
* Message specifying a bullet is fired
*/
@Getter
@Setter
public class FireBulletMessage extends CreateEntityMessage {
/**
* The damage of the bullet
Expand All @@ -13,22 +18,6 @@ public class FireBulletMessage extends CreateEntityMessage {
*/
private String firedById;

public int getDamage() {
return damage;
}

public void setDamage(int damage) {
this.damage = damage;
}

public String getFiredById() {
return firedById;
}

public void setFiredById(String firedById) {
this.firedById = firedById;
}

public String toString() {
return String.format("(FireBulletMessage %s fired by %s, %s)", this.getIdentifier(), this.getFiredById(), this.getDamage());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.inaetics.dronessimulator.common.protocol;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Collections;
import java.util.List;

@RequiredArgsConstructor
public class GameFinishedMessage extends ProtocolMessage {
@Getter
private final String winner;

@Override
public List<MessageTopic> getTopics() {
return Collections.singletonList(MessageTopic.STATEUPDATES);
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
package org.inaetics.dronessimulator.common.protocol;


import java.util.ArrayList;
import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.List;

@Getter
@Setter
public class KillMessage extends ProtocolMessage {
/** Indentifier of object */
private String identifier = null;
private EntityType entityType;

public String getIdentifier() {
return identifier;
}

public void setIdentifier(String identifier) {
this.identifier = identifier;
}

public EntityType getEntityType() {
return entityType;
}

public void setEntityType(EntityType entityType) {
this.entityType = entityType;
}

@Override
public List<MessageTopic> getTopics() {
List<MessageTopic> topics = new ArrayList<>();

topics.add(MessageTopic.STATEUPDATES);

return topics;
return Collections.singletonList(MessageTopic.STATEUPDATES);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.inaetics.dronessimulator.common.protocol;

import lombok.Getter;
import lombok.Setter;
import org.inaetics.dronessimulator.common.vector.D3PolarCoordinate;
import org.inaetics.dronessimulator.common.vector.D3Vector;

Expand All @@ -10,6 +12,8 @@
/**
* Message used to tell the game state about movements.
*/
@Getter
@Setter
public class MovementMessage extends ProtocolMessage {
/** Indentifier of object */
private String identifier = null;
Expand All @@ -24,24 +28,10 @@ public Optional<D3PolarCoordinate> getDirection() {
return Optional.ofNullable(direction);
}

public void setDirection(D3PolarCoordinate direction) {
this.direction = direction;
}

public Optional<D3Vector> getAcceleration() {
return Optional.ofNullable(acceleration);
}

public void setAcceleration(D3Vector acceleration) {
this.acceleration = acceleration;
}

public String getIdentifier() {
return this.identifier;
}

public void setIdentifier(String identifier){ this.identifier = identifier; }

@Override
public List<MessageTopic> getTopics() {
List<MessageTopic> topics = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.inaetics.dronessimulator.common.protocol;


import lombok.Getter;
import lombok.Setter;
import org.inaetics.dronessimulator.common.architecture.SimulationAction;

import java.util.Collections;
Expand All @@ -9,6 +11,8 @@
/**
* A message to request a architecture state change
*/
@Getter
@Setter
public class RequestArchitectureStateChangeMessage extends ProtocolMessage {
/**
* The action to take
Expand All @@ -20,22 +24,6 @@ public List<MessageTopic> getTopics() {
return Collections.singletonList(MessageTopic.ARCHITECTURE);
}

/**
* Gets the requested action to take
* @return The action
*/
public SimulationAction getAction() {
return action;
}

/**
* Set the requested action in the message
* @param action Which action to request
*/
public void setAction(SimulationAction action) {
this.action = action;
}

@Override
public String toString() {
return "RequestArchitectureStateChangeMessage " + action;
Expand Down
Loading

0 comments on commit fbf11b8

Please sign in to comment.