clean all usage of GameEvent::setSourceId

This commit is contained in:
Susucre 2024-04-28 14:21:43 +02:00
parent 8771d9b7f5
commit 868cd4d8fd
40 changed files with 114 additions and 100 deletions

View file

@ -10,12 +10,16 @@ import java.util.UUID;
public class DrawCardsEvent extends GameEvent {
public DrawCardsEvent(UUID playerId, Ability source, GameEvent originalDrawEvent, int amount) {
super(GameEvent.EventType.DRAW_CARDS, playerId, source, playerId, amount, false);
super(GameEvent.EventType.DRAW_CARDS, playerId,
// source of draw events must be kept between replacements, example: UnpredictableCycloneTest
originalDrawEvent == null
? source == null ? null : source.getSourceId()
: originalDrawEvent.getSourceId(),
playerId, amount, false);
// source of draw events must be kept between replacements, example: UnpredictableCycloneTest
if (originalDrawEvent != null) {
this.addAppliedEffects(originalDrawEvent.getAppliedEffects());
this.setSourceId(originalDrawEvent.getSourceId());
}
}
}