mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Added a check that continuous PT setting effects are only applied, if the object has still the ability (fixes #3167).
I added the effect now only to the layer the bug is caused by. Probably it's correct to check this for every layer. But I don't know how much resources the check addional needs. So if we got other tests that fail for this reason caused by other layers, we could add the check and test if all other tests still work correctly.
This commit is contained in:
parent
da6b5cae53
commit
a93dc4e3da
2 changed files with 10 additions and 2 deletions
|
@ -78,6 +78,7 @@ public class SeekerOfInsight extends CardImpl {
|
|||
}
|
||||
|
||||
class CastNonCreatureSpellCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
|
@ -97,5 +98,5 @@ class CastNonCreatureSpellCondition implements Condition {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "you've cast a noncreature spell this turn";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -962,7 +962,9 @@ public class ContinuousEffects implements Serializable {
|
|||
for (ContinuousEffect effect : layer) {
|
||||
HashSet<Ability> abilities = layeredEffects.getAbility(effect.getId());
|
||||
for (Ability ability : abilities) {
|
||||
effect.apply(Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, ability, game);
|
||||
if (abilityActive(ability, game)) {
|
||||
effect.apply(Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, ability, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ContinuousEffect effect : layer) {
|
||||
|
@ -1002,6 +1004,11 @@ public class ContinuousEffects implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean abilityActive(Ability ability, Game game) {
|
||||
MageObject object = game.getObject(ability.getSourceId());
|
||||
return object != null && object.hasAbility(ability.getId(), game);
|
||||
}
|
||||
|
||||
private void applyLayer(List<ContinuousEffect> activeLayerEffects, Layer currentLayer, Game game) {
|
||||
List<ContinuousEffect> layer = filterLayeredEffects(activeLayerEffects, currentLayer);
|
||||
if (!layer.isEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue