mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed a bug of Curse of Exhaustion checking always controlling player.
This commit is contained in:
parent
82c44b2b3b
commit
dcc9828f0f
1 changed files with 6 additions and 4 deletions
|
@ -97,8 +97,9 @@ class CurseOfExhaustionWatcher extends WatcherImpl<CurseOfExhaustionWatcher> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (condition == true) //no need to check - condition has already occured
|
if (condition == true) {//no need to check - condition has already occured
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST ) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST ) {
|
||||||
Permanent enchantment = game.getPermanent(this.sourceId);
|
Permanent enchantment = game.getPermanent(this.sourceId);
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
|
@ -116,7 +117,7 @@ class CurseOfExhaustionEffect extends ReplacementEffectImpl<CurseOfExhaustionEff
|
||||||
|
|
||||||
public CurseOfExhaustionEffect() {
|
public CurseOfExhaustionEffect() {
|
||||||
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit);
|
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit);
|
||||||
staticText = "Enchanted player can't cast more than one spell each turn.";
|
staticText = "Enchanted player can't cast more than one spell each turn";
|
||||||
}
|
}
|
||||||
|
|
||||||
public CurseOfExhaustionEffect(final CurseOfExhaustionEffect effect) {
|
public CurseOfExhaustionEffect(final CurseOfExhaustionEffect effect) {
|
||||||
|
@ -145,12 +146,13 @@ class CurseOfExhaustionEffect extends ReplacementEffectImpl<CurseOfExhaustionEff
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
Player player = game.getPlayer(enchantment.getAttachedTo());
|
||||||
if (player != null && event.getPlayerId().equals(player.getId())) {
|
if (player != null && event.getPlayerId().equals(player.getId())) {
|
||||||
Watcher watcher = game.getState().getWatchers().get("SpellCast", source.getControllerId());
|
Watcher watcher = game.getState().getWatchers().get("SpellCast", player.getId());
|
||||||
if (watcher != null && watcher.conditionMet())
|
if (watcher != null && watcher.conditionMet()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue