mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Some cleanup (#2242)
This commit is contained in:
@@ -768,7 +768,7 @@ public final class GameActionUtil {
|
||||
final Game game = sourceCard.getGame();
|
||||
final Card eff = new Card(game.nextCardId(), game);
|
||||
eff.setTimestamp(game.getNextTimestamp());
|
||||
eff.setName(sourceCard.getName() + "'s Effect");
|
||||
eff.setName(sourceCard + "'s Effect");
|
||||
eff.setOwner(controller);
|
||||
|
||||
eff.setImageKey(sourceCard.getImageKey());
|
||||
|
||||
@@ -2843,11 +2843,7 @@ public class AbilityUtils {
|
||||
if (sq[0].startsWith("ColorsCtrl")) {
|
||||
final String restriction = l[0].substring(11);
|
||||
final CardCollection list = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), restriction, player, c, ctb);
|
||||
byte n = 0;
|
||||
for (final Card card : list) {
|
||||
n |= card.getColor().getColor();
|
||||
}
|
||||
return doXMath(ColorSet.fromMask(n).countColors(), expr, c, ctb);
|
||||
return doXMath(CardUtil.getColorsFromCards(list).countColors(), expr, c, ctb);
|
||||
}
|
||||
|
||||
// TODO move below to handlePaid
|
||||
|
||||
@@ -7294,4 +7294,11 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
public boolean attackVigilance() {
|
||||
return StaticAbilityAttackVigilance.attackVigilance(this);
|
||||
}
|
||||
|
||||
public boolean isAbilitySick() {
|
||||
if (!isSick()) {
|
||||
return false;
|
||||
}
|
||||
return !StaticAbilityActivateAbilityAsIfHaste.canActivate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,9 +356,9 @@ public final class CardUtil {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static ColorSet getColorsYouCtrl(final Player p) {
|
||||
public static ColorSet getColorsFromCards(Iterable<Card> list) {
|
||||
byte b = 0;
|
||||
for (Card c : p.getCardsIn(ZoneType.Battlefield)) {
|
||||
for (Card c : list) {
|
||||
b |= c.getColor().getColor();
|
||||
}
|
||||
return ColorSet.fromMask(b);
|
||||
|
||||
@@ -20,7 +20,6 @@ package forge.game.cost;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.staticability.StaticAbilityActivateAbilityAsIfHaste;
|
||||
|
||||
/**
|
||||
* The Class CostTap.
|
||||
@@ -62,7 +61,7 @@ public class CostTap extends CostPart {
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Player payer, final boolean effect) {
|
||||
final Card source = ability.getHostCard();
|
||||
return source.isUntapped() && !isAbilitySick(source);
|
||||
return source.isUntapped() && !source.isAbilitySick();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,11 +73,4 @@ public class CostTap extends CostPart {
|
||||
public <T> T accept(ICostVisitor<T> visitor) {
|
||||
return visitor.visit(this);
|
||||
}
|
||||
|
||||
public boolean isAbilitySick(final Card source) {
|
||||
if (!source.isSick()) {
|
||||
return false;
|
||||
}
|
||||
return !StaticAbilityActivateAbilityAsIfHaste.canActivate(source);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package forge.game.cost;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.staticability.StaticAbilityActivateAbilityAsIfHaste;
|
||||
|
||||
/**
|
||||
* The Class CostUntap.
|
||||
@@ -73,7 +72,7 @@ public class CostUntap extends CostPart {
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Player payer, final boolean effect) {
|
||||
final Card source = ability.getHostCard();
|
||||
return source.isTapped() && !isAbilitySick(source);
|
||||
return source.isTapped() && !source.isAbilitySick();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,11 +84,4 @@ public class CostUntap extends CostPart {
|
||||
public <T> T accept(ICostVisitor<T> visitor) {
|
||||
return visitor.visit(this);
|
||||
}
|
||||
|
||||
public boolean isAbilitySick(final Card source) {
|
||||
if (!source.isSick()) {
|
||||
return false;
|
||||
}
|
||||
return !StaticAbilityActivateAbilityAsIfHaste.canActivate(source);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
return;
|
||||
|
||||
TriggerHandler handler = card.getGame().getTriggerHandler();
|
||||
Trigger trig = TriggerHandler.parseTrigger(sVarHolder.getSVar(this.triggersWhenSpent), sourceCard, false);
|
||||
Trigger trig = TriggerHandler.parseTrigger(sVarHolder.getSVar(this.triggersWhenSpent), sourceCard, false, sVarHolder);
|
||||
handler.registerOneTrigger(trig);
|
||||
}
|
||||
|
||||
|
||||
@@ -1119,7 +1119,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
|
||||
clone.setPayCosts(getPayCosts().copy());
|
||||
if (manaPart != null) {
|
||||
clone.manaPart = new AbilityManaPart(this, mapParams);
|
||||
clone.manaPart = new AbilityManaPart(clone, mapParams);
|
||||
}
|
||||
|
||||
// need to copy the damage tables
|
||||
|
||||
@@ -249,7 +249,7 @@ public final class StaticAbilityContinuous {
|
||||
}
|
||||
// two variants for Red vs. red in keyword
|
||||
if (input.contains("ColorsYouCtrl") || input.contains("colorsYouCtrl")) {
|
||||
final ColorSet colorsYouCtrl = CardUtil.getColorsYouCtrl(controller);
|
||||
final ColorSet colorsYouCtrl = CardUtil.getColorsFromCards(controller.getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
for (byte color : colorsYouCtrl) {
|
||||
final String colorWord = MagicColor.toLongString(color);
|
||||
|
||||
Reference in New Issue
Block a user