mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Merge branch 'cleanup' into 'master'
Code cleanup See merge request core-developers/forge!4248
This commit is contained in:
@@ -203,7 +203,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
|
||||
@Override
|
||||
public GameLogEntry visit(GameEventTurnBegan event) {
|
||||
String message = Localizer.getInstance().getMessage("lblLogTurnNOwnerByPlayer", String.valueOf(event.turnNumber), event.turnOwner.toString());;
|
||||
String message = Localizer.getInstance().getMessage("lblLogTurnNOwnerByPlayer", String.valueOf(event.turnNumber), event.turnOwner.toString());
|
||||
return new GameLogEntry(GameLogEntryType.TURN, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ public class AbilityUtils {
|
||||
else if (hType.startsWith("Property") && ability instanceof SpellAbility) {
|
||||
String defined = hType.split("Property")[1];
|
||||
for (Player p : game.getPlayersInTurnOrder()) {
|
||||
if (p.hasProperty(defined, ((SpellAbility) ability).getActivatingPlayer(), ability.getHostCard(), (SpellAbility) ability)) {
|
||||
if (p.hasProperty(defined, ((SpellAbility) ability).getActivatingPlayer(), ability.getHostCard(), ability)) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
@@ -1105,7 +1105,7 @@ public class AbilityUtils {
|
||||
}
|
||||
// For merged permanent
|
||||
if (c instanceof CardCollection) {
|
||||
o = ((CardCollection) c).get(0).getController().getOpponents();;
|
||||
o = ((CardCollection) c).get(0).getController().getOpponents();
|
||||
}
|
||||
}
|
||||
else if (defParsed.endsWith("Owner")) {
|
||||
@@ -1828,13 +1828,11 @@ public class AbilityUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if (ctb instanceof CardTraitBase) {
|
||||
if (l[0].startsWith("CountersAddedThisTurn")) {
|
||||
final String[] parts = l[0].split(" ");
|
||||
CounterType cType = CounterType.getType(parts[1]);
|
||||
if (l[0].startsWith("CountersAddedThisTurn")) {
|
||||
final String[] parts = l[0].split(" ");
|
||||
CounterType cType = CounterType.getType(parts[1]);
|
||||
|
||||
return CardFactoryUtil.doXMath(game.getCounterAddedThisTurn(cType, parts[2], parts[3], c, player, ctb), expr, c);
|
||||
}
|
||||
return CardFactoryUtil.doXMath(game.getCounterAddedThisTurn(cType, parts[2], parts[3], c, player, ctb), expr, c);
|
||||
}
|
||||
}
|
||||
return CardFactoryUtil.xCount(c, s2);
|
||||
|
||||
@@ -54,10 +54,9 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
|
||||
if (targets.isEmpty()) {
|
||||
return;
|
||||
} else {
|
||||
attachTo = targets.get(0);
|
||||
}
|
||||
|
||||
|
||||
attachTo = targets.get(0);
|
||||
String attachToName = null;
|
||||
if (attachTo instanceof Card) {
|
||||
attachToName = CardTranslation.getTranslatedName(((Card)attachTo).getName());
|
||||
|
||||
@@ -261,7 +261,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
for (final Card dest : tgtCards) {
|
||||
if (null != source && null != dest) {
|
||||
if (null != dest) {
|
||||
// rule 121.5: If the first and second objects are the same object, nothing
|
||||
// happens
|
||||
if (source.equals(dest)) {
|
||||
|
||||
@@ -160,10 +160,9 @@ public abstract class TokenEffectBase extends SpellAbilityEffect {
|
||||
|
||||
tok.attachToEntity(ge);
|
||||
return true;
|
||||
} else {
|
||||
// not a GameEntity, cant be attach
|
||||
return false;
|
||||
}
|
||||
// not a GameEntity, cant be attach
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void addPumpUntil(SpellAbility sa, final Card c, long timestamp) {
|
||||
|
||||
@@ -3565,7 +3565,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|
||||
// values that are printed on card
|
||||
public final void setBasePowerString(final String s) {
|
||||
currentState.setBasePowerString(s);;
|
||||
currentState.setBasePowerString(s);
|
||||
}
|
||||
|
||||
public final void setBaseToughnessString(final String s) {
|
||||
|
||||
@@ -1508,14 +1508,14 @@ public class CardProperty {
|
||||
String what = property.substring("blocking".length());
|
||||
|
||||
if (StringUtils.isEmpty(what)) return combat.isBlocking(card);
|
||||
if (what.startsWith("Source")) return combat.isBlocking(card, source) ;
|
||||
if (what.startsWith("Source")) return combat.isBlocking(card, source);
|
||||
if (what.startsWith("CreatureYouCtrl")) {
|
||||
for (final Card c : CardLists.filter(sourceController.getCardsIn(ZoneType.Battlefield), Presets.CREATURES))
|
||||
if (combat.isBlocking(card, c))
|
||||
return true;
|
||||
return false;
|
||||
} else {
|
||||
for(Card c : AbilityUtils.getDefinedCards(source, what, spellAbility)) {
|
||||
for (Card c : AbilityUtils.getDefinedCards(source, what, spellAbility)) {
|
||||
if (combat.isBlocking(card, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,22 +89,20 @@ public class CostReveal extends CostPartWithList {
|
||||
} else if (this.getType().equals("SameColor")) {
|
||||
if (amount == null) {
|
||||
return false;
|
||||
} else {
|
||||
for (final Card card : handList) {
|
||||
if (CardLists.filter(handList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.sharesColorWith(card);
|
||||
}
|
||||
}).size() >= amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
for (final Card card : handList) {
|
||||
if (CardLists.filter(handList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.sharesColorWith(card);
|
||||
}
|
||||
}).size() >= amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return (amount == null) || (amount <= getMaxAmountX(ability, payer));
|
||||
//System.out.println("revealcost - " + amount + type + handList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
private final Map<ZoneType, PlayerZone> zones = Maps.newEnumMap(ZoneType.class);
|
||||
private final Map<Long, Integer> adjustLandPlays = Maps.newHashMap();
|
||||
private final Set<Long> adjustLandPlaysInfinite = Sets.newHashSet();
|
||||
private Map<Card, Card> maingameCardsMap = Maps.newHashMap();;
|
||||
private Map<Card, Card> maingameCardsMap = Maps.newHashMap();
|
||||
|
||||
private CardCollection currentPlanes = new CardCollection();
|
||||
private Set<String> prowl = Sets.newHashSet();
|
||||
@@ -3448,10 +3448,11 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.hasKeyword("CantSearchLibrary")) {
|
||||
if (hasKeyword("CantSearchLibrary")) {
|
||||
return false;
|
||||
} else return targetPlayer == null || !targetPlayer.equals(sa.getActivatingPlayer())
|
||||
|| !hasKeyword("Spells and abilities you control can't cause you to search your library.");
|
||||
}
|
||||
return targetPlayer == null || !targetPlayer.equals(sa.getActivatingPlayer())
|
||||
|| !hasKeyword("Spells and abilities you control can't cause you to search your library.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
||||
}
|
||||
|
||||
// do performanceMode only for cases where the activator is different than controller
|
||||
if (!Spell.performanceMode && activator != null && !card.getController().equals(activator)) {
|
||||
if (!Spell.performanceMode && !card.getController().equals(activator)) {
|
||||
// always make a lki copy in this case?
|
||||
card = CardUtil.getLKICopy(card);
|
||||
card.setController(activator, 0);
|
||||
|
||||
@@ -290,12 +290,11 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
||||
Card first = Iterables.getFirst(tgts, null);
|
||||
if (first == null) {
|
||||
return false;
|
||||
} else {
|
||||
byte firstColor = CardUtil.getColors(first).getColor();
|
||||
for (Card c : tgts) {
|
||||
if (CardUtil.getColors(c).getColor() != firstColor) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
byte firstColor = CardUtil.getColors(first).getColor();
|
||||
for (Card c : tgts) {
|
||||
if (CardUtil.getColors(c).getColor() != firstColor) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,19 +489,18 @@ public class TargetRestrictions {
|
||||
if (this.tgtZone.contains(ZoneType.Stack)) {
|
||||
// Stack Zone targets are considered later
|
||||
return true;
|
||||
} else {
|
||||
for (final Card c : game.getCardsIn(this.tgtZone)) {
|
||||
if (!c.isValid(this.validTgts, sa.getActivatingPlayer(), srcCard, sa)) {
|
||||
continue;
|
||||
}
|
||||
if (isTargeted && !sa.canTarget(c)) {
|
||||
continue;
|
||||
}
|
||||
if (sa.getTargets().contains(c)) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
for (final Card c : game.getCardsIn(this.tgtZone)) {
|
||||
if (!c.isValid(this.validTgts, sa.getActivatingPlayer(), srcCard, sa)) {
|
||||
continue;
|
||||
}
|
||||
if (isTargeted && !sa.canTarget(c)) {
|
||||
continue;
|
||||
}
|
||||
if (sa.getTargets().contains(c)) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -283,13 +283,12 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
// AbilityStatic should do nothing below
|
||||
return;
|
||||
}
|
||||
else {
|
||||
for (OptionalCost s : sp.getOptionalCosts()) {
|
||||
source.addOptionalCostPaid(s);
|
||||
}
|
||||
// The ability is added to stack HERE
|
||||
si = push(sp);
|
||||
|
||||
for (OptionalCost s : sp.getOptionalCosts()) {
|
||||
source.addOptionalCostPaid(s);
|
||||
}
|
||||
// The ability is added to stack HERE
|
||||
si = push(sp);
|
||||
|
||||
// Copied spells aren't cast per se so triggers shouldn't run for them.
|
||||
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
|
||||
Reference in New Issue
Block a user