foul-magics/Mage/src/main/java/mage/game/events/DamagedEvent.java
Susucre 95adcf0e9a revert the GameEvent::setSourceId removal
xenodron mentionned that one of the use of setSourceId is to more easily find the Event that use non-standard
sourceId.

So reverting the change made in a previous commit.

It was a non-functional change meant to ease new
BatchEvent sharing sourceId, but I'll use setSourceId
instead there.
2024-04-30 11:51:11 +02:00

39 lines
846 B
Java

package mage.game.events;
import java.util.UUID;
/**
* @author BetaSteward_at_googlemail.com
*/
public abstract class DamagedEvent extends GameEvent {
protected boolean combat;
protected int excess;
public DamagedEvent(EventType type, UUID targetId, UUID attackerId, UUID playerId, int amount, boolean combat) {
super(type, targetId, null, playerId, amount, false);
this.combat = combat;
this.excess = 0;
this.setSourceId(attackerId);
}
public boolean isCombatDamage() {
return combat;
}
public boolean isPreventable() {
return flag;
}
public void setExcess(int excess) {
this.excess = Math.max(excess, 0);
}
public int getExcess() {
return excess;
}
public UUID getAttackerId() {
return getSourceId();
}
}