Refactor: replaced sourceId by source and introduced source param in some methods;

This commit is contained in:
Oleg Agafonov 2020-12-12 20:23:19 +04:00
parent 2bb472607b
commit db239a1055
3205 changed files with 7080 additions and 6795 deletions

View file

@ -2,6 +2,8 @@ package mage.game.events;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
@ -15,34 +17,39 @@ public class ZoneChangeEvent extends GameEvent {
private Zone toZone;
private Zone originalToZone;
private Permanent target;
private Ability source; // link to source ability, can be null in rare situations
public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) {
super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId);
public ZoneChangeEvent(Permanent target, Ability source, UUID playerId, Zone fromZone, Zone toZone) {
super(GameEvent.EventType.ZONE_CHANGE, target.getId(), source, playerId);
this.fromZone = fromZone;
this.setToZone(toZone);
this.target = target;
this.source = source;
}
public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, List<UUID> appliedEffects) {
super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId);
public ZoneChangeEvent(Permanent target, Ability source, UUID playerId, Zone fromZone, Zone toZone, List<UUID> appliedEffects) {
super(GameEvent.EventType.ZONE_CHANGE, target.getId(), source, playerId);
this.fromZone = fromZone;
this.setToZone(toZone);
this.target = target;
this.source = source;
if (appliedEffects != null) {
this.appliedEffects = appliedEffects;
}
}
public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) {
super(EventType.ZONE_CHANGE, targetId, sourceId, playerId);
public ZoneChangeEvent(UUID targetId, Ability source, UUID playerId, Zone fromZone, Zone toZone) {
super(GameEvent.EventType.ZONE_CHANGE, targetId, source, playerId);
this.fromZone = fromZone;
this.setToZone(toZone);
this.source = source;
}
public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, List<UUID> appliedEffects) {
super(EventType.ZONE_CHANGE, targetId, sourceId, playerId);
public ZoneChangeEvent(UUID targetId, Ability source, UUID playerId, Zone fromZone, Zone toZone, List<UUID> appliedEffects) {
super(GameEvent.EventType.ZONE_CHANGE, targetId, source, playerId);
this.fromZone = fromZone;
this.setToZone(toZone);
this.source = source;
if (appliedEffects != null) {
this.appliedEffects = appliedEffects;
}
@ -87,4 +94,13 @@ public class ZoneChangeEvent extends GameEvent {
return originalToZone;
}
/**
* Source ability of the event, can be null in rare cases
*
* @return
*/
public Ability getSource() {
return this.source;
}
}