* Gain ability effect: fixed rollback error with AI games and too many cards (related to d202278ccd);

This commit is contained in:
Oleg Agafonov 2021-08-11 12:43:13 +04:00
parent 8a69ea97e7
commit 9f882824a0
5 changed files with 51 additions and 109 deletions

View file

@ -102,18 +102,6 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
perm.addAbility(ability, source.getSourceId(), game);
}
}
// still as long as the prev. permanent is known to the LKI (e.g. Mikaeus, the Unhallowed) so gained dies triggered ability will trigger
Map<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
if (LKIBattlefield != null) {
for (MageObject mageObject : LKIBattlefield.values()) {
Permanent perm = (Permanent) mageObject;
if (!(excludeSource && perm.getId().equals(source.getSourceId())) && selectedByRuntimeData(perm, source, game)) {
if (filter.match(perm, source.getSourceId(), source.getControllerId(), game)) {
perm.addAbility(ability, source.getSourceId(), game);
}
}
}
}
}
return true;
}

View file

@ -104,20 +104,6 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
}
}
}
// still as long as the prev. permanent is known to the LKI (e.g. Mikaeus, the Unhallowed) so gained dies triggered ability will trigger
Map<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
if (LKIBattlefield != null) {
for (MageObject mageObject : LKIBattlefield.values()) {
Permanent perm = (Permanent) mageObject;
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
if (filter.match(perm, source.getSourceId(), source.getControllerId(), game)) {
for (Ability abilityToAdd : ability) {
perm.addAbility(abilityToAdd, source.getSourceId(), game);
}
}
}
}
}
}
return true;
}

View file

@ -99,18 +99,6 @@ public class LoseAbilityAllEffect extends ContinuousEffectImpl {
perm.removeAbilities(ability, source.getSourceId(), game);
}
}
// still as long as the prev. permanent is known to the LKI (e.g. Mikaeus, the Unhallowed) so gained dies triggered ability will trigger
Map<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
if (LKIBattlefield != null) {
for (MageObject mageObject : LKIBattlefield.values()) {
Permanent perm = (Permanent) mageObject;
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
if (filter.match(perm, source.getSourceId(), source.getControllerId(), game)) {
perm.removeAbilities(ability, source.getSourceId(), game);
}
}
}
}
}
return true;
}