mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Added Forcefield.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -3913,6 +3913,7 @@ res/cardsfolder/f/forced_fruition.txt svneol=native#text/plain
|
||||
res/cardsfolder/f/forced_march.txt svneol=native#text/plain
|
||||
res/cardsfolder/f/forced_retreat.txt svneol=native#text/plain
|
||||
res/cardsfolder/f/forced_worship.txt svneol=native#text/plain
|
||||
res/cardsfolder/f/forcefield.txt -text
|
||||
res/cardsfolder/f/forcemage_advocate.txt svneol=native#text/plain
|
||||
res/cardsfolder/f/foresee.txt svneol=native#text/plain
|
||||
res/cardsfolder/f/foreshadow.txt -text
|
||||
|
||||
15
res/cardsfolder/f/forcefield.txt
Normal file
15
res/cardsfolder/f/forcefield.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Name:Forcefield
|
||||
ManaCost:3
|
||||
Types:Artifact
|
||||
A:AB$ ChooseCard | Cost$ 1 | Choices$ Creature.unblocked | RememberChosen$ True | AILogic$ NeedsPrevention | SubAbility$ DBEffect | SVars$ DBEffect,RPreventNextFromCreature,CombatDmg,ExileEffect | SpellDescription$ The next time an unblocked creature of your choice would deal combat damage to you this turn, prevent all but 1 of that damage.
|
||||
SVar:DBEffect:DB$ Effect | ReplacementEffects$ RPreventNextFromCreature | RememberObjects$ Remembered | SVars$ RPreventNextFromCreature,CombatDmg,ExileEffect | SubAbility$ DBCleanup | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ GE1
|
||||
SVar:RPreventNextFromCreature:Event$ DamageDone | ValidSource$ Card.IsRemembered | ValidTarget$ You | ReplaceWith$ CombatDmg | PreventionEffect$ True | CombatDamage$ True | Description$ The next time an unblocked creature of your choice would deal combat damage to you this turn, prevent all but 1 of that damage.
|
||||
SVar:CombatDmg:AB$ DealDamage | Cost$ 0 | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | CombatDamage$ True | NumDmg$ 1 | SubAbility$ ExileEffect
|
||||
SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile
|
||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
SVar:NonStackingEffect:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/forcefield.jpg
|
||||
Oracle:{1}: The next time an unblocked creature of your choice would deal combat damage to you this turn, prevent all but 1 of that damage.
|
||||
SetInfo:LEB Rare
|
||||
SetInfo:LEA Rare
|
||||
SetInfo:2ED Rare
|
||||
@@ -2,11 +2,16 @@ package forge.card.ability.ai;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.card.ability.SpellAbilityAi;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.Target;
|
||||
import forge.game.GameState;
|
||||
import forge.game.ai.ComputerUtilCombat;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
@@ -16,8 +21,9 @@ public class ChooseCardAi extends SpellAbilityAi {
|
||||
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@Override
|
||||
protected boolean canPlayAI(Player ai, SpellAbility sa) {
|
||||
protected boolean canPlayAI(final Player ai, SpellAbility sa) {
|
||||
final Card host = sa.getSourceCard();
|
||||
final GameState game = ai.getGame();
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
if (tgt != null) {
|
||||
@@ -55,6 +61,25 @@ public class ChooseCardAi extends SpellAbilityAi {
|
||||
}
|
||||
} else if (sa.getParam("AILogic").equals("Never")) {
|
||||
return false;
|
||||
} else if (sa.getParam("AILogic").equals("NeedsPrevention")) {
|
||||
if (!game.getPhaseHandler().getPhase() .equals(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
|
||||
return false;
|
||||
}
|
||||
choices = CardLists.filter(choices, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (!c.isAttacking(ai) || !game.getCombat().isUnblocked(c)) {
|
||||
return false;
|
||||
}
|
||||
if (host.getName().equals("Forcefield")) {
|
||||
return ComputerUtilCombat.damageIfUnblocked(c, ai, game.getCombat()) > 1;
|
||||
}
|
||||
return ComputerUtilCombat.damageIfUnblocked(c, ai, game.getCombat()) > 0;
|
||||
}
|
||||
});
|
||||
if (choices.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -620,8 +620,8 @@ public class AiController {
|
||||
}
|
||||
|
||||
Card choice = null;
|
||||
Card host = sa.getSourceCard();
|
||||
String logic = sa.getParam("AILogic");
|
||||
final Card host = sa.getSourceCard();
|
||||
final String logic = sa.getParam("AILogic");
|
||||
|
||||
switch(api) {
|
||||
case Bond:
|
||||
@@ -648,6 +648,25 @@ public class AiController {
|
||||
options = CardLists.getValidCards(options, "Permanent.YouCtrl,Permanent.tapped", host.getController(), host);
|
||||
}
|
||||
choice = ComputerUtilCard.getBestAI(options);
|
||||
} else if (logic.equals("NeedsPrevention")) {
|
||||
final Player ai = this.getPlayer();
|
||||
List<Card> better = CardLists.filter(options, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (!c.isAttacking(ai) || !game.getCombat().isUnblocked(c)) {
|
||||
return false;
|
||||
}
|
||||
if (host.getName().equals("Forcefield")) {
|
||||
return ComputerUtilCombat.damageIfUnblocked(c, ai, game.getCombat()) > 1;
|
||||
}
|
||||
return ComputerUtilCombat.damageIfUnblocked(c, ai, game.getCombat()) > 0;
|
||||
}
|
||||
});
|
||||
if (!better.isEmpty()) {
|
||||
choice = ComputerUtilCard.getBestAI(better);
|
||||
} else {
|
||||
choice = ComputerUtilCard.getBestAI(options);
|
||||
}
|
||||
} else {
|
||||
choice = ComputerUtilCard.getBestAI(options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user