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) { if (e.getValue() <= 0) {
continue; continue;
} }
e.setValue(Integer.valueOf(e.getKey().addDamageAfterPrevention(e.getValue(), sourceLKI, isCombat, counterTable)));
sum += e.getValue(); sum += e.getValue();
e.getKey().addDamageAfterPrevention(e.getValue(), sourceLKI, isCombat, counterTable);
} }
if (sourceLKI.hasKeyword(Keyword.LIFELINK)) { if (sourceLKI.hasKeyword(Keyword.LIFELINK)) {

View File

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

View File

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

View File

@@ -88,6 +88,19 @@ public class SwingImageFetcher extends ImageFetcher {
break; break;
} catch (IOException e) { } catch (IOException e) {
System.err.println("Failed to download card [" + destPath + "] image: " + e.getMessage()); 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; break;
} catch (IOException e) { } catch (IOException e) {
System.out.println("Failed to download card [" + destPath + "] image: " + e.getMessage()); 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 Types:Creature Sliver
PT:3/3 PT:3/3
T:Mode$ DamageDealtOnce | ValidSource$ Sliver | Execute$ TrigGain | TriggerZones$ Battlefield | TriggerDescription$ Whenever a Sliver deals damage, its controller gains that much life. 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:X:TriggerCount$DamageAmount
SVar:PlayMain1:TRUE SVar:PlayMain1:TRUE
SVar:HasCombatEffect:TRUE SVar:HasCombatEffect:TRUE