mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- "Whenever one or more .... fights" (e.g. Neyith)
This commit is contained in:
@@ -62,6 +62,8 @@ public enum AbilityKey {
|
||||
Explorer("Explorer"),
|
||||
Event("Event"),
|
||||
Fighter("Fighter"),
|
||||
Fighter1("Fighter1"),
|
||||
Fighter2("Fighter2"),
|
||||
FirstTime("FirstTime"),
|
||||
Fizzle("Fizzle"),
|
||||
IsCombat("IsCombat"), // TODO confirm that this and IsCombatDamage can be merged
|
||||
|
||||
@@ -63,6 +63,11 @@ public class FightEffect extends DamageBaseEffect {
|
||||
runParams.put(AbilityKey.Fighter, c);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Fight, runParams, false);
|
||||
}
|
||||
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Fighter1, fighters.get(0));
|
||||
runParams.put(AbilityKey.Fighter2, fighters.get(1));
|
||||
game.getTriggerHandler().runTrigger(TriggerType.FightOnce, runParams, false);
|
||||
}
|
||||
|
||||
private static List<Card> getFighters(SpellAbility sa) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
public class TriggerFightOnce extends Trigger {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Trigger_Fight.
|
||||
* </p>
|
||||
*
|
||||
* @param params
|
||||
* a {@link java.util.HashMap} object.
|
||||
* @param host
|
||||
* a {@link forge.game.card.Card} object.
|
||||
* @param intrinsic
|
||||
* the intrinsic
|
||||
*/
|
||||
public TriggerFightOnce(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) {
|
||||
final Card fighter1 = (Card) runParams.get(AbilityKey.Fighter1);
|
||||
final Card fighter2 = (Card) runParams.get(AbilityKey.Fighter2);
|
||||
|
||||
if (hasParam("ValidCard")) {
|
||||
return fighter1.isValid(getParam("ValidCard").split(","),
|
||||
getHostCard().getController(), getHostCard(), null)
|
||||
|| fighter2.isValid(getParam("ValidCard").split(","),
|
||||
getHostCard().getController(), getHostCard(), null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa, Map<AbilityKey, Object> runParams) {
|
||||
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Fighter1, AbilityKey.Fighter2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImportantStackObjects(SpellAbility sa) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(Localizer.getInstance().getMessage("lblFighter")).append(" 1: ").append(sa.getTriggeringObject(AbilityKey.Fighter1)).append(", ");
|
||||
sb.append(Localizer.getInstance().getMessage("lblFighter")).append(" 2: ").append(sa.getTriggeringObject(AbilityKey.Fighter2));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public enum TriggerType {
|
||||
Exploited(TriggerExploited.class),
|
||||
Explores(TriggerExplores.class),
|
||||
Fight(TriggerFight.class),
|
||||
FightOnce(TriggerFightOnce.class),
|
||||
FlippedCoin(TriggerFlippedCoin.class),
|
||||
Immediate(TriggerImmediate.class),
|
||||
Investigated(TriggerInvestigated.class),
|
||||
|
||||
Reference in New Issue
Block a user