mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
Merge
This commit is contained in:
commit
b09de12f23
30 changed files with 636 additions and 232 deletions
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.choices.Choices;
|
||||
|
|
@ -36,7 +37,7 @@ import mage.target.Targets;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class Mode {
|
||||
public class Mode implements Serializable {
|
||||
|
||||
protected UUID id;
|
||||
protected Targets targets;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ public class DamageTargetEffect extends OneShotEffect<DamageTargetEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// game.getPermanent(source.getControllerId()).getName();
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(amount.calculate(game, source), source.getSourceId(), game, preventable, false);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Layer;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class CantBeBlockedByOneEffect extends ContinuousEffectImpl<CantBeBlockedByOneEffect> {
|
||||
|
||||
protected int amount;
|
||||
|
||||
public CantBeBlockedByOneEffect(int amount) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
staticText = "{this} can't be blocked except by " + amount + " or more creatures";
|
||||
}
|
||||
|
||||
public CantBeBlockedByOneEffect(final CantBeBlockedByOneEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantBeBlockedByOneEffect copy() {
|
||||
return new CantBeBlockedByOneEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent perm = game.getPermanent(source.getSourceId());
|
||||
if (perm != null) {
|
||||
switch (layer) {
|
||||
case RulesEffects:
|
||||
perm.setMinBlockedBy(amount);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.RulesEffects;
|
||||
}
|
||||
}
|
||||
|
|
@ -164,6 +164,10 @@ public interface Game extends MageItem, Serializable {
|
|||
// game options
|
||||
public void setGameOptions(GameOptions options);
|
||||
|
||||
// game times
|
||||
public Date getStartTime();
|
||||
public Date getEndTime();
|
||||
|
||||
// game cheats (for tests only)
|
||||
public void cheat(UUID ownerId, Map<Zone, String> commands);
|
||||
public void cheat(UUID ownerId, List<Card> library, List<Card> hand, List<PermanentCard> battlefield, List<Card> graveyard);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
protected Map<UUID, Card> gameCards = new HashMap<UUID, Card>();
|
||||
protected Map<UUID, Card> lki = new HashMap<UUID, Card>();
|
||||
protected GameState state;
|
||||
|
||||
protected Date startTime;
|
||||
protected Date endTime;
|
||||
protected UUID startingPlayerId;
|
||||
protected UUID winnerId;
|
||||
|
||||
|
|
@ -279,6 +282,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
}
|
||||
if (remainingPlayers <= 1 || numLosers >= state.getPlayers().size() - 1) {
|
||||
state.endGame();
|
||||
endTime = new Date();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -338,6 +342,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
|
||||
@Override
|
||||
public void start(UUID choosingPlayerId, GameOptions options) {
|
||||
startTime = new Date();
|
||||
init(choosingPlayerId, options.testMode);
|
||||
PlayerList players = state.getPlayerList(startingPlayerId);
|
||||
Player player = getPlayer(players.get());
|
||||
|
|
@ -1167,10 +1172,16 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
}
|
||||
}
|
||||
|
||||
public void clearGraveyard(UUID playerId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGameOptions(GameOptions options) {
|
||||
this.gameOptions = options;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue