Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring

This commit is contained in:
leriomaggio
2021-07-25 08:09:22 +01:00
6 changed files with 39 additions and 5 deletions

View File

@@ -2187,8 +2187,8 @@ public class GameAction {
if (e.getValue() <= 0) {
continue;
}
e.setValue(Integer.valueOf(e.getKey().addDamageAfterPrevention(e.getValue(), sourceLKI, isCombat, counterTable)));
sum += e.getValue();
e.getKey().addDamageAfterPrevention(e.getValue(), sourceLKI, isCombat, counterTable);
}
if (sourceLKI.hasKeyword(Keyword.LIFELINK)) {

View File

@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
import forge.GameCommand;
import forge.ImageKeys;
import forge.card.CardRarity;
import forge.game.Game;
import forge.game.GameObject;
import forge.game.ability.AbilityFactory;
@@ -123,6 +124,8 @@ public class EffectEffect extends SpellAbilityEffect {
}
String image;
String set = hostCard.getSetCode().toLowerCase();
StringBuilder imageSet = new StringBuilder();
if (sa.hasParam("Image")) {
image = ImageKeys.getTokenKey(sa.getParam("Image"));
} else if (name.startsWith("Emblem")) { // try to get the image from name
@@ -135,11 +138,17 @@ public class EffectEffect extends SpellAbilityEffect {
} else { // use host image
image = hostCard.getImageKey();
}
imageSet.append(image).append("_").append(set);
image = imageSet.toString();
for (Player controller : effectOwner) {
final Card eff = createEffect(sa, controller, name, image);
eff.setSetCode(sa.getHostCard().getSetCode());
eff.setRarity(sa.getHostCard().getRarity());
if (name.startsWith("Emblem")) {
eff.setRarity(CardRarity.Common);
} else {
eff.setRarity(sa.getHostCard().getRarity());
}
// Abilities and triggers work the same as they do for Token
// Grant abilities

View File

@@ -653,8 +653,7 @@ public class Player extends GameEntity implements Comparable<Player> {
loseLife(Math.min(amount, life - 7));
} else if (hasKeyword("DamageLifeThreshold:1") && life <= amount) {
loseLife(Math.min(amount, life - 1));
}
else {
} else {
// rule 118.2. Damage dealt to a player normally causes that player to lose that much life.
loseLife(amount);
}

View File

@@ -88,6 +88,19 @@ public class SwingImageFetcher extends ImageFetcher {
break;
} catch (IOException e) {
System.err.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
if (urlToDownload.contains("tokens")) {
int setIndex = urlToDownload.lastIndexOf('_');
int typeIndex = urlToDownload.lastIndexOf('.');
String setlessFilename = urlToDownload.substring(0, setIndex);
String extension = urlToDownload.substring(typeIndex);
urlToDownload = setlessFilename+extension;
try {
doFetch(tofullBorder(urlToDownload));
break;
} catch (IOException t) {
System.err.println("Failed to download setless token [" + destPath + "]: " + e.getMessage());
}
}
}
}
}

View File

@@ -76,6 +76,19 @@ public class LibGDXImageFetcher extends ImageFetcher {
break;
} catch (IOException e) {
System.out.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
if (urlToDownload.contains("tokens")) {
int setIndex = urlToDownload.lastIndexOf('_');
int typeIndex = urlToDownload.lastIndexOf('.');
String setlessFilename = urlToDownload.substring(0, setIndex);
String extension = urlToDownload.substring(typeIndex);
urlToDownload = setlessFilename+extension;
try {
doFetch(tofullBorder(urlToDownload));
break;
} catch (IOException t) {
System.out.println("Failed to download setless token [" + destPath + "]: " + e.getMessage());
}
}
}
}
}

View File

@@ -3,7 +3,7 @@ ManaCost:3 W
Types:Creature Sliver
PT:3/3
T:Mode$ DamageDealtOnce | ValidSource$ Sliver | Execute$ TrigGain | TriggerZones$ Battlefield | TriggerDescription$ Whenever a Sliver deals damage, its controller gains that much life.
SVar:TrigGain:DB$GainLife | Defined$ TriggeredSourceController | LifeAmount$ X
SVar:TrigGain:DB$ GainLife | Defined$ TriggeredSourceController | LifeAmount$ X
SVar:X:TriggerCount$DamageAmount
SVar:PlayMain1:TRUE
SVar:HasCombatEffect:TRUE