- Changed Prowl to be used for other Creature types than Rogue.

This commit is contained in:
Sloth
2011-08-24 16:53:06 +00:00
parent 99d06c01be
commit 0bea97b042
4 changed files with 40 additions and 16 deletions

View File

@@ -479,8 +479,8 @@ public class Phase extends MyObservable implements java.io.Serializable {
Player nextTurn = extraTurns.isEmpty() ? getPlayerTurn().getOpponent() : extraTurns.pop();
AllZone.resetZoneMoveTracking();
AllZone.getComputerPlayer().setProwl(false);
AllZone.getHumanPlayer().setProwl(false);
AllZone.getComputerPlayer().resetProwl();
AllZone.getHumanPlayer().resetProwl();
return skipTurnTimeVault(nextTurn);
}

View File

@@ -5,6 +5,7 @@ import forge.card.cardFactory.CardFactoryUtil;
import forge.card.mana.ManaPool;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.card.trigger.Trigger;
import javax.swing.*;
import java.util.*;
@@ -32,7 +33,7 @@ public abstract class Player extends MyObservable {
protected int nTurns = 0;
protected boolean skipNextUntap = false;
protected boolean prowl = false;
protected ArrayList<String> prowl = new ArrayList<String>();
protected int maxLandsToPlay = 1;
protected int numLandsPlayed = 0;
@@ -91,7 +92,7 @@ public abstract class Player extends MyObservable {
loseConditionSpell = null;
maxLandsToPlay = 1;
numLandsPlayed = 0;
prowl = false;
prowl = new ArrayList<String>();
handSizeOperations = new ArrayList<HandSizeOp>();
keywords.clear();
@@ -377,8 +378,11 @@ public abstract class Player extends MyObservable {
GameActionUtil.executeDamageDealingEffects(source, damageToDo);
GameActionUtil.executeDamageToPlayerEffects(this, source, damageToDo);
if(isCombat && source.isType("Rogue"))
source.getController().setProwl(true);
if(isCombat) {
ArrayList<String> types = source.getType();
for (String type : types)
source.getController().addProwlType(type);
}
//Run triggers
HashMap<String, Object> runParams = new HashMap<String, Object>();
@@ -1630,12 +1634,16 @@ public abstract class Player extends MyObservable {
*
* @return a boolean.
*/
public boolean hasProwl() {
return prowl;
public boolean hasProwl(String type) {
return prowl.contains(type);
}
public void setProwl(boolean newProwl) {
prowl = newProwl;
public void addProwlType(String type) {
prowl.add(type);
}
public void resetProwl() {
prowl = new ArrayList<String>();
}
private ArrayList<HandSizeOp> handSizeOperations;

View File

@@ -5,6 +5,7 @@ import forge.*;
import forge.card.abilityFactory.AbilityFactory;
import forge.card.cardFactory.CardFactoryUtil;
import java.util.ArrayList;
import java.util.HashMap;
/**
@@ -39,7 +40,14 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
if (value.equals("Threshold")) setThreshold(true);
if (value.equals("Metalcraft")) setMetalcraft(true);
if (value.equals("Hellbent")) setHellbent(true);
if (value.equals("Prowl")) setProwl(true);
if (value.startsWith("Prowl")) {
ArrayList<String> prowlTypes = new ArrayList<String>();
prowlTypes.add("Rogue");
if(value.split("Prowl").length > 1) {
prowlTypes.add(value.split("Prowl")[1]);
}
setProwl(prowlTypes);
}
}
if (params.containsKey("ActivationZone"))
@@ -181,9 +189,17 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
if (!activator.hasMetalcraft())
return false;
}
if (prowl) {
if (!activator.hasProwl())
if (prowl != null) {
//only true if the activating player has damaged the opponent with one of the specified types
boolean prowlFlag = false;
for (String type : prowl) {
if (activator.hasProwl(type)) {
prowlFlag = true;
}
}
if (!prowlFlag) {
return false;
}
}
if (sIsPresent != null) {
CardList list = AllZoneUtil.getCardsInZone(presentZone);

View File

@@ -40,7 +40,7 @@ public class SpellAbility_Variables {
protected boolean threshold = false;
protected boolean metalcraft = false;
protected boolean hellbent = false;
protected boolean prowl = false;
protected ArrayList<String> prowl = null;
protected String sIsPresent = null;
protected String presentCompare = "GE1"; // Default Compare to Greater or Equal to 1
@@ -268,8 +268,8 @@ public class SpellAbility_Variables {
*
* @param bProwl a boolean.
*/
public void setProwl(boolean bProwl) {
prowl = bProwl;
public void setProwl(ArrayList<String> types) {
prowl = types;
}
//IsPresent for Valid battlefield stuff