forked from External/mage
Refactor batch events (#11995)
* create new abstract class for batch event framework * adjust CardUtil.getEventTargets to support new framework * update TappedBatchEvent to new framework * update UntappedBatchEvent to new framework * slight cleanup * update LifeLostBatchEvent to new framework * update ZoneChangeBatchEvent to new framework * complete refactor by moving damage events to new framework * remove old code no longer used * clean up some nonsense code in star wars card * fix watcher checking id before event type * fix wrong id usage * fix missed wrong id usage
This commit is contained in:
parent
8869d282b2
commit
cb28fb5a56
39 changed files with 308 additions and 635 deletions
|
|
@ -30,7 +30,7 @@ import mage.game.CardState;
|
|||
import mage.game.Game;
|
||||
import mage.game.GameState;
|
||||
import mage.game.command.Commander;
|
||||
import mage.game.events.BatchGameEvent;
|
||||
import mage.game.events.BatchEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
|
|
@ -2203,14 +2203,11 @@ public final class CardUtil {
|
|||
|
||||
/**
|
||||
* One single event can be a batch (contain multiple events)
|
||||
*
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
public static Set<UUID> getEventTargets(GameEvent event) {
|
||||
Set<UUID> res = new HashSet<>();
|
||||
if (event instanceof BatchGameEvent) {
|
||||
res.addAll(((BatchGameEvent<?>) event).getTargets());
|
||||
if (event instanceof BatchEvent) {
|
||||
res.addAll(((BatchEvent<?>) event).getTargetIds());
|
||||
} else if (event != null && event.getTargetId() != null) {
|
||||
res.add(event.getTargetId());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue