refactor: utilize NPCType
This commit is contained in:
parent
e88476eb10
commit
71fc0893a8
@ -46,7 +46,7 @@ public class Character extends Entity {
|
||||
super(id, position);
|
||||
solid = false;
|
||||
opaque = true;
|
||||
if(id.type == EntityType.NPC && id.id == 2) {
|
||||
if(id.type == EntityType.NPC && id.id == NPCType.Thanos.getID()) {
|
||||
solid = true; //characters cannot walk into thanos
|
||||
}
|
||||
this.name = name;
|
||||
|
@ -2,7 +2,17 @@ package uulm.teamname.marvelous.gamelibrary.entities;
|
||||
|
||||
/** Specifies the type of an {@link NPC}. */
|
||||
public enum NPCType {
|
||||
Goose,
|
||||
Stan,
|
||||
Thanos
|
||||
Goose(0),
|
||||
Stan(1),
|
||||
Thanos(2);
|
||||
|
||||
private final int id;
|
||||
|
||||
NPCType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ class GameLogic {
|
||||
}
|
||||
IntVector2 position = free.get(rand.nextInt(free.size()));
|
||||
|
||||
EntityID goose = new EntityID(EntityType.NPC, 0);
|
||||
EntityID goose = new EntityID(EntityType.NPC, NPCType.Goose.getID());
|
||||
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
||||
.withEntity(new NPC(goose, position, inventory))
|
||||
.buildEntityEvent());
|
||||
@ -832,7 +832,7 @@ class GameLogic {
|
||||
}
|
||||
IntVector2 spawnPosition = spawnOptions.get(rand.nextInt(spawnOptions.size()));
|
||||
|
||||
EntityID stan = new EntityID(EntityType.NPC, 1);
|
||||
EntityID stan = new EntityID(EntityType.NPC, NPCType.Stan.getID());
|
||||
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
||||
.withEntity(new NPC(stan, spawnPosition))
|
||||
.buildEntityEvent());
|
||||
@ -880,7 +880,7 @@ class GameLogic {
|
||||
}
|
||||
}
|
||||
|
||||
EntityID thanos = new EntityID(EntityType.NPC, 2);
|
||||
EntityID thanos = new EntityID(EntityType.NPC, NPCType.Thanos.getID());
|
||||
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
||||
.withEntity(new NPC(thanos, position, maxMP))
|
||||
.buildEntityEvent());
|
||||
@ -1010,7 +1010,7 @@ class GameLogic {
|
||||
|
||||
state.turnNumber++;
|
||||
|
||||
if(state.activeCharacter.type == EntityType.NPC && state.activeCharacter.id == 2) {
|
||||
if(state.activeCharacter.type == EntityType.NPC && state.activeCharacter.id == NPCType.Thanos.getID()) {
|
||||
NPC thanos = (NPC)state.entities.findEntity(state.activeCharacter);
|
||||
|
||||
if(state.roundNumber > state.partyConfig.maxRounds + 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user