Merge branch 'training' into 'master'

VOW: Training keyword and some cards

See merge request core-developers/forge!5665
This commit is contained in:
Michael Kamensky
2021-10-29 19:45:56 +00:00
17 changed files with 152 additions and 2 deletions

View File

@@ -390,6 +390,9 @@ public class CountersPutEffect extends SpellAbilityEffect {
if (sa.hasParam("Adapt")) {
game.getTriggerHandler().runTrigger(TriggerType.Adapt, AbilityKey.mapFromCard(gameCard), false);
}
if (sa.hasParam("Training")) {
game.getTriggerHandler().runTrigger(TriggerType.Trains, AbilityKey.mapFromCard(gameCard), false);
}
} else {
// adding counters to something like re-suspend cards
// etbcounter should apply multiplier

View File

@@ -2124,7 +2124,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|| keyword.equals("Horsemanship") || keyword.equals("Infect")|| keyword.equals("Persist")
|| keyword.equals("Phasing") || keyword.equals("Shadow")|| keyword.equals("Skulk")
|| keyword.equals("Undying") || keyword.equals("Wither") || keyword.equals("Cascade")
|| keyword.equals("Mentor")) {
|| keyword.equals("Mentor") || keyword.equals("Training")) {
if (sb.length() != 0) {
sb.append("\r\n");
}

View File

@@ -1842,7 +1842,7 @@ public class CardFactoryUtil {
if (card.isPermanent()) {
final String abPump = "DB$ Pump | Defined$ Remembered | KW$ Haste | PumpZone$ Stack "
+ "| ConditionDefined$ Remembered | ConditionPresent$ Creature | Duration$ UntilLoseControlOfHost";
final AbilitySub saPump = (AbilitySub)AbilityFactory.getAbility(abPump, card);
final AbilitySub saPump = (AbilitySub) AbilityFactory.getAbility(abPump, card);
String dbClean = "DB$ Cleanup | ClearRemembered$ True";
final AbilitySub saCleanup = (AbilitySub) AbilityFactory.getAbility(dbClean, card);
@@ -1856,6 +1856,21 @@ public class CardFactoryUtil {
inst.addTrigger(parsedUpkeepTrig);
inst.addTrigger(parsedPlayTrigger);
} else if (keyword.equals("Training")) {
final String trigStr = "Mode$ Attacks | ValidCard$ Card.Self | Secondary$ True | " +
"IsPresent$ Creature.attacking+Other+powerGTX | TriggerDescription$ Training (" +
inst.getReminderText() + ")";
final String effect = "DB$ PutCounter | CounterType$ P1P1 | CounterNum$ 1 | Defined$ Self | Training$ True";
final Trigger trigger = TriggerHandler.parseTrigger(trigStr, card, intrinsic);
SpellAbility sa = AbilityFactory.getAbility(effect, card);
trigger.setSVar("X", "Count$CardPower");
sa.setIntrinsic(intrinsic);
trigger.setOverridingAbility(sa);
inst.addTrigger(trigger);
} else if (keyword.startsWith("Tribute")) {
// use hardcoded ability name
final String abStr = "TrigNotTribute";

View File

@@ -157,6 +157,7 @@ public enum Keyword {
SURGE("Surge", KeywordWithCost.class, false, "You may cast this spell for its surge cost if you or a teammate has cast another spell this turn."),
SUSPEND("Suspend", Suspend.class, false, "Rather than cast this card from your hand, you may pay %s and exile it with {%d:time counter} on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost."),
TOTEM_ARMOR("Totem armor", SimpleKeyword.class, true, "If enchanted permanent would be destroyed, instead remove all damage marked on it and destroy this Aura."),
TRAINING("Training", SimpleKeyword.class, false, "Whenever this creature attacks with another creature with greater power, put a +1/+1 counter on this creature."),
TRAMPLE("Trample", Trample.class, true, "This creature can deal excess combat damage to the player or planeswalker it's attacking."),
TRANSFIGURE("Transfigure", KeywordWithCost.class, false, "%s, Sacrifice this creature: Search your library for a creature card with the same mana value as this creature and put that card onto the battlefield, then shuffle. Transfigure only as a sorcery."),
TRANSMUTE("Transmute", KeywordWithCost.class, false, "%s, Discard this card: Search your library for a card with the same mana value as this card, reveal it, and put it into your hand, then shuffle. Transmute only as a sorcery."),

View File

@@ -0,0 +1,75 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.game.trigger;
import forge.game.ability.AbilityKey;
import forge.game.card.Card;
import forge.game.spellability.SpellAbility;
import forge.util.Localizer;
import java.util.Map;
/**
* <p>
* Trigger_Trains class.
* </p>
*
* @author Forge
*/
public class TriggerTrains extends Trigger {
/**
* <p>
* Constructor for TriggerTrains.
* </p>
*
* @param params
* a {@link java.util.HashMap} object.
* @param host
* a {@link forge.game.card.Card} object.
* @param intrinsic
* the intrinsic
*/
public TriggerTrains(final Map<String, String> params, final Card host, final boolean intrinsic) {
super(params, host, intrinsic);
}
/** {@inheritDoc}
* @param runParams*/
@Override
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Card))) {
return false;
}
return true;
}
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa, Map<AbilityKey, Object> runParams) {
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Card);
}
@Override
public String getImportantStackObjects(SpellAbility sa) {
StringBuilder sb = new StringBuilder();
sb.append(Localizer.getInstance().getMessage("lblTrains")).append(": ").append(sa.getTriggeringObject(AbilityKey.Card));
return sb.toString();
}
}

