mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Merge branch 'master' of https://github.com/magefree/mage
This commit is contained in:
commit
a0fb5bfe22
12 changed files with 76 additions and 76 deletions
|
@ -50,6 +50,8 @@ public class GhostlyPrison extends CardImpl {
|
||||||
super(ownerId, 10, "Ghostly Prison", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
|
super(ownerId, 10, "Ghostly Prison", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
|
||||||
this.expansionSetCode = "CHK";
|
this.expansionSetCode = "CHK";
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
|
|
||||||
|
// Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GhostlyPrisonReplacementEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GhostlyPrisonReplacementEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,10 +89,10 @@ class GhostlyPrisonReplacementEffect extends ReplacementEffectImpl {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
|
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
||||||
ManaCostsImpl propagandaTax = new ManaCostsImpl("{2}");
|
ManaCostsImpl attackTax = new ManaCostsImpl("{2}");
|
||||||
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
if ( attackTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
||||||
player.chooseUse(Outcome.Benefit, "Pay {2} to declare attacker?", game) ) {
|
player.chooseUse(Outcome.Benefit, "Pay {2} to attack player?", game) ) {
|
||||||
if (propagandaTax.payOrRollback(source, game, this.getId(), event.getPlayerId())) {
|
if (attackTax.payOrRollback(source, game, this.getId(), event.getPlayerId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +105,11 @@ class GhostlyPrisonReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId()) ) {
|
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId()) ) {
|
||||||
return true;
|
Player attackedPlayer = game.getPlayer(event.getTargetId());
|
||||||
|
if (attackedPlayer != null) {
|
||||||
|
// only if a player is attacked. Attacking a planeswalker is free
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
|
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continious.BoostTargetEffect;
|
import mage.abilities.effects.common.continious.BoostTargetEffect;
|
||||||
import mage.abilities.keyword.ChampionAbility;
|
import mage.abilities.keyword.ChampionAbility;
|
||||||
|
@ -76,7 +77,9 @@ public class UnstoppableAsh extends CardImpl {
|
||||||
this.addAbility(new ChampionAbility(this, new String[]{"Treefolk", "Warrior"}));
|
this.addAbility(new ChampionAbility(this, new String[]{"Treefolk", "Warrior"}));
|
||||||
|
|
||||||
// Whenever a creature you control becomes blocked, it gets +0/+5 until end of turn.
|
// Whenever a creature you control becomes blocked, it gets +0/+5 until end of turn.
|
||||||
this.addAbility(new BecomesBlockedAllTriggeredAbility(new UnstoppableAshEffect(), false, filter, true));
|
Effect effect = new BoostTargetEffect(0, 5, Duration.EndOfTurn);
|
||||||
|
effect.setText("it gets +0/+5 until end of turn");
|
||||||
|
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false, filter, true));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,30 +92,3 @@ public class UnstoppableAsh extends CardImpl {
|
||||||
return new UnstoppableAsh(this);
|
return new UnstoppableAsh(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UnstoppableAshEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
UnstoppableAshEffect() {
|
|
||||||
super(Outcome.Neutral);
|
|
||||||
staticText = "it gets +0/+5 until end of turn";
|
|
||||||
}
|
|
||||||
|
|
||||||
UnstoppableAshEffect(final UnstoppableAshEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
|
||||||
if (creature != null) {
|
|
||||||
game.addEffect(new BoostTargetEffect(0, 5, Duration.EndOfTurn), source);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UnstoppableAshEffect copy() {
|
|
||||||
return new UnstoppableAshEffect(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -89,11 +89,11 @@ class PropagandaReplacementEffect extends ReplacementEffectImpl {
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
if ( player != null ) {
|
if ( player != null ) {
|
||||||
ManaCostsImpl propagandaTax = new ManaCostsImpl("{2}");
|
ManaCostsImpl attackTax = new ManaCostsImpl("{2}");
|
||||||
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
if ( attackTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
||||||
player.chooseUse(Outcome.Neutral, "Pay {2} to declare attacker?", game) )
|
player.chooseUse(Outcome.Neutral, "Pay {2} to attack player?", game) )
|
||||||
{
|
{
|
||||||
if (propagandaTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId()) ) {
|
if (attackTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId()) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,11 @@ class PropagandaReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId())) {
|
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId())) {
|
||||||
return true;
|
Player attackedPlayer = game.getPlayer(event.getTargetId());
|
||||||
|
if (attackedPlayer != null) {
|
||||||
|
// only if a player is attacked. Attacking a planeswalker is free
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ import mage.game.events.GameEvent;
|
||||||
*
|
*
|
||||||
* @author Plopman
|
* @author Plopman
|
||||||
*/
|
*/
|
||||||
public class SeaMonster extends CardImpl {
|
public class SeaMonster extends CardImpl {
|
||||||
|
|
||||||
public SeaMonster(UUID ownerId) {
|
public SeaMonster(UUID ownerId) {
|
||||||
super(ownerId, 85, "Sea Monster", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
|
super(ownerId, 85, "Sea Monster", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
|
||||||
|
|
|
@ -54,9 +54,12 @@ public class WindbornMuse extends CardImpl {
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
this.power = new MageInt(2);
|
this.power = new MageInt(2);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Flying
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WindbornMuseReplacementEffect()));
|
|
||||||
// Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
|
// Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you.
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WindbornMuseReplacementEffect()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindbornMuse(final WindbornMuse card) {
|
public WindbornMuse(final WindbornMuse card) {
|
||||||
|
@ -92,11 +95,11 @@ class WindbornMuseReplacementEffect extends ReplacementEffectImpl {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
|
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
||||||
ManaCostsImpl propagandaTax = new ManaCostsImpl("{2}");
|
ManaCostsImpl attackTax = new ManaCostsImpl("{2}");
|
||||||
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
if ( attackTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
||||||
player.chooseUse(Outcome.Benefit, "Pay {2} to declare attacker?", game) )
|
player.chooseUse(Outcome.Benefit, "Pay {2} to attack player?", game) )
|
||||||
{
|
{
|
||||||
if (propagandaTax.payOrRollback(source, game, this.getId(), event.getPlayerId())) {
|
if (attackTax.payOrRollback(source, game, this.getId(), event.getPlayerId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +112,11 @@ class WindbornMuseReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId()) ) {
|
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId()) ) {
|
||||||
return true;
|
Player attackedPlayer = game.getPlayer(event.getTargetId());
|
||||||
|
if (attackedPlayer != null) {
|
||||||
|
// only if a player is attacked. Attacking a planeswalker is free
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,10 +133,10 @@ class ElephantGrassReplacementEffect2 extends ReplacementEffectImpl {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
|
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
||||||
ManaCostsImpl cost = new ManaCostsImpl("{2}");
|
ManaCostsImpl attackCost = new ManaCostsImpl("{2}");
|
||||||
if ( cost.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
if ( attackCost.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
||||||
player.chooseUse(Outcome.Benefit, "Pay {2} to declare attacker?", game) ) {
|
player.chooseUse(Outcome.Benefit, "Pay {2} to attack player?", game) ) {
|
||||||
if (cost.payOrRollback(source, game, this.getId(), event.getPlayerId())) {
|
if (attackCost.payOrRollback(source, game, this.getId(), event.getPlayerId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,8 +150,12 @@ class ElephantGrassReplacementEffect2 extends ReplacementEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId()) ) {
|
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId()) ) {
|
||||||
Permanent creature = game.getPermanent(event.getSourceId());
|
Permanent creature = game.getPermanent(event.getSourceId());
|
||||||
if(creature != null && !creature.getColor().isBlack()){
|
if (creature != null && !creature.getColor().isBlack()) {
|
||||||
return true;
|
Player attackedPlayer = game.getPlayer(event.getTargetId());
|
||||||
|
if (attackedPlayer != null) {
|
||||||
|
// only if a player is attacked. Attacking a planeswalker is free
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -120,10 +120,10 @@ class KinshipBaseEffect extends OneShotEffect {
|
||||||
Card card = controller.getLibrary().getFromTop(game);
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
Cards cards = new CardsImpl(card);
|
Cards cards = new CardsImpl(card);
|
||||||
controller.lookAtCards(sourcePermanent.getName(), cards, game);
|
controller.lookAtCards(sourcePermanent.getLogName(), cards, game);
|
||||||
if (CardUtil.shareSubtypes(sourcePermanent, card)) {
|
if (CardUtil.shareSubtypes(sourcePermanent, card)) {
|
||||||
if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getName()).append("?").toString(), game)) {
|
if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append("?").toString(), game)) {
|
||||||
controller.revealCards(sourcePermanent.getName(), cards, game);
|
controller.revealCards(sourcePermanent.getLogName(), cards, game);
|
||||||
for (Effect effect: kinshipEffects) {
|
for (Effect effect: kinshipEffects) {
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
if (effect.getEffectType().equals(EffectType.ONESHOT)) {
|
if (effect.getEffectType().equals(EffectType.ONESHOT)) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ import mage.game.Game;
|
||||||
public class CastCommanderAbility extends SpellAbility {
|
public class CastCommanderAbility extends SpellAbility {
|
||||||
|
|
||||||
public CastCommanderAbility(Card card) {
|
public CastCommanderAbility(Card card) {
|
||||||
super(card.getManaCost(), card.getName(), Zone.COMMAND, SpellAbilityType.BASE);
|
super(card.getManaCost(), card.getLogName(), Zone.COMMAND, SpellAbilityType.BASE);
|
||||||
this.timing = TimingRule.SORCERY;
|
this.timing = TimingRule.SORCERY;
|
||||||
this.usesStack = true;
|
this.usesStack = true;
|
||||||
this.controllerId = card.getOwnerId();
|
this.controllerId = card.getOwnerId();
|
||||||
|
|
|
@ -524,6 +524,9 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
public void restoreState(int bookmark) {
|
public void restoreState(int bookmark) {
|
||||||
if (!simulation) {
|
if (!simulation) {
|
||||||
if (bookmark != 0) {
|
if (bookmark != 0) {
|
||||||
|
if (savedStates.contains(bookmark - 1)) {
|
||||||
|
throw new UnsupportedOperationException("It was not possible to do the requested undo operation (bookmark " + (bookmark -1) + " does not exist)");
|
||||||
|
}
|
||||||
int stateNum = savedStates.get(bookmark - 1);
|
int stateNum = savedStates.get(bookmark - 1);
|
||||||
removeBookmark(bookmark);
|
removeBookmark(bookmark);
|
||||||
GameState restore = gameStates.rollback(stateNum);
|
GameState restore = gameStates.rollback(stateNum);
|
||||||
|
|
|
@ -260,7 +260,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
for (UUID attackingCreatureId : group.getAttackers()) {
|
for (UUID attackingCreatureId : group.getAttackers()) {
|
||||||
Permanent attacker = game.getPermanent(attackingCreatureId);
|
Permanent attacker = game.getPermanent(attackingCreatureId);
|
||||||
if (count > 1 && attacker != null && attacker.getAbilities().containsKey(CanAttackOnlyAloneAbility.getInstance().getId())) {
|
if (count > 1 && attacker != null && attacker.getAbilities().containsKey(CanAttackOnlyAloneAbility.getInstance().getId())) {
|
||||||
game.informPlayers(attacker.getName() + " can only attack alone. Removing it from combat.");
|
game.informPlayers(attacker.getLogName() + " can only attack alone. Removing it from combat.");
|
||||||
tobeRemoved.add(attackingCreatureId);
|
tobeRemoved.add(attackingCreatureId);
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
for (UUID attackingCreatureId : group.getAttackers()) {
|
for (UUID attackingCreatureId : group.getAttackers()) {
|
||||||
Permanent attacker = game.getPermanent(attackingCreatureId);
|
Permanent attacker = game.getPermanent(attackingCreatureId);
|
||||||
if (attacker != null && attacker.getAbilities().containsKey(CantAttackAloneAbility.getInstance().getId())) {
|
if (attacker != null && attacker.getAbilities().containsKey(CantAttackAloneAbility.getInstance().getId())) {
|
||||||
game.informPlayers(attacker.getName() + " can't attack alone. Removing it from combat.");
|
game.informPlayers(attacker.getLogName() + " can't attack alone. Removing it from combat.");
|
||||||
tobeRemoved.add(attackingCreatureId);
|
tobeRemoved.add(attackingCreatureId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,13 +358,13 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
Permanent attackingCreature = game.getPermanent(attackingCreatureId);
|
Permanent attackingCreature = game.getPermanent(attackingCreatureId);
|
||||||
if (attackingCreature != null) {
|
if (attackingCreature != null) {
|
||||||
sb.append("Attacker: ");
|
sb.append("Attacker: ");
|
||||||
sb.append(attackingCreature.getName()).append(" (");
|
sb.append(attackingCreature.getLogName()).append(" (");
|
||||||
sb.append(attackingCreature.getPower().getValue()).append("/").append(attackingCreature.getToughness().getValue()).append(") ");
|
sb.append(attackingCreature.getPower().getValue()).append("/").append(attackingCreature.getToughness().getValue()).append(") ");
|
||||||
} else {
|
} else {
|
||||||
// creature left battlefield
|
// creature left battlefield
|
||||||
attackingCreature = (Permanent) game.getLastKnownInformation(attackingCreatureId, Zone.BATTLEFIELD);
|
attackingCreature = (Permanent) game.getLastKnownInformation(attackingCreatureId, Zone.BATTLEFIELD);
|
||||||
if (attackingCreature != null) {
|
if (attackingCreature != null) {
|
||||||
sb.append(attackingCreature.getName()).append(" [left battlefield)] ");
|
sb.append(attackingCreature.getLogName()).append(" [left battlefield)] ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
for (UUID blockingCreatureId : group.getBlockers()) {
|
for (UUID blockingCreatureId : group.getBlockers()) {
|
||||||
Permanent blockingCreature = game.getPermanent(blockingCreatureId);
|
Permanent blockingCreature = game.getPermanent(blockingCreatureId);
|
||||||
if (blockingCreature != null) {
|
if (blockingCreature != null) {
|
||||||
sb.append(blockingCreature.getName()).append(" (");
|
sb.append(blockingCreature.getLogName()).append(" (");
|
||||||
sb.append(blockingCreature.getPower().getValue()).append("/").append(blockingCreature.getToughness().getValue()).append(") ");
|
sb.append(blockingCreature.getPower().getValue()).append("/").append(blockingCreature.getToughness().getValue()).append(") ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
// if so inform human player or set block for AI player
|
// if so inform human player or set block for AI player
|
||||||
if (mayBlock) {
|
if (mayBlock) {
|
||||||
if (controller.isHuman()) {
|
if (controller.isHuman()) {
|
||||||
game.informPlayer(controller, "Creature should block this turn: " + creature.getName());
|
game.informPlayer(controller, "Creature should block this turn: " + creature.getLogName());
|
||||||
} else {
|
} else {
|
||||||
Player defender = game.getPlayer(creature.getControllerId());
|
Player defender = game.getPlayer(creature.getControllerId());
|
||||||
if (defender != null) {
|
if (defender != null) {
|
||||||
|
@ -622,7 +622,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (possibleBlockerAvailable) {
|
if (possibleBlockerAvailable) {
|
||||||
game.informPlayer(controller, new StringBuilder(toBeBlockedCreature.getName()).append(" has to be blocked by at least one creature.").toString());
|
game.informPlayer(controller, new StringBuilder(toBeBlockedCreature.getLogName()).append(" has to be blocked by at least one creature.").toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -681,7 +681,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!blockIsValid) {
|
if (!blockIsValid) {
|
||||||
sb.append(" ").append(creatureForcedToBlock.getName());
|
sb.append(" ").append(creatureForcedToBlock.getLogName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sb.length() > 0) {
|
if (sb.length() > 0) {
|
||||||
|
@ -711,7 +711,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
for (Ability ability : entry.getValue()) {
|
for (Ability ability : entry.getValue()) {
|
||||||
if (!effect.canBeBlockedCheckAfter(attackingCreature, ability, game)) {
|
if (!effect.canBeBlockedCheckAfter(attackingCreature, ability, game)) {
|
||||||
if (controller.isHuman()) {
|
if (controller.isHuman()) {
|
||||||
game.informPlayer(controller, new StringBuilder(attackingCreature.getName()).append(" can't be blocked this way.").toString());
|
game.informPlayer(controller, new StringBuilder(attackingCreature.getLogName()).append(" can't be blocked this way.").toString());
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// remove blocking creatures for AI
|
// remove blocking creatures for AI
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
Permanent attacker = game.getPermanent(attackers.get(0));
|
Permanent attacker = game.getPermanent(attackers.get(0));
|
||||||
if (attacker.getAbilities().containsKey(DamageAsThoughNotBlockedAbility.getInstance().getId())) {
|
if (attacker.getAbilities().containsKey(DamageAsThoughNotBlockedAbility.getInstance().getId())) {
|
||||||
Player player = game.getPlayer(attacker.getControllerId());
|
Player player = game.getPlayer(attacker.getControllerId());
|
||||||
if (player.chooseUse(Outcome.Damage, "Do you wish to assign damage for " + attacker.getName() + " as though it weren't blocked?", game)) {
|
if (player.chooseUse(Outcome.Damage, "Do you wish to assign damage for " + attacker.getLogName() + " as though it weren't blocked?", game)) {
|
||||||
blocked = false;
|
blocked = false;
|
||||||
unblockedDamage(first, game);
|
unblockedDamage(first, game);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Player player = game.getPlayer(attacker.getControllerId());
|
Player player = game.getPlayer(attacker.getControllerId());
|
||||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getLogName(), game);
|
||||||
blocker.markDamage(damageAssigned, attacker.getId(), game, true, true);
|
blocker.markDamage(damageAssigned, attacker.getId(), game, true, true);
|
||||||
damage -= damageAssigned;
|
damage -= damageAssigned;
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
|
@ -298,7 +298,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
damage = 0;
|
damage = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getLogName(), game);
|
||||||
assigned.put(blockerId, damageAssigned);
|
assigned.put(blockerId, damageAssigned);
|
||||||
damage -= damageAssigned;
|
damage -= damageAssigned;
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
assigned.put(attackerId, damage);
|
assigned.put(attackerId, damage);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + attacker.getName(), game);
|
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + attacker.getLogName(), game);
|
||||||
assigned.put(attackerId, damageAssigned);
|
assigned.put(attackerId, damageAssigned);
|
||||||
damage -= damageAssigned;
|
damage -= damageAssigned;
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
Permanent blocker = game.getPermanent(blockerId);
|
Permanent blocker = game.getPermanent(blockerId);
|
||||||
if (blocker != null && blocker.getAbilities().containsKey(CantBlockAloneAbility.getInstance().getId())) {
|
if (blocker != null && blocker.getAbilities().containsKey(CantBlockAloneAbility.getInstance().getId())) {
|
||||||
blockWasLegal = false;
|
blockWasLegal = false;
|
||||||
game.informPlayers(blocker.getName() + " can't block alone. Removing it from combat.");
|
game.informPlayers(blocker.getLogName() + " can't block alone. Removing it from combat.");
|
||||||
toBeRemoved.add(blockerId);
|
toBeRemoved.add(blockerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
blockers.clear();
|
blockers.clear();
|
||||||
blockerOrder.clear();
|
blockerOrder.clear();
|
||||||
this.blocked = false;
|
this.blocked = false;
|
||||||
game.informPlayers(attacker.getName() + " can't be blocked except by " + attacker.getMinBlockedBy() + " or more creatures. Blockers discarded.");
|
game.informPlayers(attacker.getLogName() + " can't be blocked except by " + attacker.getMinBlockedBy() + " or more creatures. Blockers discarded.");
|
||||||
blockWasLegal = false;
|
blockWasLegal = false;
|
||||||
}
|
}
|
||||||
// Check if there are to many blockers (maxBlockedBy = 0 means no restrictions)
|
// Check if there are to many blockers (maxBlockedBy = 0 means no restrictions)
|
||||||
|
@ -577,7 +577,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
blockers.clear();
|
blockers.clear();
|
||||||
blockerOrder.clear();
|
blockerOrder.clear();
|
||||||
this.blocked = false;
|
this.blocked = false;
|
||||||
game.informPlayers(new StringBuilder(attacker.getName())
|
game.informPlayers(new StringBuilder(attacker.getLogName())
|
||||||
.append(" can't be blocked by more than ").append(attacker.getMaxBlockedBy())
|
.append(" can't be blocked by more than ").append(attacker.getMaxBlockedBy())
|
||||||
.append(attacker.getMaxBlockedBy()==1?" creature.":" creatures.")
|
.append(attacker.getMaxBlockedBy()==1?" creature.":" creatures.")
|
||||||
.append(" Blockers discarded.").toString());
|
.append(" Blockers discarded.").toString());
|
||||||
|
|
|
@ -792,9 +792,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) {
|
if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) {
|
||||||
if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) {
|
if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) {
|
||||||
if (this.getCardType().contains(CardType.CREATURE)) {
|
if (this.getCardType().contains(CardType.CREATURE)) {
|
||||||
game.informPlayers(new StringBuilder(this.getName()).append(" died").toString());
|
game.informPlayers(new StringBuilder(this.getLogName()).append(" died").toString());
|
||||||
} else {
|
} else {
|
||||||
game.informPlayers(new StringBuilder(this.getName()).append(" was destroyed").toString());
|
game.informPlayers(new StringBuilder(this.getLogName()).append(" was destroyed").toString());
|
||||||
}
|
}
|
||||||
game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT, objectId, sourceId, controllerId));
|
game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT, objectId, sourceId, controllerId));
|
||||||
return true;
|
return true;
|
||||||
|
@ -811,7 +811,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
moveToZone(Zone.GRAVEYARD, sourceId, game, true);
|
moveToZone(Zone.GRAVEYARD, sourceId, game, true);
|
||||||
Player player = game.getPlayer(getControllerId());
|
Player player = game.getPlayer(getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
game.informPlayers(new StringBuilder(player.getName()).append(" sacrificed ").append(this.getName()).toString());
|
game.informPlayers(new StringBuilder(player.getName()).append(" sacrificed ").append(this.getLogName()).toString());
|
||||||
}
|
}
|
||||||
game.fireEvent(GameEvent.getEvent(EventType.SACRIFICED_PERMANENT, objectId, sourceId, controllerId));
|
game.fireEvent(GameEvent.getEvent(EventType.SACRIFICED_PERMANENT, objectId, sourceId, controllerId));
|
||||||
return true;
|
return true;
|
||||||
|
@ -970,7 +970,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
public boolean removeFromCombat(Game game) {
|
public boolean removeFromCombat(Game game) {
|
||||||
if (this.isAttacking() || this.blocking > 0) {
|
if (this.isAttacking() || this.blocking > 0) {
|
||||||
if (game.getCombat().removeFromCombat(objectId, game)) {
|
if (game.getCombat().removeFromCombat(objectId, game)) {
|
||||||
game.informPlayers(new StringBuilder(this.getName()).append(" removed from combat").toString());
|
game.informPlayers(new StringBuilder(this.getLogName()).append(" removed from combat").toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue