- Continuous static abilities can now add keywords to players.

- Added Ivory Mask.
This commit is contained in:
Sloth
2011-09-07 12:52:07 +00:00
parent 5e7d9a7492
commit 2d40122299
5 changed files with 68 additions and 0 deletions

1
.gitattributes vendored
View File

@@ -3878,6 +3878,7 @@ res/cardsfolder/i/ivory_crane_netsuke.txt svneol=native#text/plain
res/cardsfolder/i/ivory_cup.txt svneol=native#text/plain
res/cardsfolder/i/ivory_giant.txt svneol=native#text/plain
res/cardsfolder/i/ivory_guardians.txt svneol=native#text/plain
res/cardsfolder/i/ivory_mask.txt -text
res/cardsfolder/i/ivory_tower.txt svneol=native#text/plain
res/cardsfolder/i/ivy_dancer.txt svneol=native#text/plain
res/cardsfolder/i/ivy_elemental.txt svneol=native#text/plain

View File

@@ -0,0 +1,12 @@
Name:Ivory Mask
ManaCost:2 W W
Types:Enchantment
Text:no text
S:Mode$ Continuous | Affected$ You | AddKeyword$ Shroud | Description$ You have shroud. (You can't be the target of spells or abilities.)
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/ivory_mask.jpg
SetInfo:8ED|Rare|http://magiccards.info/scans/en/8e/27.jpg
SetInfo:MMQ|Rare|http://magiccards.info/scans/en/mm/24.jpg
SetInfo:9ED|Rare|http://magiccards.info/scans/en/9e/23.jpg
Oracle:You have shroud. (You can't be the target of spells or abilities.)
End

View File

@@ -16,6 +16,7 @@ public class StaticEffect {
private Card source = new Card();
private int keywordNumber = 0;
private CardList affectedCards = new CardList();
private ArrayList<Player> affectedPlayers = new ArrayList<Player>();
private int xValue = 0;
private int yValue = 0;
private long timestamp = -1;
@@ -596,7 +597,14 @@ public class StaticEffect {
public void setAffectedCards(CardList list) {
affectedCards = list;
}
public ArrayList<Player> getAffectedPlayers() {
return affectedPlayers;
}
public void setAffectedPlayers(ArrayList<Player> list) {
affectedPlayers = list;
}
/**
* <p>Setter for the field <code>xValue</code>.</p>
*

View File

@@ -53,6 +53,7 @@ public class StaticEffects {
*/
final void removeStaticEffect(final StaticEffect se) {
CardList affectedCards = se.getAffectedCards();
ArrayList<Player> affectedPlayers = se.getAffectedPlayers();
HashMap<String, String> params = se.getParams();
int powerBonus = 0;
@@ -98,6 +99,15 @@ public class StaticEffects {
addColors = CardUtil.getShortColorsString(
new ArrayList<String>(Arrays.asList(params.get("SetColor").split(" & "))));
}
//modify players
for (Player p : affectedPlayers) {
// add keywords
if (addKeywords != null)
for (String keyword : addKeywords)
p.removeKeyword(keyword);
}
//modify the affected card
for (int i = 0; i < affectedCards.size(); i++) {

View File

@@ -25,8 +25,10 @@ public class StaticAbility_Continuous {
StaticEffect se = new StaticEffect();
CardList affectedCards = getAffectedCards(stAb);
ArrayList<Player> affectedPlayers = getAffectedPlayers(stAb);
se.setAffectedCards(affectedCards);
se.setAffectedPlayers(affectedPlayers);
se.setParams(params);
se.setTimestamp(hostCard.getTimestamp());
AllZone.getStaticEffects().addStaticEffect(se);
@@ -144,6 +146,15 @@ public class StaticAbility_Continuous {
sVars[i] = hostCard.getSVar(sVars[i]);
addTriggers = sVars;
}
//modify players
for (Player p : affectedPlayers) {
// add keywords
if (addKeywords != null)
for (String keyword : addKeywords)
p.addKeyword(keyword);
}
//start modifying the cards
for (int i = 0; i < affectedCards.size(); i++) {
@@ -215,6 +226,32 @@ public class StaticAbility_Continuous {
}
}
private static ArrayList<Player> getAffectedPlayers(StaticAbility stAb) {
HashMap<String, String> params = stAb.getMapParams();
Card hostCard = stAb.getHostCard();
Player controller = hostCard.getController();
ArrayList<Player> players = new ArrayList<Player>();
if(!params.containsKey("Affected")) {
return players;
}
String[] strngs = params.get("Affected").split(",");
for (String str : strngs) {
if(str.equals("Player") || str.equals("You")) {
players.add(controller);
}
if(str.equals("Player") || str.equals("Opponent")) {
players.add(controller.getOpponent());
}
}
return players;
}
private static CardList getAffectedCards(StaticAbility stAb) {
HashMap<String, String> params = stAb.getMapParams();
Card hostCard = stAb.getHostCard();