Skip to content

Commit 60c6551

Browse files
GhostID
1 parent 0fc6e66 commit 60c6551

File tree

17 files changed

+79
-64
lines changed

17 files changed

+79
-64
lines changed

pacman-app-arcade-mspacman/src/main/java/de/amr/pacmanfx/arcade/ms_pacman/ArcadeMsPacMan_GameModel.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void hunt(GameContext gameContext) {
8484
roam(gameContext);
8585
} else {
8686
boolean chase = game.huntingTimer().phase() == HuntingPhase.CHASING || game.isCruiseElroyModeActive();
87-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
87+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
8888
tryMovingTowardsTargetTile(gameContext, targetTile);
8989
}
9090
}
@@ -108,7 +108,7 @@ public void hunt(GameContext gameContext) {
108108
roam(gameContext);
109109
} else {
110110
boolean chase = gameContext.game().huntingTimer().phase() == HuntingPhase.CHASING;
111-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
111+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
112112
tryMovingTowardsTargetTile(gameContext, targetTile);
113113
}
114114
}
@@ -128,7 +128,7 @@ public void hunt(GameContext gameContext) {
128128

129129
float speed = gameContext.game().actorSpeedControl().ghostAttackSpeed(gameContext, level, this);
130130
boolean chase = gameContext.game().huntingTimer().phase() == HuntingPhase.CHASING;
131-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
131+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
132132
setSpeed(speed);
133133
tryMovingTowardsTargetTile(gameContext, targetTile);
134134
}
@@ -148,7 +148,7 @@ public void hunt(GameContext gameContext) {
148148

149149
float speed = gameContext.game().actorSpeedControl().ghostAttackSpeed(gameContext, level, this);
150150
boolean chase = gameContext.game().huntingTimer().phase() == HuntingPhase.CHASING;
151-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
151+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
152152
setSpeed(speed);
153153
tryMovingTowardsTargetTile(gameContext, targetTile);
154154
}
@@ -159,7 +159,7 @@ public Vector2i chasingTargetTile(GameContext gameContext) {
159159

160160
// Attacks directly or retreats towards scatter target if Pac is near
161161
return tile().euclideanDist(level.pac().tile()) < 8
162-
? level.ghostScatterTile(personality())
162+
? level.ghostScatterTile(id().personality())
163163
: level.pac().tile();
164164
}
165165
};
@@ -252,7 +252,7 @@ public long huntingTicks(int levelNumber, int phaseIndex) {
252252

253253
gateKeeper = new GateKeeper(this);
254254
gateKeeper.setOnGhostReleased(prisoner -> {
255-
if (prisoner.personality() == ORANGE_GHOST_POKEY && !isCruiseElroyModeActive()) {
255+
if (prisoner.id().personality() == ORANGE_GHOST_POKEY && !isCruiseElroyModeActive()) {
256256
Logger.trace("Re-enable 'Cruise Elroy' mode because {} exits house:", prisoner.name());
257257
activateCruiseElroyMode(true);
258258
}

pacman-app-arcade-mspacman/src/main/java/de/amr/pacmanfx/arcade/ms_pacman/ArcadeMsPacMan_UIConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public ArcadeMsPacMan_GameRenderer createGameRenderer(Canvas canvas) {
189189

190190
@Override
191191
public ArcadeMsPacMan_GhostAnimationMap createGhostAnimations(Ghost ghost) {
192-
return new ArcadeMsPacMan_GhostAnimationMap(spriteSheet, ghost.personality());
192+
return new ArcadeMsPacMan_GhostAnimationMap(spriteSheet, ghost.id().personality());
193193
}
194194

195195
@Override

pacman-app-arcade-pacman/src/main/java/de/amr/pacmanfx/arcade/pacman/ArcadePacMan_GameModel.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void hunt(GameContext gameContext) {
6464
var arcadeGame = (ArcadeCommon_GameModel) gameContext.game();
6565

6666
boolean chase = arcadeGame.huntingTimer().phase() == HuntingPhase.CHASING || arcadeGame.cruiseElroy() > 0;
67-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
67+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
6868
setSpeed(gameContext.game().actorSpeedControl().ghostAttackSpeed(gameContext, level, this));
6969
tryMovingTowardsTargetTile(gameContext, targetTile);
7070
}
@@ -82,7 +82,7 @@ public void hunt(GameContext gameContext) {
8282
GameLevel level = gameContext.gameLevel();
8383

8484
boolean chase = gameContext.game().huntingTimer().phase() == HuntingPhase.CHASING;
85-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
85+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
8686
setSpeed(gameContext.game().actorSpeedControl().ghostAttackSpeed(gameContext, level, this));
8787
tryMovingTowardsTargetTile(gameContext, targetTile);
8888
}
@@ -100,7 +100,7 @@ public void hunt(GameContext gameContext) {
100100
GameLevel level = gameContext.gameLevel();
101101

102102
boolean chase = gameContext.game().huntingTimer().phase() == HuntingPhase.CHASING;
103-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
103+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
104104
setSpeed(gameContext.game().actorSpeedControl().ghostAttackSpeed(gameContext, level, this));
105105
tryMovingTowardsTargetTile(gameContext, targetTile);
106106
}
@@ -120,7 +120,7 @@ public void hunt(GameContext gameContext) {
120120
GameLevel level = gameContext.gameLevel();
121121

122122
boolean chase = gameContext.game().huntingTimer().phase() == HuntingPhase.CHASING;
123-
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(personality());
123+
Vector2i targetTile = chase ? chasingTargetTile(gameContext) : level.ghostScatterTile(id().personality());
124124
setSpeed(gameContext.game().actorSpeedControl().ghostAttackSpeed(gameContext, level, this));
125125
tryMovingTowardsTargetTile(gameContext, targetTile);
126126
}
@@ -130,7 +130,7 @@ public Vector2i chasingTargetTile(GameContext gameContext) {
130130
GameLevel level = gameContext.gameLevel();
131131
// Attacks directly or retreats towards scatter target if Pac is near
132132
return tile().euclideanDist(level.pac().tile()) < 8
133-
? level.ghostScatterTile(personality())
133+
? level.ghostScatterTile(id().personality())
134134
: level.pac().tile();
135135
}
136136
};
@@ -185,7 +185,7 @@ public ArcadePacMan_GameModel(GameContext gameContext, File highScoreFile) {
185185
/**
186186
* @param gameContext the game context
187187
* @param mapSelector e.g. selector that selects custom maps before standard maps
188-
* @param highScoreFile file where highscore is stored
188+
* @param highScoreFile file where high score is stored
189189
*/
190190
public ArcadePacMan_GameModel(GameContext gameContext, MapSelector mapSelector, File highScoreFile) {
191191
super(gameContext);
@@ -222,7 +222,7 @@ public long huntingTicks(int levelNumber, int phaseIndex) {
222222

223223
gateKeeper = new GateKeeper(this);
224224
gateKeeper.setOnGhostReleased(prisoner -> {
225-
if (prisoner.personality() == ORANGE_GHOST_POKEY && !isCruiseElroyModeActive()) {
225+
if (prisoner.id().personality() == ORANGE_GHOST_POKEY && !isCruiseElroyModeActive()) {
226226
Logger.debug("Re-enable 'Cruise Elroy' mode because {} got released:", prisoner.name());
227227
activateCruiseElroyMode(true);
228228
}

pacman-app-arcade-pacman/src/main/java/de/amr/pacmanfx/arcade/pacman/ArcadePacMan_UIConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public ArcadePacMan_GameRenderer createGameRenderer(Canvas canvas) {
181181

182182
@Override
183183
public ArcadePacMan_GhostAnimationMap createGhostAnimations(Ghost ghost) {
184-
return new ArcadePacMan_GhostAnimationMap(spriteSheet, ghost.personality());
184+
return new ArcadePacMan_GhostAnimationMap(spriteSheet, ghost.id().personality());
185185
}
186186

187187
@Override

pacman-app-arcade-pacman/src/main/java/de/amr/pacmanfx/arcade/pacman/scenes/ArcadePacMan_IntroScene.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public void onEnter(ArcadePacMan_IntroScene scene) {
269269
scene.pacMan.playAnimation(ANIM_PAC_MUNCHING);
270270
scene.ghosts.forEach(ghost -> {
271271
ghost.setState(GhostState.HUNTING_PAC);
272-
ghost.setPosition(scene.pacMan.x() + 16 * (ghost.personality() + 1), scene.pacMan.y());
272+
ghost.setPosition(scene.pacMan.x() + 16 * (ghost.id().personality() + 1), scene.pacMan.y());
273273
ghost.setMoveDir(Direction.LEFT);
274274
ghost.setWishDir(Direction.LEFT);
275275
ghost.setSpeed(CHASING_SPEED);

pacman-app-arcade-pacmanxxl/src/main/java/de/amr/pacmanfx/arcade/pacman_xxl/PacManXXL_Common_StartPageMenu.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void reset() {
7777
pac.setVisible(true);
7878

7979
for (Ghost ghost : ghosts) {
80-
ghost.setX(46 * TS + ghost.personality() * 18);
80+
ghost.setX(46 * TS + ghost.id().personality() * 18);
8181
ghost.setMoveDir(Direction.LEFT);
8282
ghost.setWishDir(Direction.LEFT);
8383
ghost.setSpeed(1.05f);
@@ -95,7 +95,7 @@ void update() {
9595
pac.setX(-36 * TS);
9696
for (Ghost ghost : ghosts) {
9797
ghost.setVisible(true);
98-
ghost.setX(pac.x() + 22 * TS + ghost.personality() * 18);
98+
ghost.setX(pac.x() + 22 * TS + ghost.id().personality() * 18);
9999
ghost.setMoveDir(ghost.moveDir().opposite());
100100
ghost.setWishDir(ghost.moveDir().opposite());
101101
ghost.setSpeed(0.58f);
@@ -111,7 +111,7 @@ else if (pac.x() > 56 * TS && chasingGhosts) {
111111
ghost.setVisible(true);
112112
ghost.setMoveDir(Direction.LEFT);
113113
ghost.setWishDir(Direction.LEFT);
114-
ghost.setX(46 * TS + ghost.personality() * 2 * TS);
114+
ghost.setX(46 * TS + ghost.id().personality() * 2 * TS);
115115
ghost.setSpeed(1.05f);
116116
ghost.playAnimation(ANIM_GHOST_NORMAL);
117117
}

pacman-app-arcade-pacmanxxl/src/main/java/de/amr/pacmanfx/arcade/pacman_xxl/PacManXXL_MsPacMan_UIConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public PacManXXL_MsPacMan_GameRenderer createGameRenderer(Canvas canvas) {
189189

190190
@Override
191191
public SpriteAnimationMap<SpriteID> createGhostAnimations(Ghost ghost) {
192-
return new ArcadeMsPacMan_GhostAnimationMap(spriteSheet, ghost.personality());
192+
return new ArcadeMsPacMan_GhostAnimationMap(spriteSheet, ghost.id().personality());
193193
}
194194

195195
@Override

pacman-app-arcade-pacmanxxl/src/main/java/de/amr/pacmanfx/arcade/pacman_xxl/PacManXXL_PacMan_UIConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public ArcadePacMan_SpriteSheet spriteSheet() {
194194

195195
@Override
196196
public ArcadePacMan_GhostAnimationMap createGhostAnimations(Ghost ghost) {
197-
return new ArcadePacMan_GhostAnimationMap(spriteSheet, ghost.personality());
197+
return new ArcadePacMan_GhostAnimationMap(spriteSheet, ghost.id().personality());
198198
}
199199

200200
@Override

pacman-app-tengen-mspacman/src/main/java/de/amr/pacmanfx/tengen/ms_pacman/TengenMsPacMan_UIConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public WorldMapColorScheme colorScheme(WorldMap worldMap) {
274274

275275
@Override
276276
public TengenMsPacMan_GhostAnimationMap createGhostAnimations(Ghost ghost) {
277-
return new TengenMsPacMan_GhostAnimationMap(spriteSheet(), ghost.personality());
277+
return new TengenMsPacMan_GhostAnimationMap(spriteSheet(), ghost.id().personality());
278278
}
279279

280280
@Override

pacman-app-tengen-mspacman/src/main/java/de/amr/pacmanfx/tengen/ms_pacman/model/TengenActorSpeedControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public float ghostAttackSpeed(GameContext gameContext, GameLevel level, Ghost gh
143143
TengenMsPacMan_GameModel game = gameContext.game();
144144
float speed = ghostBaseSpeedInLevel(level.number());
145145
speed += ghostDifficultySpeedDelta(game.difficulty());
146-
speed += ghostSpeedDelta(ghost.personality());
146+
speed += ghostSpeedDelta(ghost.id().personality());
147147
float foodDelta = ghostSpeedIncreaseByFoodRemaining(gameContext, level);
148148
if (foodDelta > 0) {
149149
speed += foodDelta;

0 commit comments

Comments
 (0)