mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
Implemented banding (#41)
This commit is contained in:
parent
adec5cf88b
commit
e7301e2c08
24 changed files with 708 additions and 136 deletions
|
|
@ -121,7 +121,7 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect {
|
|||
if (combatGroups != null) {
|
||||
for (CombatGroup combatGroup : combatGroups) {
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(false);
|
||||
combatGroup.setBlocked(false, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class CurtainOfLightEffect extends OneShotEffect {
|
|||
if (controller != null && permanent != null) {
|
||||
CombatGroup combatGroup = game.getCombat().findGroup(permanent.getId());
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(true);
|
||||
combatGroup.setBlocked(true, game);
|
||||
game.informPlayers(permanent.getLogName() + " has become blocked");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class DazzlingBeautyEffect extends OneShotEffect {
|
|||
if (controller != null && permanent != null) {
|
||||
CombatGroup combatGroup = game.getCombat().findGroup(permanent.getId());
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(true);
|
||||
combatGroup.setBlocked(true, game);
|
||||
game.informPlayers(permanent.getLogName() + " has become blocked");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class FalseOrdersUnblockEffect extends OneShotEffect {
|
|||
if (combatGroups != null) {
|
||||
for (CombatGroup combatGroup : combatGroups) {
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(false);
|
||||
combatGroup.setBlocked(false, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,22 +113,36 @@ class GeneralJarkeldSwitchBlockersEffect extends OneShotEffect {
|
|||
Set<Permanent> blockers2 = new HashSet<>();
|
||||
Set<Permanent> multiBlockers = new HashSet<>();
|
||||
|
||||
blockerSearch1:
|
||||
for (UUID blockerId : chosenGroup1.getBlockers()) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null) {
|
||||
if (blocker.getBlocking() > 1) {
|
||||
multiBlockers.add(blocker);
|
||||
if (game.getCombat().blockingGroupsContains(blocker.getId())) { // if (blocker.getBlocking() > 1) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getAttackers().size() > 1) {
|
||||
multiBlockers.add(blocker);
|
||||
continue blockerSearch1;
|
||||
}
|
||||
}
|
||||
blockers1.add(blocker); // this should not happen
|
||||
} else {
|
||||
blockers1.add(blocker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blockerSearch2:
|
||||
for (UUID blockerId : chosenGroup2.getBlockers()) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null) {
|
||||
if (blocker.getBlocking() > 1) {
|
||||
multiBlockers.add(blocker);
|
||||
if (game.getCombat().blockingGroupsContains(blocker.getId())) { // if (blocker.getBlocking() > 1) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getAttackers().size() > 1) {
|
||||
multiBlockers.add(blocker);
|
||||
continue blockerSearch2;
|
||||
}
|
||||
}
|
||||
blockers2.add(blocker); // this should not happen
|
||||
} else {
|
||||
blockers2.add(blocker);
|
||||
}
|
||||
|
|
@ -141,11 +155,11 @@ class GeneralJarkeldSwitchBlockersEffect extends OneShotEffect {
|
|||
|
||||
// the ability doesn't unblock a group that loses all blockers, however it will newly block a previously unblocked group if it gains a blocker this way
|
||||
if (!(chosenGroup1.getBlockers().isEmpty())) {
|
||||
chosenGroup1.setBlocked(true);
|
||||
chosenGroup1.setBlocked(true, game);
|
||||
chosenGroup1.pickBlockerOrder(attacker1.getControllerId(), game);
|
||||
}
|
||||
if (!(chosenGroup2.getBlockers().isEmpty())) {
|
||||
chosenGroup2.setBlocked(true);
|
||||
chosenGroup2.setBlocked(true, game);
|
||||
chosenGroup2.pickBlockerOrder(attacker2.getControllerId(), game);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -168,42 +182,40 @@ class GeneralJarkeldSwitchBlockersEffect extends OneShotEffect {
|
|||
// for handling multi-blockers (Two Headed Giant of Foriys, etc.)
|
||||
blockerIteration:
|
||||
for (Permanent blocker : blockers) {
|
||||
if (blocker.getBlocking() > 1) {
|
||||
CombatGroup blockGroup = null;
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getBlockers().contains(blocker.getId())) {
|
||||
blockGroup = group;
|
||||
break;
|
||||
CombatGroup blockGroup = null;
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getBlockers().contains(blocker.getId())) {
|
||||
blockGroup = group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (blockGroup != null) {
|
||||
CombatGroup chosenGroup = null;
|
||||
boolean sameBlocked = false;
|
||||
for (CombatGroup group : game.getCombat().getGroups()) {
|
||||
if (group.getBlocked() && group.getBlockers().contains(blocker.getId())) {
|
||||
if (group == chosenGroup1 || group == chosenGroup2) {
|
||||
if (sameBlocked) {
|
||||
continue blockerIteration;
|
||||
}
|
||||
sameBlocked = true;
|
||||
chosenGroup = group;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (blockGroup != null) {
|
||||
CombatGroup chosenGroup = null;
|
||||
boolean sameBlocked = false;
|
||||
for (CombatGroup group : game.getCombat().getGroups()) {
|
||||
if (group.getBlocked() && group.getBlockers().contains(blocker.getId())) {
|
||||
if (group == chosenGroup1 || group == chosenGroup2) {
|
||||
if (sameBlocked) {
|
||||
continue blockerIteration;
|
||||
}
|
||||
sameBlocked = true;
|
||||
chosenGroup = group;
|
||||
}
|
||||
}
|
||||
|
||||
if (sameBlocked && chosenGroup != null) { // if none (should not happen) or all the blockers correspond to Jarkeld's targets, the blockers remain the same
|
||||
CombatGroup otherGroup = (chosenGroup.equals(chosenGroup1) ? chosenGroup2 : chosenGroup1);
|
||||
chosenGroup.remove(blocker.getId());
|
||||
for (UUID attacker : chosenGroup.getAttackers()) {
|
||||
blockGroup.remove(attacker);
|
||||
}
|
||||
|
||||
if (sameBlocked && chosenGroup != null) { // if none (should not happen) or all the blockers correspond to Jarkeld's targets, the blockers remain the same
|
||||
CombatGroup otherGroup = (chosenGroup.equals(chosenGroup1) ? chosenGroup2 : chosenGroup1);
|
||||
chosenGroup.remove(blocker.getId());
|
||||
for (UUID attacker : chosenGroup.getAttackers()) {
|
||||
blockGroup.remove(attacker);
|
||||
}
|
||||
otherGroup.addBlockerToGroup(blocker.getId(), controller.getId(), game);
|
||||
for (UUID attacker : otherGroup.getAttackers()) {
|
||||
// 10/4/2004 The new blocker does not trigger any abilities which trigger on creatures becoming blockers, because the creatures were already blockers and the simple change of who is blocking does not trigger such abilities.
|
||||
game.getCombat().addBlockingGroup(blocker.getId(), attacker, controller.getId(), game);
|
||||
}
|
||||
blockGroup.pickAttackerOrder(blocker.getControllerId(), game);
|
||||
otherGroup.addBlockerToGroup(blocker.getId(), controller.getId(), game);
|
||||
for (UUID attacker : otherGroup.getAttackers()) {
|
||||
// 10/4/2004 The new blocker does not trigger any abilities which trigger on creatures becoming blockers, because the creatures were already blockers and the simple change of who is blocking does not trigger such abilities.
|
||||
game.getCombat().addBlockingGroup(blocker.getId(), attacker, controller.getId(), game);
|
||||
}
|
||||
blockGroup.pickAttackerOrder(blocker.getControllerId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
75
Mage.Sets/src/mage/cards/i/IcatianInfantry.java
Normal file
75
Mage.Sets/src/mage/cards/i/IcatianInfantry.java
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.BandingAbility;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public class IcatianInfantry extends CardImpl {
|
||||
|
||||
public IcatianInfantry(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SOLDIER);
|
||||
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// {1}: Icatian Infantry gains first strike until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{1}")));
|
||||
|
||||
// {1}: Icatian Infantry gains banding until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(BandingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{1}")));
|
||||
}
|
||||
|
||||
public IcatianInfantry(final IcatianInfantry card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IcatianInfantry copy() {
|
||||
return new IcatianInfantry(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ class ImprisonUnblockEffect extends OneShotEffect {
|
|||
if (combatGroups != null) {
|
||||
for (CombatGroup combatGroup : combatGroups) {
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(false);
|
||||
combatGroup.setBlocked(false, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class SorrowsPath extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Whenever Sorrow's Path becomes tapped, it deals 2 damage to you and each creature you control.
|
||||
Ability ability2 = new BecomesTappedSourceTriggeredAbility(new DamageControllerEffect(2 , "it"));
|
||||
Ability ability2 = new BecomesTappedSourceTriggeredAbility(new DamageControllerEffect(2));
|
||||
ability2.addEffect(new DamageAllEffect(2, new FilterControlledCreaturePermanent()).setText("and each creature you control"));
|
||||
this.addAbility(ability2);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ class SorrowsPathSwitchBlockersEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
private CombatGroup findBlockingGroup(Permanent blocker, Game game) {
|
||||
if (blocker.getBlocking() > 1) {
|
||||
if (game.getCombat().blockingGroupsContains(blocker.getId())) { // if (blocker.getBlocking() > 1) {
|
||||
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
|
||||
if (group.getBlockers().contains(blocker.getId())) {
|
||||
return group;
|
||||
|
|
@ -176,7 +176,7 @@ class SorrowsPathSwitchBlockersEffect extends OneShotEffect {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void reassignBlocker(Permanent blocker, Set<Permanent> attackers, Game game) {
|
||||
for (Permanent attacker : attackers) {
|
||||
CombatGroup group = game.getCombat().findGroup(attacker.getId());
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class TrapRunnerEffect extends OneShotEffect {
|
|||
if (controller != null && permanent != null) {
|
||||
CombatGroup combatGroup = game.getCombat().findGroup(permanent.getId());
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(true);
|
||||
combatGroup.setBlocked(true, game);
|
||||
game.informPlayers(permanent.getLogName() + " has become blocked");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class YdwenEfreetEffect extends OneShotEffect {
|
|||
if (combatGroups != null) {
|
||||
for (CombatGroup combatGroup : combatGroups) {
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(false);
|
||||
combatGroup.setBlocked(false, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import mage.cards.h.HighTide;
|
|||
import mage.cards.h.Homarid;
|
||||
import mage.cards.h.HomaridWarrior;
|
||||
import mage.cards.h.HymnToTourach;
|
||||
import mage.cards.i.IcatianInfantry;
|
||||
import mage.cards.i.IcatianJavelineers;
|
||||
import mage.cards.i.IcatianMoneychanger;
|
||||
import mage.cards.i.IcatianScout;
|
||||
|
|
@ -170,6 +171,10 @@ public class FallenEmpires extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Hymn to Tourach", 13, Rarity.COMMON, HymnToTourach.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Hymn to Tourach", 14, Rarity.COMMON, HymnToTourach.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Hymn to Tourach", 15, Rarity.COMMON, HymnToTourach.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Icatian Infantry", 144, Rarity.COMMON, IcatianInfantry.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Icatian Infantry", 145, Rarity.COMMON, IcatianInfantry.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Icatian Infantry", 146, Rarity.COMMON, IcatianInfantry.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Icatian Infantry", 147, Rarity.COMMON, IcatianInfantry.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Icatian Javelineers", 148, Rarity.COMMON, IcatianJavelineers.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Icatian Javelineers", 149, Rarity.COMMON, IcatianJavelineers.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Icatian Javelineers", 150, Rarity.COMMON, IcatianJavelineers.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue