mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
fixes
This commit is contained in:
parent
9c4fb8ed90
commit
fe3e76b64e
8 changed files with 34 additions and 15 deletions
|
|
@ -154,7 +154,7 @@ public abstract class ActivatedAbilityImpl<T extends ActivatedAbilityImpl<T>> ex
|
|||
return true;
|
||||
else {
|
||||
Card card = (Card)game.getObject(this.sourceId);
|
||||
if (card != null)
|
||||
if (card != null && card.getZone() != Zone.BATTLEFIELD)
|
||||
return card.getOwnerId().equals(playerId);
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public interface ContinuousEffect<T extends ContinuousEffect<T>> extends Effect<
|
|||
public boolean isUsed();
|
||||
public Duration getDuration();
|
||||
public Date getTimestamp();
|
||||
public void setTimestamp();
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game);
|
||||
public boolean hasLayer(Layer layer);
|
||||
public void init(Ability source, Game game);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,11 @@ public abstract class ContinuousEffectImpl<T extends ContinuousEffectImpl<T>> ex
|
|||
return timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTimestamp() {
|
||||
this.timestamp = new Date();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return this.layer == layer;
|
||||
|
|
|
|||
|
|
@ -261,14 +261,26 @@ public class ContinuousEffects implements Serializable {
|
|||
}
|
||||
|
||||
public void addEffect(ContinuousEffect effect, Ability source) {
|
||||
if (effect instanceof ReplacementEffect)
|
||||
replacementEffects.put((ReplacementEffect)effect, source);
|
||||
else if (effect instanceof PreventionEffect)
|
||||
preventionEffects.put((PreventionEffect)effect, source);
|
||||
else if (effect instanceof AsThoughEffect)
|
||||
asThoughEffects.put((AsThoughEffect) effect,source);
|
||||
else
|
||||
layeredEffects.put(effect, source);
|
||||
if (effect instanceof ReplacementEffect) {
|
||||
ReplacementEffect newEffect = (ReplacementEffect)effect.copy();
|
||||
newEffect.setTimestamp();
|
||||
replacementEffects.put(newEffect, source);
|
||||
}
|
||||
else if (effect instanceof PreventionEffect) {
|
||||
PreventionEffect newEffect = (PreventionEffect)effect.copy();
|
||||
newEffect.setTimestamp();
|
||||
preventionEffects.put(newEffect, source);
|
||||
}
|
||||
else if (effect instanceof AsThoughEffect) {
|
||||
AsThoughEffect newEffect = (AsThoughEffect)effect.copy();
|
||||
newEffect.setTimestamp();
|
||||
asThoughEffects.put(newEffect,source);
|
||||
}
|
||||
else {
|
||||
ContinuousEffect newEffect = (ContinuousEffect)effect.copy();
|
||||
newEffect.setTimestamp();
|
||||
layeredEffects.put(newEffect, source);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue