* Fixed that it was not possible to win by commander damage.

This commit is contained in:
LevelX2 2015-06-20 12:50:05 +02:00
parent 8f39a0ba1d
commit 675801e8d4
3 changed files with 17 additions and 10 deletions

View file

@ -37,6 +37,8 @@ import mage.abilities.keyword.HexproofAbility;
import mage.cards.CardImpl;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
/**
* @author nantuko
@ -52,8 +54,11 @@ public class MaskOfAvacyn extends CardImpl {
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
// Equipped creature gets +1/+2 and has hexproof.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.EQUIPMENT)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 2)));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.EQUIPMENT));
Effect effect = new BoostEquippedEffect(1, 2);
effect.setText("and has hexproof");
ability.addEffect(effect);
this.addAbility(ability);
}
public MaskOfAvacyn(final MaskOfAvacyn card) {

View file

@ -67,7 +67,7 @@ public class RingOfThune extends CardImpl {
// At the beginning of your upkeep, put a +1/+1 counter on equipped creature if it's white.
TriggeredAbility triggeredAbility = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new AddPlusOneCountersAttachedEffect(1), TargetController.YOU, false);
ConditionalTriggeredAbility ability = new ConditionalTriggeredAbility(triggeredAbility, new EquippedMatchesFilterCondition(filter), "At the beginning of your upkeep, put a +1/+1 counter on equipped creature if it's white");
ConditionalTriggeredAbility ability = new ConditionalTriggeredAbility(triggeredAbility, new EquippedMatchesFilterCondition(filter), "At the beginning of your upkeep, put a +1/+1 counter on equipped creature if it's white.");
this.addAbility(ability);
// Equip {1}

View file

@ -56,8 +56,10 @@ import mage.watchers.common.CommanderInfoWatcher;
public abstract class GameCommanderImpl extends GameImpl {
static boolean CHECK_COMMANDER_DAMAGE = true;
private final Map<UUID, Cards> mulliganedCards = new HashMap<>();
private final Set<CommanderInfoWatcher> commanderCombatWatcher = new HashSet<>();
// private final Set<CommanderInfoWatcher> commanderCombatWatcher = new HashSet<>();
protected boolean alsoHand; // replace commander going to hand
protected boolean alsoLibrary; // replace commander going to library
@ -91,9 +93,8 @@ public abstract class GameCommanderImpl extends GameImpl {
ability.addEffect(new CommanderCostModification(commander.getId()));
ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
getState().setValue(commander.getId() + "_castCount", 0);
CommanderInfoWatcher watcher = new CommanderInfoWatcher(commander.getId(), true);
CommanderInfoWatcher watcher = new CommanderInfoWatcher(commander.getId(), CHECK_COMMANDER_DAMAGE);
getState().getWatchers().add(watcher);
this.commanderCombatWatcher.add(watcher);
watcher.addCardInfoToCommander(this);
}
}
@ -185,12 +186,13 @@ public abstract class GameCommanderImpl extends GameImpl {
*/
@Override
protected boolean checkStateBasedActions() {
for (CommanderInfoWatcher damageWatcher: commanderCombatWatcher) {
for (Player player: getPlayers().values()) {
CommanderInfoWatcher damageWatcher = (CommanderInfoWatcher) getState().getWatchers().get("CommanderCombatDamageWatcher", player.getCommanderId());
for(Map.Entry<UUID, Integer> entrySet : damageWatcher.getDamageToPlayer().entrySet()){
if (entrySet.getValue() > 20) {
Player player = getPlayer(entrySet.getKey());
if (player != null && player.isInGame()){
player.lost(this);
Player opponent = getPlayer(entrySet.getKey());
if (opponent != null && player.isInGame()){
opponent.lost(this);
}
}
}