mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Fixed Issue 362
This commit is contained in:
parent
1f94c38cb0
commit
b9dd394f57
3 changed files with 8 additions and 10 deletions
|
|
@ -260,5 +260,5 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
|
||||||
public Abilities<T> copy();
|
public Abilities<T> copy();
|
||||||
|
|
||||||
public Map<ReplacementEffect, Ability> getReplacementEffects(Zone zone);
|
public Map<ReplacementEffect, Ability> getReplacementEffects(Zone zone);
|
||||||
public Map<Effect, Ability> getEffects(Zone zone, EffectType effectType);
|
public Map<Effect, Ability> getEffects(Game game, Zone zone, EffectType effectType);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,14 +176,12 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Effect, Ability> getEffects(Zone zone, EffectType effectType) {
|
public Map<Effect, Ability> getEffects(Game game, Zone zone, EffectType effectType) {
|
||||||
Map<Effect, Ability> effects = new HashMap<Effect, Ability>();
|
Map<Effect, Ability> effects = new HashMap<Effect, Ability>();
|
||||||
for (T ability: this) {
|
for (T ability: this) {
|
||||||
if (ability instanceof StaticAbility && ability.getZone().match(zone)) {
|
if (ability instanceof StaticAbility && ability.getZone().match(zone)) {
|
||||||
for (Effect effect: ability.getEffects()) {
|
for (Effect effect: ability.getEffects(game, effectType)) {
|
||||||
if (effect.getEffectType() == effectType) {
|
effects.put(effect, ability);
|
||||||
effects.put(effect, ability);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,14 +218,14 @@ public class ContinuousEffects implements Serializable {
|
||||||
for (Card card: game.getCards()) {
|
for (Card card: game.getCards()) {
|
||||||
Zone zone = game.getState().getZone(card.getId());
|
Zone zone = game.getState().getZone(card.getId());
|
||||||
if (zone == Zone.HAND || zone == Zone.GRAVEYARD) {
|
if (zone == Zone.HAND || zone == Zone.GRAVEYARD) {
|
||||||
for (Entry<Effect, Ability> entry: card.getAbilities().getEffects(zone, EffectType.CONTINUOUS).entrySet()) {
|
for (Entry<Effect, Ability> entry: card.getAbilities().getEffects(game, zone, EffectType.CONTINUOUS).entrySet()) {
|
||||||
layerEffects.add((ContinuousEffect)entry.getKey());
|
layerEffects.add((ContinuousEffect)entry.getKey());
|
||||||
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getAllPermanents()) {
|
for (Permanent permanent: game.getBattlefield().getAllPermanents()) {
|
||||||
for (Entry<Effect, Ability> entry: permanent.getAbilities().getEffects(Zone.BATTLEFIELD, EffectType.CONTINUOUS).entrySet()) {
|
for (Entry<Effect, Ability> entry: permanent.getAbilities().getEffects(game, Zone.BATTLEFIELD, EffectType.CONTINUOUS).entrySet()) {
|
||||||
layerEffects.add((ContinuousEffect)entry.getKey());
|
layerEffects.add((ContinuousEffect)entry.getKey());
|
||||||
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +247,7 @@ public class ContinuousEffects implements Serializable {
|
||||||
List<RequirementEffect> effects = new ArrayList<RequirementEffect>();
|
List<RequirementEffect> effects = new ArrayList<RequirementEffect>();
|
||||||
//get all applicable Requirement effects on the battlefield
|
//get all applicable Requirement effects on the battlefield
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(permanent.getControllerId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(permanent.getControllerId(), game)) {
|
||||||
for (Entry<Effect, Ability> entry: perm.getAbilities().getEffects(Zone.BATTLEFIELD, EffectType.REQUIREMENT).entrySet()) {
|
for (Entry<Effect, Ability> entry: perm.getAbilities().getEffects(game, Zone.BATTLEFIELD, EffectType.REQUIREMENT).entrySet()) {
|
||||||
if (((RequirementEffect)entry.getKey()).applies(permanent, entry.getValue(), game)) {
|
if (((RequirementEffect)entry.getKey()).applies(permanent, entry.getValue(), game)) {
|
||||||
effects.add((RequirementEffect)entry.getKey());
|
effects.add((RequirementEffect)entry.getKey());
|
||||||
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
||||||
|
|
@ -265,7 +265,7 @@ public class ContinuousEffects implements Serializable {
|
||||||
List<RestrictionEffect> effects = new ArrayList<RestrictionEffect>();
|
List<RestrictionEffect> effects = new ArrayList<RestrictionEffect>();
|
||||||
//get all applicable Restriction effects on the battlefield
|
//get all applicable Restriction effects on the battlefield
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(permanent.getControllerId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(permanent.getControllerId(), game)) {
|
||||||
for (Entry<Effect, Ability> entry: perm.getAbilities().getEffects(Zone.BATTLEFIELD, EffectType.RESTRICTION).entrySet()) {
|
for (Entry<Effect, Ability> entry: perm.getAbilities().getEffects(game, Zone.BATTLEFIELD, EffectType.RESTRICTION).entrySet()) {
|
||||||
if (((RestrictionEffect)entry.getKey()).applies(permanent, entry.getValue(), game)) {
|
if (((RestrictionEffect)entry.getKey()).applies(permanent, entry.getValue(), game)) {
|
||||||
effects.add((RestrictionEffect)entry.getKey());
|
effects.add((RestrictionEffect)entry.getKey());
|
||||||
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
abilityMap.put(entry.getKey().getId(), entry.getValue());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue