- Added Battletide Alchemist

This commit is contained in:
moomarc
2013-02-28 13:52:38 +00:00
parent 382336a1bc
commit 9c16f2ce14
7 changed files with 44 additions and 0 deletions

1
.gitattributes vendored
View File

@@ -834,6 +834,7 @@ res/cardsfolder/b/battlegate_mimic.txt svneol=native#text/plain
res/cardsfolder/b/battlegrace_angel.txt svneol=native#text/plain res/cardsfolder/b/battlegrace_angel.txt svneol=native#text/plain
res/cardsfolder/b/battleground_geist.txt -text res/cardsfolder/b/battleground_geist.txt -text
res/cardsfolder/b/battlegrowth.txt svneol=native#text/plain res/cardsfolder/b/battlegrowth.txt svneol=native#text/plain
res/cardsfolder/b/battletide_alchemist.txt -text
res/cardsfolder/b/battlewand_oak.txt svneol=native#text/plain res/cardsfolder/b/battlewand_oak.txt svneol=native#text/plain
res/cardsfolder/b/battlewise_aven.txt svneol=native#text/plain res/cardsfolder/b/battlewise_aven.txt svneol=native#text/plain
res/cardsfolder/b/batwing_brume.txt -text svneol=unset#text/plain res/cardsfolder/b/batwing_brume.txt -text svneol=unset#text/plain

View File

@@ -0,0 +1,9 @@
Name:Battletide Alchemist
ManaCost:3 W W
Types:Creature Kithkin Cleric
PT:3/4
S:Mode$ PreventDamage | Target$ Player | Amount$ AlchemicX | Optional$ True | AILogic$ ProtectFriendly | Description$ If a source would deal damage to a player, you may prevent X of that damage, where X is the number of Clerics you control.
SVar:AlchemicX:Count$Valid Cleric.YouCtrl
SVar:Picture:http://www.wizards.com/global/images/magic/general/battletide_alchemist.jpg
SetInfo:MOR|Rare|http://magiccards.info/scans/en/mt/2.jpg
Oracle:If a source would deal damage to a player, you may prevent X of that damage, where X is the number of Clerics you control.

View File

@@ -71,6 +71,16 @@ public class StaticAbilityPreventDamage {
return restDamage; return restDamage;
} }
if (params.containsKey("Optional")) { //Assume if param is present it should be optional
final String logic = params.containsKey("AILogic") ? params.get("AILogic") : "";
final String message = "Apply the effect of " + hostCard + "?";
boolean confirmed = hostCard.getController().getController().confirmStaticApplication(hostCard, target, logic, message);
if (!confirmed) {
return restDamage;
}
}
// no amount means all // no amount means all
if (!params.containsKey("Amount") || params.get("Amount").equals("All")) { if (!params.containsKey("Amount") || params.get("Amount").equals("All")) {
return 0; return 0;

View File

@@ -30,6 +30,7 @@ import com.google.common.collect.Iterables;
import forge.Card; import forge.Card;
import forge.CardLists; import forge.CardLists;
import forge.CardPredicates; import forge.CardPredicates;
import forge.GameEntity;
import forge.CardPredicates.Presets; import forge.CardPredicates.Presets;
import forge.Constant; import forge.Constant;
import forge.Singletons; import forge.Singletons;
@@ -691,5 +692,17 @@ public class AiController {
String exMsg = String.format("AI confirmAction does not know what to decide about %s with %s mode.", api, mode); String exMsg = String.format("AI confirmAction does not know what to decide about %s with %s mode.", api, mode);
throw new InvalidParameterException(exMsg); throw new InvalidParameterException(exMsg);
} }
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
if (logic.equalsIgnoreCase("ProtectFriendly")) {
final Player controller = hostCard.getController();
if (affected instanceof Player) {
return !((Player) affected).isOpponentOf(controller);
} else if (affected instanceof Card) {
return !((Card) affected).getController().isOpponentOf(controller);
}
}
return true;
}
} }

View File

@@ -95,4 +95,5 @@ public abstract class PlayerController {
public Card chooseSingleCardForEffect(List<Card> sourceList, SpellAbility sa, String title) { return chooseSingleCardForEffect(sourceList, sa, title, false); } public Card chooseSingleCardForEffect(List<Card> sourceList, SpellAbility sa, String title) { return chooseSingleCardForEffect(sourceList, sa, title, false); }
public abstract Card chooseSingleCardForEffect(List<Card> sourceList, SpellAbility sa, String title, boolean isOptional); public abstract Card chooseSingleCardForEffect(List<Card> sourceList, SpellAbility sa, String title, boolean isOptional);
public abstract boolean confirmAction(SpellAbility sa, String mode, String message); public abstract boolean confirmAction(SpellAbility sa, String mode, String message);
public abstract boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message);
} }

View File

@@ -198,4 +198,9 @@ public class PlayerControllerAi extends PlayerController {
return brains.confirmAction(sa, mode, message); return brains.confirmAction(sa, mode, message);
} }
@Override
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
return brains.confirmStaticApplication(hostCard, affected, logic, message);
}
} }

View File

@@ -245,5 +245,10 @@ public class PlayerControllerHuman extends PlayerController {
return GuiDialog.confirm(sa.getSourceCard(), message); return GuiDialog.confirm(sa.getSourceCard(), message);
} }
@Override
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
return GuiDialog.confirm(hostCard, message);
}
} }