mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Added Leech Bonder
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -5953,6 +5953,7 @@ res/cardsfolder/l/leap_of_flame.txt svneol=native#text/plain
|
|||||||
res/cardsfolder/l/leaping_lizard.txt svneol=native#text/plain
|
res/cardsfolder/l/leaping_lizard.txt svneol=native#text/plain
|
||||||
res/cardsfolder/l/leatherback_baloth.txt svneol=native#text/plain
|
res/cardsfolder/l/leatherback_baloth.txt svneol=native#text/plain
|
||||||
res/cardsfolder/l/leave_no_trace.txt svneol=native#text/plain
|
res/cardsfolder/l/leave_no_trace.txt svneol=native#text/plain
|
||||||
|
res/cardsfolder/l/leech_bonder.txt -text
|
||||||
res/cardsfolder/l/leeches.txt svneol=native#text/plain
|
res/cardsfolder/l/leeches.txt svneol=native#text/plain
|
||||||
res/cardsfolder/l/leeching_bite.txt -text
|
res/cardsfolder/l/leeching_bite.txt -text
|
||||||
res/cardsfolder/l/leeching_licid.txt -text
|
res/cardsfolder/l/leeching_licid.txt -text
|
||||||
|
|||||||
11
res/cardsfolder/l/leech_bonder.txt
Normal file
11
res/cardsfolder/l/leech_bonder.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Name:Leech Bonder
|
||||||
|
ManaCost:2 U
|
||||||
|
Types:Creature Merfolk Soldier
|
||||||
|
PT:3/3
|
||||||
|
K:etbCounter:M1M1:2
|
||||||
|
A:AB$ Pump | Cost$ U Q | ValidTgts$ Creature | TgtPrompt$ Select target creature to remove counters | SubAbility$ DBMove | StackDescription$ None | SpellDescription$ Move a counter from target creature onto another target creature.
|
||||||
|
SVar:DBMove:DB$ MoveCounter | Source$ ParentTarget | ValidTgts$ Creature | TgtPrompt$ Select target creature to add counters | TargetUnique$ True | CounterType$ Any | CounterNum$ 1
|
||||||
|
SVar:RemAIDeck:True
|
||||||
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/leech_bonder.jpg
|
||||||
|
Oracle:Leech Bonder enters the battlefield with two -1/-1 counters on it.\n{U}, {Q}: Move a counter from target creature onto another target creature. ({Q} is the untap symbol.)
|
||||||
|
SetInfo:SHM Uncommon
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package forge.card.ability.effects;
|
package forge.card.ability.effects;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CounterType;
|
import forge.CounterType;
|
||||||
@@ -8,6 +10,7 @@ import forge.card.ability.AbilityUtils;
|
|||||||
import forge.card.ability.SpellAbilityEffect;
|
import forge.card.ability.SpellAbilityEffect;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
public class CountersMoveEffect extends SpellAbilityEffect {
|
public class CountersMoveEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -28,11 +31,19 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
source = srcCards.get(0);
|
source = srcCards.get(0);
|
||||||
}
|
}
|
||||||
final List<Card> tgtCards = getTargetCards(sa);
|
final List<Card> tgtCards = getTargetCards(sa);
|
||||||
|
final String countername = sa.getParam("CounterType");
|
||||||
final CounterType cType = CounterType.valueOf(sa.getParam("CounterType"));
|
|
||||||
final int amount = AbilityUtils.calculateAmount(sa.getSourceCard(), sa.getParam("CounterNum"), sa);
|
final int amount = AbilityUtils.calculateAmount(sa.getSourceCard(), sa.getParam("CounterNum"), sa);
|
||||||
|
|
||||||
sb.append("Move ").append(amount).append(" ").append(cType.getName()).append(" counter");
|
sb.append("Move ");
|
||||||
|
if ("Any".matches(countername)) {
|
||||||
|
if (amount == 1) {
|
||||||
|
sb.append("a counter");
|
||||||
|
} else {
|
||||||
|
sb.append(amount).append(" ").append(" counter");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sb.append(amount).append(" ").append(countername).append(" counter");
|
||||||
|
}
|
||||||
if (amount != 1) {
|
if (amount != 1) {
|
||||||
sb.append("s");
|
sb.append("s");
|
||||||
}
|
}
|
||||||
@@ -46,13 +57,22 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve(SpellAbility sa) {
|
public void resolve(SpellAbility sa) {
|
||||||
final Card host = sa.getSourceCard();
|
final Card host = sa.getSourceCard();
|
||||||
|
final String counterName = sa.getParam("CounterType");
|
||||||
final CounterType cType = CounterType.valueOf(sa.getParam("CounterType"));
|
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
if (!sa.getParam("CounterNum").equals("All")) {
|
if (!sa.getParam("CounterNum").equals("All")) {
|
||||||
amount = AbilityUtils.calculateAmount(host, sa.getParam("CounterNum"), sa);
|
amount = AbilityUtils.calculateAmount(host, sa.getParam("CounterNum"), sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CounterType cType = null;
|
||||||
|
try {
|
||||||
|
cType = AbilityUtils.getCounterType(counterName, sa);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!counterName.matches("Any")) {
|
||||||
|
System.out.println("Counter type doesn't match, nor does an SVar exist with the type name.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Card source = null;
|
Card source = null;
|
||||||
List<Card> srcCards;
|
List<Card> srcCards;
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
@@ -76,16 +96,75 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
for (final Card dest : tgtCards) {
|
for (final Card dest : tgtCards) {
|
||||||
if ((null != source) && (null != dest)) {
|
if ((null != source) && (null != dest)) {
|
||||||
if (source.getCounters(cType) >= amount) {
|
if (!"Any".matches(counterName)) {
|
||||||
if (!dest.hasKeyword("CARDNAME can't have counters placed on it.")
|
if (dest.canHaveCountersPlacedOnIt(cType)
|
||||||
&& !(dest.hasKeyword("CARDNAME can't have -1/-1 counters placed on it.") && cType
|
&& source.getCounters(cType) >= amount) {
|
||||||
.equals(CounterType.M1M1))) {
|
|
||||||
dest.addCounter(cType, amount, true);
|
dest.addCounter(cType, amount, true);
|
||||||
source.subtractCounter(cType, amount);
|
source.subtractCounter(cType, amount);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (dest.hasKeyword("CARDNAME can't have counters placed on it.")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean check = false;
|
||||||
|
for (final Card c : dest.getController().getCreaturesInPlay()) {//Melira, Sylvok Outcast
|
||||||
|
if (c.hasKeyword("Creatures you control can't have -1/-1 counters placed on them.")) {
|
||||||
|
check = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (amount > 0 && source.hasCounters()) {
|
||||||
|
final Map<CounterType, Integer> tgtCounters = source.getCounters();
|
||||||
|
CounterType chosenType = null;
|
||||||
|
int chosenAmount;
|
||||||
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
|
final ArrayList<CounterType> typeChoices = new ArrayList<CounterType>();
|
||||||
|
// get types of counters
|
||||||
|
for (CounterType key : tgtCounters.keySet()) {
|
||||||
|
if (tgtCounters.get(key) > 0 && !(key == CounterType.M1M1 && check)) {
|
||||||
|
typeChoices.add(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeChoices.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeChoices.size() > 1) {
|
||||||
|
String prompt = "Select type counters to remove";
|
||||||
|
chosenType = GuiChoose.one(prompt, typeChoices);
|
||||||
|
} else {
|
||||||
|
chosenType = typeChoices.get(0);
|
||||||
|
}
|
||||||
|
chosenAmount = tgtCounters.get(chosenType);
|
||||||
|
if (chosenAmount > amount) {
|
||||||
|
chosenAmount = amount;
|
||||||
|
}
|
||||||
|
// make list of amount choices
|
||||||
|
if (chosenAmount > 1) {
|
||||||
|
final List<Integer> choices = new ArrayList<Integer>();
|
||||||
|
for (int i = 1; i <= chosenAmount; i++) {
|
||||||
|
choices.add(Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
String prompt = "Select the number of " + chosenType.getName() + " counters to remove";
|
||||||
|
chosenAmount = GuiChoose.one(prompt, choices);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Object key : tgtCounters.keySet()) {
|
||||||
|
if (tgtCounters.get(key) > 0) {
|
||||||
|
chosenType = (CounterType) key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// subtract all of selected type
|
||||||
|
chosenAmount = tgtCounters.get(chosenType);
|
||||||
|
if (chosenAmount > amount) {
|
||||||
|
chosenAmount = amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dest.addCounter(chosenType, chosenAmount, true);
|
||||||
|
source.subtractCounter(chosenType, chosenAmount);
|
||||||
|
amount -= chosenAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // moveCounterResolve
|
} // moveCounterResolve
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user