View File

@@ -107,6 +107,7 @@ public enum TriggerType {
Taps(TriggerTaps.class),
TapsForMana(TriggerTapsForMana.class),
TokenCreated(TriggerTokenCreated.class),
Trains(TriggerTrains.class),
Transformed(TriggerTransformed.class),
TurnBegin(TriggerTurnBegin.class),
TurnFaceUp(TriggerTurnFaceUp.class),

View File

@@ -0,0 +1,8 @@
Name:Apprentice Sharpshooter
ManaCost:1 G
Types:Creature Human Archer
PT:1/4
K:Reach
K:Training
DeckHas:Ability$Counters
Oracle:Reach\nTraining (Whenever this creature attacks with another creature with greater power, put a +1/+1 counter on this creature.)

View File

@@ -0,0 +1,8 @@
Name:Gryff Rider
ManaCost:2 W
Types:Creature Human Knight
PT:2/1
K:Flying
K:Training
DeckHas:Ability$Counters
Oracle:Flying\nTraining (Whenever this creature attacks with another creature with greater power, put a +1/+1 counter on this creature.)

View File

@@ -0,0 +1,11 @@
Name:Savior of Ollenbock
ManaCost:1 W W
Types:Creature Human Soldier
PT:1/2
K:Training
T:Mode$ Trains | ValidCard$ Card.Self | Execute$ TrigExile | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME trains, exile up to one other target creature from the battlefield or creature card from a graveyard.
SVar:TrigExile:DB$ ChangeZone | Origin$ Battlefield,Graveyard | Destination$ Exile | ValidTgts$ Creature.Other | TgtPrompt$ Select up to one other target creature from the battlefield or creature card from a graveyard | TargetMin$ 0 | TargetMax$ 1 | TgtZone$ Battlefield,Graveyard
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ TrigChange | TriggerDescription$ When CARDNAME leaves the battlefield, put the exiled cards onto the battlefield under their owners' control.
SVar:TrigChange:DB$ ChangeZoneAll | ChangeType$ Card.ExiledWithSource | Origin$ Exile | Destination$ Battlefield
DeckHas:Ability$Counters
Oracle:Reach\nTraining (Whenever this creature attacks with another creature with greater power, put a +1/+1 counter on this creature.)\nWhenever Savior of Ollenbock trains, exile up to one other target creature from the battlefield or creature card from a graveyard.\nWhen Savior of Ollenbock leaves the battlefield, put the exiled cards onto the battlefield under their owners' control.

View File

@@ -0,0 +1,9 @@
Name:Torens, Fist of the Angels
ManaCost:1 G W
Types:Legendary Creature Human Cleric
PT:2/2
K:Training
T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ You | Execute$ TrigToken | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a creature spell, create a 1/1 green and white Human Soldier creature token with training.
SVar:TrigToken:DB$ Token | TokenScript$ gw_1_1_human_soldier_training
DeckHas:Ability$Counters & Ability$Token
Oracle:Training (Whenever this creature attacks with another creature with greater power, put a +1/+1 counter on this creature.)\nWhenever you cast a creature spell, create a 1/1 green and white Human Soldier creature token with training.

View File

@@ -1589,6 +1589,8 @@ lblTapped=Getappt
#TriggerTapsForMana.java
lblTappedForMana=für Mana getappt
lblProduced=Erzeugte
#TriggerTrains.java
lblTrains=Trains
#TriggerTransformed.java
lblTransformed=Transformiert
#TriggerTurnFaceUp.java

View File

@@ -1589,6 +1589,8 @@ lblTapped=Tapped
#TriggerTapsForMana.java
lblTappedForMana=Tapped for Mana
lblProduced=Produced
#TriggerTrains.java
lblTrains=Trains
#TriggerTransformed.java
lblTransformed=Transformed
#TriggerTurnFaceUp.java

View File

@@ -1589,6 +1589,8 @@ lblTapped=Girado
#TriggerTapsForMana.java
lblTappedForMana=Girado para maná
lblProduced=Producido
#TriggerTrains.java
lblTrains=Trains
#TriggerTransformed.java
lblTransformed=Transformado
#TriggerTurnFaceUp.java

View File

@@ -1587,6 +1587,8 @@ lblTapped=Tappato
#TriggerTapsForMana.java
lblTappedForMana=Tappato per produrre mana
lblProduced=Prodotto
#TriggerTrains.java
lblTrains=Trains
#TriggerTransformed.java
lblTransformed=Trasformato
#TriggerTurnFaceUp.java

View File

@@ -1588,6 +1588,8 @@ lblTapped=タップした
#TriggerTapsForMana.java
lblTappedForMana=マナのためにタップした
lblProduced=生産した
#TriggerTrains.java
lblTrains=Trains
#TriggerTransformed.java
lblTransformed=変身した
#TriggerTurnFaceUp.java

View File

@@ -1590,6 +1590,8 @@ lblTapped=已横置
#TriggerTapsForMana.java
lblTappedForMana=为法术力横置
lblProduced=产生
#TriggerTrains.java
lblTrains=Trains
#TriggerTransformed.java
lblTransformed=已转化
#TriggerTurnFaceUp.java

View File

@@ -0,0 +1,7 @@
Name:Human Soldier
ManaCost:no cost
Types:Creature Human Soldier
Colors:white,green
PT:1/1
K:Training
Oracle:Training (Whenever this creature attacks with another creature with greater power, put a +1/+1 counter on this creature.)