- 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

View File

@@ -71,6 +71,16 @@ public class StaticAbilityPreventDamage {
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
if (!params.containsKey("Amount") || params.get("Amount").equals("All")) {
return 0;

View File

@@ -30,6 +30,7 @@ import com.google.common.collect.Iterables;
import forge.Card;
import forge.CardLists;
import forge.CardPredicates;
import forge.GameEntity;
import forge.CardPredicates.Presets;
import forge.Constant;
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);
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 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 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);
}
@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);
}
@Override
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
return GuiDialog.confirm(hostCard, message);
}
}