mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
* Cursed Rack - Fixed that the hand size modification was applied to the controller of the cursed rack instead of the chosen opponent.
This commit is contained in:
parent
7fead9c74f
commit
c98671282f
2 changed files with 39 additions and 9 deletions
|
@ -350,7 +350,6 @@ public class Main {
|
|||
|
||||
@Override
|
||||
public void setInvoker(ServerInvoker invoker) {
|
||||
logger.info("Invoker version: " + ((BisocketServerInvoker) invoker).getVersion());
|
||||
((BisocketServerInvoker) invoker).setSecondaryBindPort(ConfigSettings.getInstance().getSecondaryBindPort());
|
||||
((BisocketServerInvoker) invoker).setBacklog(ConfigSettings.getInstance().getBacklogSize());
|
||||
((BisocketServerInvoker) invoker).setNumAcceptThreads(ConfigSettings.getInstance().getNumAcceptThreads());
|
||||
|
|
|
@ -29,15 +29,20 @@ package mage.cards.c;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseOpponentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,14 +51,12 @@ import mage.target.common.TargetOpponent;
|
|||
public class CursedRack extends CardImpl {
|
||||
|
||||
public CursedRack(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
// As Cursed Rack enters the battlefield, choose an opponent.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponentEffect(Outcome.Detriment)));
|
||||
// The chosen player's maximum hand size is four.
|
||||
Effect effect = new MaximumHandSizeControllerEffect(4, Duration.WhileOnBattlefield, MaximumHandSizeControllerEffect.HandSizeModification.SET);
|
||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CursedRackHandSizeEffect()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -66,3 +69,31 @@ public class CursedRack extends CardImpl {
|
|||
return new CursedRack(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CursedRackHandSizeEffect extends ContinuousEffectImpl {
|
||||
|
||||
public CursedRackHandSizeEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "The chosen player's maximum hand size is four";
|
||||
}
|
||||
|
||||
public CursedRackHandSizeEffect(final CursedRackHandSizeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CursedRackHandSizeEffect copy() {
|
||||
return new CursedRackHandSizeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + ChooseOpponentEffect.VALUE_KEY);
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
opponent.setMaxHandSize(4);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue