Devs: added docs and todo about short living LKI, LKI and current problems;

This commit is contained in:
Oleg Agafonov 2021-09-05 18:44:50 +04:00
parent 107c10fd2c
commit 83017e3c51
10 changed files with 79 additions and 19 deletions

View file

@ -296,6 +296,34 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
if (game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
sourceObject = game.getPermanent(source.getSourceId());
} else {
// TODO: multiple calls of ApplyEffects all around the code are breaking a short living lki idea
// (PlayerImpl's call to move to battlefield do the worse thing)
// -
// Original idea: short living LKI must help to find a moment in the inner of resolve
// -
// Example:
// --!---------------!-------------!-----!-----------!
// - ! steps ! perm zone ! LKI ! short LKI !
// --!---------------!-------------!-----!-----------!
// - ! resolve start ! battlefield ! no ! no !
// - ! step 1 ! battlefield ! no ! no ! permanent moving to graveyard by step's command
// - ! step 2 ! graveyard ! yes ! yes ! other commands
// - ! step 3 ! graveyard ! yes ! yes ! other commands
// - ! raise triggers! graveyard ! yes ! yes ! handle and put triggers that was raised in resolve steps
// - ! resolve end ! graveyard ! yes ! no !
// - ! resolve next ! graveyard ! yes ! no ! resolve next spell
// - ! empty stack ! graveyard ! no ! no ! no more to resolve
// --!---------------!-------------!-----!-----------!
// -
// - Problem 1: move code (well, not only move) calls ApplyEffects in the middle of the resolve
// - and reset short LKI (after short LKI reset dies trigger will not work)
// - Example: Goblin Welder calls sacrifice and card move in the same effect - but move call do
// - a reset and dies trigger ignored (trigger thinks that permanent already dies)
// -
// - Possible fix:
// - replace ApplyEffects in the move code by game.getState().processAction(game);
// - check and fix many broken (is it was a false positive test or something broken)
//sourceObject = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (game.getShortLivingLKI(source.getSourceId(), Zone.BATTLEFIELD)) {
sourceObject = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
}