mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Fix Angelic Arbiter for multiplayer. (+remove some unused methods)
This commit is contained in:
@@ -856,6 +856,8 @@ public class CombatUtil {
|
||||
for (String keyword : c.getKeyword()) {
|
||||
if (keyword.equals("CARDNAME can't attack.") || keyword.equals("CARDNAME can't attack or block.")) {
|
||||
return false;
|
||||
} else if (keyword.equals("CARDNAME can't attack if you cast a spell this turn.") && c.getController().getSpellsCastThisTurn() > 0) {
|
||||
return false;
|
||||
} else if (keyword.equals("Defender") && !c.hasKeyword("CARDNAME can attack as though it didn't have defender.")) {
|
||||
return false;
|
||||
} else if (keyword.equals("CARDNAME can't attack during extra turns.")) {
|
||||
|
||||
@@ -721,6 +721,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
for (Player p : game.getPlayers()) {
|
||||
|
||||
p.resetProwl();
|
||||
p.resetSpellsCastThisTurn();
|
||||
p.setLifeLostLastTurn(p.getLifeLostThisTurn());
|
||||
p.setLifeLostThisTurn(0);
|
||||
p.setLifeGainedThisTurn(0);
|
||||
|
||||
@@ -81,6 +81,9 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
/** The assigned damage. */
|
||||
private final Map<Card, Integer> assignedDamage = new HashMap<Card, Integer>();
|
||||
|
||||
/** Number of spells cast this turn. */
|
||||
private int spellsCastThisTurn = 0;
|
||||
|
||||
/** The life lost this turn. */
|
||||
private int lifeLostThisTurn = 0;
|
||||
|
||||
@@ -1239,28 +1242,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* canPlaySpells.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean canCastSpells() {
|
||||
return !this.keywords.contains("Can't cast spells");
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* canPlayAbilities.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean canActivateAbilities() {
|
||||
return !this.keywords.contains("Can't activate abilities");
|
||||
}
|
||||
|
||||
// //////////////////////////////
|
||||
// /
|
||||
// / replaces Singletons.getModel().getGameAction().draw* methods
|
||||
@@ -2655,6 +2636,27 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
this.numLandsPlayed = n;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of spells cast by this player this turn.
|
||||
*/
|
||||
public final int getSpellsCastThisTurn() {
|
||||
return this.spellsCastThisTurn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds 1 to the number of spells cast by this player this turn.
|
||||
*/
|
||||
public final void addSpellCastThisTurn() {
|
||||
this.spellsCastThisTurn++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the number of spells cast by this player this turn to 0.
|
||||
*/
|
||||
public final void resetSpellsCastThisTurn() {
|
||||
this.spellsCastThisTurn = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Getter for the field <code>lifeGainedThisTurn</code>.
|
||||
|
||||
@@ -271,7 +271,7 @@ public class StaticAbility extends CardTraitBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isSuppressed() || !this.checkConditions()) {
|
||||
if (this.isSuppressed() || !this.checkPlayerSpecificConditions(player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -398,10 +398,31 @@ public class StaticAbility extends CardTraitBase {
|
||||
return StaticAbilityCantAttackBlock.getBlockCost(this, blocker, attacker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check conditions for static abilities acting on a specific player. Also
|
||||
* automatically check the general conditions.
|
||||
*
|
||||
* @param player a {@link Player}.
|
||||
* @return true, if the static ability is applicable.
|
||||
* @see {@link StaticAbility#checkConditions()}
|
||||
*/
|
||||
public final boolean checkPlayerSpecificConditions(final Player player) {
|
||||
if (!checkConditions()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("PlayerAttackedWithCreatureThisTurn")
|
||||
&& !player.getAttackedWithCreatureThisTurn()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check conditions.
|
||||
*
|
||||
* @return true, if successful
|
||||
* @return true, if the static ability is applicable.
|
||||
*/
|
||||
public final boolean checkConditions() {
|
||||
final Player controller = this.hostCard.getController();
|
||||
@@ -451,11 +472,6 @@ public class StaticAbility extends CardTraitBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("OpponentAttackedWithCreatureThisTurn")
|
||||
&& !controller.getOpponent().getAttackedWithCreatureThisTurn()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("Phases")) {
|
||||
List<PhaseType> phases = PhaseType.parseRange(this.mapParams.get("Phases"));
|
||||
if (!phases.contains(controller.getGame().getPhaseHandler().getPhase())) {
|
||||
|
||||
@@ -523,6 +523,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
|
||||
if (sp.isSpell() && !sp.isCopied()) {
|
||||
this.thisTurnCast.add(sp.getHostCard());
|
||||
sp.getActivatingPlayer().addSpellCastThisTurn();
|
||||
}
|
||||
if (sp.isAbility() && sp.getRestrictions().isPwAbility()) {
|
||||
sp.getActivatingPlayer().setActivateLoyaltyAbilityThisTurn(true);
|
||||
|
||||
@@ -3,9 +3,8 @@ ManaCost:5 W W
|
||||
Types:Creature Angel
|
||||
PT:5/6
|
||||
K:Flying
|
||||
S:Mode$ Continuous | Affected$ Creature.YouDontCtrl | AddHiddenKeyword$ CARDNAME can't attack. | CheckSVar$ X | SVarCompare$ GE1 | Description$ Each opponent who cast a spell this turn can't attack with creatures.
|
||||
S:Mode$ CantBeCast | ValidCard$ Card | Caster$ Opponent | OpponentAttackedWithCreatureThisTurn$ True | Description$ Each opponent who attacked with a creature this turn can't cast spells.
|
||||
SVar:X:Count$ThisTurnCast_Card.YouDontCtrl
|
||||
S:Mode$ Continuous | Affected$ Creature.OppCtrl | AddHiddenKeyword$ CARDNAME can't attack if you cast a spell this turn. | Description$ Each opponent who cast a spell this turn can't attack with creatures.
|
||||
S:Mode$ CantBeCast | ValidCard$ Card | Caster$ Opponent | PlayerAttackedWithCreatureThisTurn$ True | Description$ Each opponent who attacked with a creature this turn can't cast spells.
|
||||
SVar:RemMultiplayer:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/angelic_arbiter.jpg
|
||||
Oracle:Flying\nEach opponent who cast a spell this turn can't attack with creatures.\nEach opponent who attacked with a creature this turn can't cast spells.
|
||||
|
||||
Reference in New Issue
Block a user