mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
NPH - Spinebiter
This commit is contained in:
parent
8a7e4855f3
commit
d63cdfd131
3 changed files with 178 additions and 34 deletions
67
Mage.Sets/src/mage/sets/newphyrexia/Spinebiter.java
Normal file
67
Mage.Sets/src/mage/sets/newphyrexia/Spinebiter.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.sets.newphyrexia;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DamageAsThoughNotBlockedAbility;
|
||||
import mage.abilities.keyword.InfectAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class Spinebiter extends CardImpl<Spinebiter> {
|
||||
|
||||
public Spinebiter(UUID ownerId) {
|
||||
super(ownerId, 121, "Spinebiter", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
|
||||
this.expansionSetCode = "NPH";
|
||||
this.subtype.add("Beast");
|
||||
|
||||
this.color.setGreen(true);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
this.addAbility(InfectAbility.getInstance());
|
||||
|
||||
// You may have Spinebiter assign its combat damage as though it weren't blocked.
|
||||
this.addAbility(DamageAsThoughNotBlockedAbility.getInstance());
|
||||
}
|
||||
|
||||
public Spinebiter(final Spinebiter card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spinebiter copy() {
|
||||
return new Spinebiter(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright 2011 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.common;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import mage.abilities.StaticAbility;
|
||||
|
||||
|
||||
import static mage.Constants.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class DamageAsThoughNotBlockedAbility extends StaticAbility<DamageAsThoughNotBlockedAbility> {
|
||||
|
||||
private static final DamageAsThoughNotBlockedAbility fINSTANCE = new DamageAsThoughNotBlockedAbility();
|
||||
|
||||
private Object readResolve() throws ObjectStreamException {
|
||||
return fINSTANCE;
|
||||
}
|
||||
|
||||
public static DamageAsThoughNotBlockedAbility getInstance() {
|
||||
return fINSTANCE;
|
||||
}
|
||||
|
||||
private DamageAsThoughNotBlockedAbility() {
|
||||
super(AbilityType.STATIC, Zone.BATTLEFIELD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "You may have {this} assign its combat damage as though it weren't blocked.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageAsThoughNotBlockedAbility copy() {
|
||||
return fINSTANCE;
|
||||
}
|
||||
|
||||
}
|
|
@ -30,13 +30,13 @@ package mage.game.combat;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.abilities.common.DamageAsThoughNotBlockedAbility;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
|
||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -148,15 +148,25 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
|
||||
public void assignDamageToBlockers(boolean first, Game game) {
|
||||
if (attackers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) {
|
||||
if (blockers.size() == 0) {
|
||||
if (blockers.isEmpty()) {
|
||||
unblockedDamage(first, game);
|
||||
}
|
||||
else if (blockers.size() == 1) {
|
||||
singleBlockerDamage(first, game);
|
||||
}
|
||||
else {
|
||||
multiBlockerDamage(first, game);
|
||||
}
|
||||
else {
|
||||
Permanent attacker = game.getPermanent(attackers.get(0));
|
||||
if (attacker.getAbilities().containsKey(DamageAsThoughNotBlockedAbility.getInstance().getId())) {
|
||||
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)) {
|
||||
blocked = false;
|
||||
unblockedDamage(first, game);
|
||||
}
|
||||
}
|
||||
if (blockers.size() == 1) {
|
||||
singleBlockerDamage(first, game);
|
||||
}
|
||||
else {
|
||||
multiBlockerDamage(first, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +238,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
Permanent blocker = game.getPermanent(blockers.get(0));
|
||||
Permanent attacker = game.getPermanent(attackers.get(0));
|
||||
if (blocker != null && attacker != null) {
|
||||
if (canDamage(attacker, first)) {
|
||||
if (blocked && canDamage(attacker, first)) {
|
||||
int damage = attacker.getPower().getValue();
|
||||
if (hasTrample(attacker)) {
|
||||
int lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
|
||||
|
@ -266,30 +276,32 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
Player player = game.getPlayer(attacker.getControllerId());
|
||||
int damage = attacker.getPower().getValue();
|
||||
if (canDamage(attacker, first)) {
|
||||
Map<UUID, Integer> assigned = new HashMap<UUID, Integer>();
|
||||
for (UUID blockerId: blockerOrder) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
int lethalDamage;
|
||||
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId()))
|
||||
lethalDamage = 1;
|
||||
else
|
||||
lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
|
||||
if (lethalDamage >= damage) {
|
||||
// Issue#73
|
||||
//blocker.damage(damage, attacker.getId(), game, true, true);
|
||||
assigned.put(blockerId, damage);
|
||||
damage = 0;
|
||||
break;
|
||||
}
|
||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
||||
// Issue#73
|
||||
//blocker.damage(damageAssigned, attacker.getId(), game, true, true);
|
||||
assigned.put(blockerId, damageAssigned);
|
||||
damage -= damageAssigned;
|
||||
}
|
||||
if (damage > 0 && hasTrample(attacker)) {
|
||||
defenderDamage(attacker, damage, game);
|
||||
}
|
||||
Map<UUID, Integer> assigned = new HashMap<UUID, Integer>();
|
||||
if (blocked) {
|
||||
for (UUID blockerId: blockerOrder) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
int lethalDamage;
|
||||
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId()))
|
||||
lethalDamage = 1;
|
||||
else
|
||||
lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
|
||||
if (lethalDamage >= damage) {
|
||||
// Issue#73
|
||||
//blocker.damage(damage, attacker.getId(), game, true, true);
|
||||
assigned.put(blockerId, damage);
|
||||
damage = 0;
|
||||
break;
|
||||
}
|
||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
||||
// Issue#73
|
||||
//blocker.damage(damageAssigned, attacker.getId(), game, true, true);
|
||||
assigned.put(blockerId, damageAssigned);
|
||||
damage -= damageAssigned;
|
||||
}
|
||||
if (damage > 0 && hasTrample(attacker)) {
|
||||
defenderDamage(attacker, damage, game);
|
||||
}
|
||||
}
|
||||
for (UUID blockerId: blockerOrder) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (canDamage(blocker, first)) {
|
||||
|
|
Loading…
Reference in a new issue