Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor Max Speed round 1 #6957

Merged
merged 3 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package forge.game.event;

import forge.game.player.Player;

public class GameEventSpeedUp extends GameEvent {

public final Player player;

public GameEventSpeedUp(Player affected) {
player = affected;
}

Hanmac marked this conversation as resolved.
Show resolved Hide resolved
@Override
public <T> T visit(IGameEventVisitor<T> visitor) {
return visitor.visit(this);
Expand Down
2 changes: 1 addition & 1 deletion forge-game/src/main/java/forge/game/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ public final void increaseSpeed() {
if (!maxSpeed()) { // can't increase past 4
speed++;
view.updateSpeed(this);
game.fireEvent(new GameEventSpeedUp()); //play sound effect
game.fireEvent(new GameEventSpeedUp(this)); //play sound effect
}
}
public final void decreaseSpeed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,12 @@ public Void visit(final GameEventPlayerStatsChanged event) {
return processCards(cards, cardsRefreshDetails);
}

public Void visit(final GameEventSpeedUp event) {
Player p = event.player;
processPlayer(p, livesUpdate);
return processEvent();
}

public Void visit(final GameEventLandPlayed event) {
processPlayer(event.player, livesUpdate);
matchController.handleLandPlayed(event.land);
Expand Down