mirror of
https://github.com/correl/mage.git
synced 2024-12-27 11:07:39 +00:00
- Fixed Sokenzan Renegade. #4614
This commit is contained in:
parent
4a77ab1714
commit
9647083f60
1 changed files with 16 additions and 15 deletions
|
@ -30,7 +30,7 @@ package mage.cards.s;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUntapTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
@ -57,7 +57,7 @@ import mage.target.targetpointer.FixedTarget;
|
||||||
public class SokenzanRenegade extends CardImpl {
|
public class SokenzanRenegade extends CardImpl {
|
||||||
|
|
||||||
public SokenzanRenegade(UUID ownerId, CardSetInfo setInfo) {
|
public SokenzanRenegade(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||||
this.subtype.add(SubType.OGRE);
|
this.subtype.add(SubType.OGRE);
|
||||||
this.subtype.add(SubType.SAMURAI);
|
this.subtype.add(SubType.SAMURAI);
|
||||||
this.subtype.add(SubType.MERCENARY);
|
this.subtype.add(SubType.MERCENARY);
|
||||||
|
@ -69,7 +69,7 @@ public class SokenzanRenegade extends CardImpl {
|
||||||
this.addAbility(new BushidoAbility(1));
|
this.addAbility(new BushidoAbility(1));
|
||||||
// At the beginning of your upkeep, if a player has more cards in hand than each other player, the player who has the most cards in hand gains control of Sokenzan Renegade.
|
// At the beginning of your upkeep, if a player has more cards in hand than each other player, the player who has the most cards in hand gains control of Sokenzan Renegade.
|
||||||
this.addAbility(new ConditionalTriggeredAbility(
|
this.addAbility(new ConditionalTriggeredAbility(
|
||||||
new BeginningOfUntapTriggeredAbility(Zone.BATTLEFIELD, new SokenzanRenegadeEffect(), TargetController.YOU, false),
|
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SokenzanRenegadeEffect(), TargetController.YOU, false),
|
||||||
OnePlayerHasTheMostCards.instance,
|
OnePlayerHasTheMostCards.instance,
|
||||||
"At the beginning of your upkeep, if a player has more cards in hand than each other player, the player who has the most cards in hand gains control of {this}"
|
"At the beginning of your upkeep, if a player has more cards in hand than each other player, the player who has the most cards in hand gains control of {this}"
|
||||||
));
|
));
|
||||||
|
@ -106,24 +106,25 @@ class SokenzanRenegadeEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
if (controller != null && sourcePermanent != null) {
|
if (controller != null
|
||||||
|
&& sourcePermanent != null) {
|
||||||
int max = Integer.MIN_VALUE;
|
int max = Integer.MIN_VALUE;
|
||||||
Player newController = null;
|
Player newController = null;
|
||||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (player.getLife() > max) {
|
if (player.getHand().size() > max) {
|
||||||
max = player.getLife();
|
max = player.getHand().size();
|
||||||
newController = player;
|
newController = player;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newController != null) {
|
if (newController != null) {
|
||||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true, newController.getId());
|
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
|
||||||
effect.setTargetPointer(new FixedTarget(newController.getId()));
|
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
if (!source.getControllerId().equals(newController.getId())) {
|
if (!source.getControllerId().equals(newController.getId())) {
|
||||||
game.informPlayers(newController.getLogName() + " got controll of " + sourcePermanent.getLogName());
|
game.informPlayers(newController.getLogName() + " got control of " + sourcePermanent.getLogName());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -142,13 +143,13 @@ enum OnePlayerHasTheMostCards implements Condition {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
int max = Integer.MIN_VALUE;
|
int max = Integer.MIN_VALUE;
|
||||||
boolean onlyOnePlayer = false;
|
boolean onlyOnePlayer = false;
|
||||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (player.getLife() > max) {
|
if (player.getHand().size() > max) {
|
||||||
max = player.getLife();
|
max = player.getHand().size();
|
||||||
onlyOnePlayer = true;
|
onlyOnePlayer = true;
|
||||||
} else if (player.getLife() == max) {
|
} else if (player.getHand().size() == max) {
|
||||||
onlyOnePlayer = false;
|
onlyOnePlayer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue