mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
automatically inline redundant variable
This commit is contained in:
@@ -190,11 +190,10 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (obj instanceof Card) {
|
if (obj instanceof Card) {
|
||||||
Card tgtCard = gameCard;
|
counterAmount = sa.usesTargeting() && sa.hasParam("DividedAsYouChoose") ? sa.getTargetRestrictions().getDividedValue(gameCard) : counterAmount;
|
||||||
counterAmount = sa.usesTargeting() && sa.hasParam("DividedAsYouChoose") ? sa.getTargetRestrictions().getDividedValue(tgtCard) : counterAmount;
|
if (!sa.usesTargeting() || gameCard.canBeTargetedBy(sa)) {
|
||||||
if (!sa.usesTargeting() || tgtCard.canBeTargetedBy(sa)) {
|
|
||||||
if (max != -1) {
|
if (max != -1) {
|
||||||
counterAmount = Math.max(Math.min(max - tgtCard.getCounters(counterType), counterAmount), 0);
|
counterAmount = Math.max(Math.min(max - gameCard.getCounters(counterType), counterAmount), 0);
|
||||||
}
|
}
|
||||||
if (sa.hasParam("UpTo")) {
|
if (sa.hasParam("UpTo")) {
|
||||||
Map<String, Object> params = Maps.newHashMap();
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
@@ -205,15 +204,15 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
// Adapt need extra logic
|
// Adapt need extra logic
|
||||||
if (sa.hasParam("Adapt")) {
|
if (sa.hasParam("Adapt")) {
|
||||||
if (!(tgtCard.getCounters(CounterType.P1P1) == 0
|
if (!(gameCard.getCounters(CounterType.P1P1) == 0
|
||||||
|| tgtCard.hasKeyword("CARDNAME adapts as though it had no +1/+1 counters"))) {
|
|| gameCard.hasKeyword("CARDNAME adapts as though it had no +1/+1 counters"))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Tribute")) {
|
if (sa.hasParam("Tribute")) {
|
||||||
// make a copy to check if it would be on the battlefield
|
// make a copy to check if it would be on the battlefield
|
||||||
Card noTributeLKI = CardUtil.getLKICopy(tgtCard);
|
Card noTributeLKI = CardUtil.getLKICopy(gameCard);
|
||||||
// this check needs to check if this card would be on the battlefield
|
// this check needs to check if this card would be on the battlefield
|
||||||
noTributeLKI.setLastKnownZone(activator.getZone(ZoneType.Battlefield));
|
noTributeLKI.setLastKnownZone(activator.getZone(ZoneType.Battlefield));
|
||||||
|
|
||||||
@@ -236,65 +235,65 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String message = "Do you want to put " + counterAmount + " +1/+1 counters on " + tgtCard + " ?";
|
String message = "Do you want to put " + counterAmount + " +1/+1 counters on " + gameCard + " ?";
|
||||||
Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa, "Choose an opponent");
|
Player chooser = pc.chooseSingleEntityForEffect(activator.getOpponents(), sa, "Choose an opponent");
|
||||||
|
|
||||||
if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.Tribute, message)) {
|
if (chooser.getController().confirmAction(sa, PlayerActionConfirmMode.Tribute, message)) {
|
||||||
tgtCard.setTributed(true);
|
gameCard.setTributed(true);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rememberCards) {
|
if (rememberCards) {
|
||||||
card.addRemembered(tgtCard);
|
card.addRemembered(gameCard);
|
||||||
}
|
}
|
||||||
final Zone zone = tgtCard.getGame().getZoneOf(tgtCard);
|
final Zone zone = gameCard.getGame().getZoneOf(gameCard);
|
||||||
if (zone == null || zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Stack)) {
|
if (zone == null || zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Stack)) {
|
||||||
if (etbcounter) {
|
if (etbcounter) {
|
||||||
tgtCard.addEtbCounter(counterType, counterAmount, placer);
|
gameCard.addEtbCounter(counterType, counterAmount, placer);
|
||||||
} else {
|
} else {
|
||||||
tgtCard.addCounter(counterType, counterAmount, placer, true, table);
|
gameCard.addCounter(counterType, counterAmount, placer, true, table);
|
||||||
}
|
}
|
||||||
if (remember) {
|
if (remember) {
|
||||||
final int value = tgtCard.getTotalCountersToAdd();
|
final int value = gameCard.getTotalCountersToAdd();
|
||||||
tgtCard.addCountersAddedBy(card, counterType, value);
|
gameCard.addCountersAddedBy(card, counterType, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Evolve")) {
|
if (sa.hasParam("Evolve")) {
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put(AbilityKey.Card, tgtCard);
|
runParams.put(AbilityKey.Card, gameCard);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.Evolved, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Evolved, runParams, false);
|
||||||
}
|
}
|
||||||
if (sa.hasParam("Monstrosity")) {
|
if (sa.hasParam("Monstrosity")) {
|
||||||
tgtCard.setMonstrous(true);
|
gameCard.setMonstrous(true);
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put(AbilityKey.Card, tgtCard);
|
runParams.put(AbilityKey.Card, gameCard);
|
||||||
runParams.put(AbilityKey.MonstrosityAmount, counterAmount);
|
runParams.put(AbilityKey.MonstrosityAmount, counterAmount);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.BecomeMonstrous, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.BecomeMonstrous, runParams, false);
|
||||||
}
|
}
|
||||||
if (sa.hasParam("Renown")) {
|
if (sa.hasParam("Renown")) {
|
||||||
tgtCard.setRenowned(true);
|
gameCard.setRenowned(true);
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put(AbilityKey.Card, tgtCard);
|
runParams.put(AbilityKey.Card, gameCard);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.BecomeRenowned, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.BecomeRenowned, runParams, false);
|
||||||
}
|
}
|
||||||
if (sa.hasParam("Adapt")) {
|
if (sa.hasParam("Adapt")) {
|
||||||
// need to remove special keyword
|
// need to remove special keyword
|
||||||
tgtCard.removeHiddenExtrinsicKeyword("CARDNAME adapts as though it had no +1/+1 counters");
|
gameCard.removeHiddenExtrinsicKeyword("CARDNAME adapts as though it had no +1/+1 counters");
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put(AbilityKey.Card, tgtCard);
|
runParams.put(AbilityKey.Card, gameCard);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.Adapt, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.Adapt, runParams, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// adding counters to something like re-suspend cards
|
// adding counters to something like re-suspend cards
|
||||||
// etbcounter should apply multiplier
|
// etbcounter should apply multiplier
|
||||||
if (etbcounter) {
|
if (etbcounter) {
|
||||||
tgtCard.addEtbCounter(counterType, counterAmount, placer);
|
gameCard.addEtbCounter(counterType, counterAmount, placer);
|
||||||
} else {
|
} else {
|
||||||
tgtCard.addCounter(counterType, counterAmount, placer, false, table);
|
gameCard.addCounter(counterType, counterAmount, placer, false, table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.updateLastStateForCard(tgtCard);
|
game.updateLastStateForCard(gameCard);
|
||||||
}
|
}
|
||||||
} else if (obj instanceof Player) {
|
} else if (obj instanceof Player) {
|
||||||
// Add Counters to players!
|
// Add Counters to players!
|
||||||
|
|||||||
Reference in New Issue
Block a user