mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Joraga Treespeaker - Fixed a bug, that elves did not get the mana ability from Level 5 of the Joraga Treespeaker (caused by handling of continuous effects that added abilities that added abilities).
This commit is contained in:
parent
c59123239b
commit
463cec8754
2 changed files with 28 additions and 7 deletions
|
@ -727,16 +727,36 @@ public class ContinuousEffects implements Serializable {
|
|||
effect.apply(Layer.ColorChangingEffects_5, SubLayer.NA, ability, game);
|
||||
}
|
||||
}
|
||||
layer = filterLayeredEffects(layerEffects, Layer.AbilityAddingRemovingEffects_6);
|
||||
for (ContinuousEffect effect: layer) {
|
||||
if (layerEffects.contains(effect)) {
|
||||
HashSet<Ability> abilities = layeredEffects.getAbility(effect.getId());
|
||||
for (Ability ability : abilities) {
|
||||
effect.apply(Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, ability, game);
|
||||
|
||||
Map<ContinuousEffect, List<Ability>> appliedEffects = new HashMap<ContinuousEffect, List<Ability>>();
|
||||
boolean allApplied = false;
|
||||
while (!allApplied) { // loop needed if a added effect adds again an effect (e.g. Level 5- of Joraga Treespeaker)
|
||||
boolean effectApplied = false;
|
||||
layer = filterLayeredEffects(layerEffects, Layer.AbilityAddingRemovingEffects_6);
|
||||
for (ContinuousEffect effect: layer) {
|
||||
if (layerEffects.contains(effect)) {
|
||||
List<Ability> appliedAbilities = appliedEffects.get(effect);
|
||||
HashSet<Ability> abilities = layeredEffects.getAbility(effect.getId());
|
||||
for (Ability ability : abilities) {
|
||||
if (appliedAbilities == null || !appliedAbilities.contains(ability)) {
|
||||
if (appliedAbilities == null) {
|
||||
appliedAbilities = new ArrayList<Ability>();
|
||||
appliedEffects.put(effect, appliedAbilities);
|
||||
}
|
||||
appliedAbilities.add(ability);
|
||||
effect.apply(Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, ability, game);
|
||||
effectApplied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
layerEffects = getLayeredEffects(game);
|
||||
// if effect were applied, new effects of this layer could be added, so all yet not applied effects of this layer must still be applied
|
||||
allApplied = !effectApplied;
|
||||
if (effectApplied) {
|
||||
layerEffects = getLayeredEffects(game);
|
||||
}
|
||||
}
|
||||
|
||||
layer = filterLayeredEffects(layerEffects, Layer.PTChangingEffects_7);
|
||||
for (ContinuousEffect effect: layer) {
|
||||
HashSet<Ability> abilities = layeredEffects.getAbility(effect.getId());
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.constants.Rarity;
|
|||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class LevelerCard<T extends LevelerCard<T>> extends CardImpl<T> {
|
||||
|
||||
|
|
Loading…
Reference in a new issue