mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
market_gnome.txt and support
This commit is contained in:
@@ -141,20 +141,21 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
|
||||
@Override
|
||||
public PaymentDecision visit(CostExile cost) {
|
||||
String type = cost.getType();
|
||||
if (cost.payCostFromSource()) {
|
||||
return PaymentDecision.card(source);
|
||||
}
|
||||
|
||||
if (cost.getType().equals("All")) {
|
||||
if (type.equals("All")) {
|
||||
return PaymentDecision.card(player.getCardsIn(cost.getFrom()));
|
||||
}
|
||||
else if (cost.getType().contains("FromTopGrave")) {
|
||||
else if (type.contains("FromTopGrave")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int c = cost.getAbilityAmount(ability);
|
||||
|
||||
if (cost.getFrom().equals(ZoneType.Library)) {
|
||||
if (cost.from.size() == 1 && cost.getFrom().get(0).equals(ZoneType.Library)) {
|
||||
return PaymentDecision.card(player.getCardsIn(ZoneType.Library, c));
|
||||
}
|
||||
else if (cost.zoneRestriction == 0) {
|
||||
|
||||
@@ -945,6 +945,8 @@ public class GameAction {
|
||||
if (params != null) {
|
||||
runParams.putAll(params);
|
||||
}
|
||||
runParams.put(AbilityKey.CostStack, game.costPaymentStack);
|
||||
runParams.put(AbilityKey.IndividualCostPaymentInstance, game.costPaymentStack.peek());
|
||||
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Exiled, runParams, false);
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ package forge.game.trigger;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import forge.game.cost.IndividualCostPaymentInstance;
|
||||
import forge.game.zone.CostPaymentStack;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import forge.game.ability.AbilityKey;
|
||||
@@ -77,6 +79,43 @@ public class TriggerExiled extends Trigger {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hasParam("WhileKeyword")) {
|
||||
final String keyword = getParam("WhileKeyword");
|
||||
boolean withKeyword = false;
|
||||
|
||||
IndividualCostPaymentInstance currentPayment = (IndividualCostPaymentInstance) runParams.get(AbilityKey.IndividualCostPaymentInstance);
|
||||
|
||||
SpellAbility sa;
|
||||
if (currentPayment != null) {
|
||||
sa = currentPayment.getPayment().getAbility();
|
||||
|
||||
if (sa != null && sa.getHostCard() != null) {
|
||||
if ((sa.isSpell() || sa.isAbility()) && sa.getHostCard().hasStartOfUnHiddenKeyword(keyword)) {
|
||||
withKeyword = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!withKeyword) {
|
||||
CostPaymentStack stack = (CostPaymentStack) runParams.get(AbilityKey.CostStack);
|
||||
|
||||
for (IndividualCostPaymentInstance individual : stack) {
|
||||
sa = individual.getPayment().getAbility();
|
||||
|
||||
if (sa == null || sa.getHostCard() == null)
|
||||
continue;
|
||||
|
||||
if ((sa.isSpell() || sa.isAbility()) && sa.getHostCard().hasStartOfUnHiddenKeyword(keyword)) {
|
||||
withKeyword = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!withKeyword)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
11
forge-gui/res/cardsfolder/upcoming/market_gnome.txt
Normal file
11
forge-gui/res/cardsfolder/upcoming/market_gnome.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Name:Market Gnome
|
||||
ManaCost:W
|
||||
Types:Artifact Creature Gnome
|
||||
PT:0/3
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigGainLife | TriggerDescription$ When CARDNAME dies, you gain 1 life and draw a card.
|
||||
T:Mode$ Exiled | Origin$ Battlefield | WhileKeyword$ Craft | ValidCard$ Card.Self | Execute$ TrigGainLife | TriggerDescription$ When CARDNAME is exiled from the battlefield while you're activating a craft ability, you gain 1 life and draw a card.
|
||||
SVar:TrigGainLife:DB$ GainLife | LifeAmount$ 1 | SubAbility$ DBDraw
|
||||
SVar:DBDraw:DB$ Draw
|
||||
DeckHas:Ability$LifeGain
|
||||
SVar:SacMe:2
|
||||
Oracle:When Market Gnome dies, you gain 1 life and draw a card.\nWhen Market Gnome is exiled from the battlefield while you're activating a craft ability, you gain 1 life and draw a card.
|
||||
Reference in New Issue
Block a user