refactor: improve method name - checkShortLivingLKI

This commit is contained in:
xenohedron 2024-06-09 22:10:32 -04:00
parent aeaeccb63b
commit 0d4acf26e5
11 changed files with 14 additions and 11 deletions

View file

@ -1078,7 +1078,7 @@ public abstract class AbilityImpl implements Ability {
parameterSourceId = getSourceId();
}
// check against shortLKI for effects that move multiple object at the same time (e.g. destroy all)
if (game.getShortLivingLKI(getSourceId(), getZone())) {
if (game.checkShortLivingLKI(getSourceId(), getZone())) {
return true;
}
// check against current state

View file

@ -27,7 +27,7 @@ public abstract class StaticAbility extends AbilityImpl {
@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
if (game.getShortLivingLKI(getSourceId(), zone)) {
if (game.checkShortLivingLKI(getSourceId(), zone)) {
return true; // maybe this can be a problem if effects removed the ability from the object
}
if (game.getPermanentEntering(getSourceId()) != null && zone == Zone.BATTLEFIELD) {

View file

@ -452,7 +452,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
// - ! empty stack ! graveyard ! no ! no ! no more to resolve
// --!---------------!-------------!-----!-----------!
// -
if (game.getShortLivingLKI(source.getSourceId(), Zone.BATTLEFIELD)) {
if (game.checkShortLivingLKI(source.getSourceId(), Zone.BATTLEFIELD)) {
sourceObject = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
}
}

View file

@ -54,7 +54,7 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
sourcePermanent = game.getPermanent(getSourceId());
} else {
if (game.getShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
if (game.checkShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
}
}

View file

@ -55,7 +55,7 @@ public class GodEternalDiesTriggeredAbility extends TriggeredAbilityImpl {
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
sourcePermanent = game.getPermanent(getSourceId());
} else {
if (game.getShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
if (game.checkShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
}
}

View file

@ -81,7 +81,7 @@ public class CopyEffect extends ContinuousEffectImpl {
}
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
if (permanent == null) {
if (!game.getShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
if (!game.checkShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
discard();
return false;
}

View file

@ -286,7 +286,10 @@ public interface Game extends MageItem, Serializable, Copyable<Game> {
MageObject getLastKnownInformation(UUID objectId, Zone zone, int zoneChangeCounter);
boolean getShortLivingLKI(UUID objectId, Zone zone);
/**
* For checking if an object was in a zone during the resolution of an effect
*/
boolean checkShortLivingLKI(UUID objectId, Zone zone);
void rememberLKI(UUID objectId, Zone zone, MageObject object);

View file

@ -3587,7 +3587,7 @@ public abstract class GameImpl implements Game {
}
@Override
public boolean getShortLivingLKI(UUID objectId, Zone zone) {
public boolean checkShortLivingLKI(UUID objectId, Zone zone) {
Set<UUID> idSet = lkiShortLiving.get(zone);
if (idSet != null) {
return idSet.contains(objectId);