Merge branch 'master' into newmaster

This commit is contained in:
Anthony Calosa
2022-09-02 09:24:20 +08:00
18 changed files with 25586 additions and 25 deletions

View File

@@ -16,20 +16,21 @@ import forge.util.lang.LangGerman;
import forge.util.lang.LangItalian;
import forge.util.lang.LangJapanese;
import forge.util.lang.LangSpanish;
import forge.util.lang.LangFrench;
/**
* Static library containing language-related utility methods.
*/
public abstract class Lang {
private static Lang instance;
private static Lang instance;
private static Lang englishInstance;
protected String languageCode;
protected String countryCode;
public static void createInstance(String localeID) {
String[] splitLocale = localeID.split("-");
String[] splitLocale = localeID.split("-");
String language = splitLocale[0];
String country = splitLocale[1];
if (language.equals("de")) {
@@ -42,6 +43,8 @@ public abstract class Lang {
instance = new LangChinese();
} else if (language.equals("ja")) {
instance = new LangJapanese();
} else if (language.equals("fr")) {
instance = new LangFrench();
} else { // default is English
instance = new LangEnglish();
}
@@ -54,9 +57,9 @@ public abstract class Lang {
englishInstance.countryCode = "US";
}
public static Lang getInstance() {
return instance;
}
public static Lang getInstance() {
return instance;
}
public static Lang getEnglishInstance() {
return englishInstance;
@@ -70,7 +73,7 @@ public abstract class Lang {
* of a numbers, eg. "st" for 1 ("first") and "th" for 4 ("fourth").
*
* @param position
* the number to get the ordinal suffix for.
* the number to get the ordinal suffix for.
* @return a string containing two characters.
*/
public abstract String getOrdinal(final int position);
@@ -81,26 +84,32 @@ public abstract class Lang {
return has1 ? (has2 ? s1 + " and " + s2 : s1) : (has2 ? s2 : "");
}
public static <T> String joinHomogenous(final Iterable<T> objects) { return joinHomogenous(Lists.newArrayList(objects)); }
public static <T> String joinHomogenous(final Collection<T> objects) { return joinHomogenous(objects, null, "and"); }
public static <T> String joinHomogenous(final Iterable<T> objects) {
return joinHomogenous(Lists.newArrayList(objects));
}
public static <T> String joinHomogenous(final Collection<T> objects) {
return joinHomogenous(objects, null, "and");
}
public static <T> String joinHomogenous(final Collection<T> objects, final Function<T, String> accessor) {
return joinHomogenous(objects, accessor, "and");
}
public static <T> String joinHomogenous(final Collection<T> objects, final Function<T, String> accessor, final String lastUnion) {
public static <T> String joinHomogenous(final Collection<T> objects, final Function<T, String> accessor,
final String lastUnion) {
int remaining = objects.size();
final StringBuilder sb = new StringBuilder();
for (final T obj : objects) {
remaining--;
if (accessor != null) {
sb.append(accessor.apply(obj));
}
else {
} else {
sb.append(obj);
}
if (remaining > 1) {
sb.append(", ");
}
else if (remaining == 1) {
} else if (remaining == 1) {
sb.append(" ").append(lastUnion).append(" ");
}
}
@@ -108,7 +117,8 @@ public abstract class Lang {
}
public static <T> String joinVerb(final List<T> subjects, final String verb) {
return subjects.size() > 1 || !subjectIsSingle3rdPerson(Iterables.getFirst(subjects, "it").toString()) ? verb : verbs3rdPersonSingular(verb);
return subjects.size() > 1 || !subjectIsSingle3rdPerson(Iterables.getFirst(subjects, "it").toString()) ? verb
: verbs3rdPersonSingular(verb);
}
public static String joinVerb(final String subject, final String verb) {
@@ -126,7 +136,8 @@ public abstract class Lang {
}
public static String getPlural(final String noun) {
return noun + (noun.endsWith("s") && !noun.endsWith("ds") || noun.endsWith("x") || noun.endsWith("ch") ? "es" : noun.endsWith("ds") ? "" : "s");
return noun + (noun.endsWith("s") && !noun.endsWith("ds") || noun.endsWith("x") || noun.endsWith("ch") ? "es"
: noun.endsWith("ds") ? "" : "s");
}
public static String nounWithAmount(final int cnt, final String noun) {
@@ -170,6 +181,7 @@ public abstract class Lang {
}
public abstract String getPossesive(final String name);
public abstract String getPossessedObject(final String owner, final String object);
public static boolean startsWithVowel(final String word) {
@@ -177,14 +189,17 @@ public abstract class Lang {
}
private static final Pattern VOWEL_PATTERN = Pattern.compile("[aeiou]", Pattern.CASE_INSENSITIVE);
public static boolean isVowel(final char letter) {
return VOWEL_PATTERN.matcher(String.valueOf(letter)).find();
}
public final static String[] numbers0 = new String[] {
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eightteen", "nineteen" };
public final static String[] numbers20 = new String[] {"twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety" };
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eightteen",
"nineteen" };
public final static String[] numbers20 = new String[] { "twenty", "thirty", "fourty", "fifty", "sixty", "seventy",
"eighty", "ninety" };
public static String getNumeral(int n) {
final String prefix = n < 0 ? "minus " : "";

View File

@@ -0,0 +1,40 @@
package forge.util.lang;
import forge.util.Lang;
public class LangFrench extends Lang {
@Override
public String getOrdinal(final int position) {
if (position == 1) {
return position + "ᵉʳ";
} else {
return position + "";
}
}
@Override
public String getPossesive(final String name) {
if ("Vous".equalsIgnoreCase(name)) {
return name;
}
return "de " + name;
}
@Override
public String getPossessedObject(final String owner, final String object) {
if ("Vous".equalsIgnoreCase(owner)) {
return getPossesive(owner) + " " + object;
}
return object + " " + getPossesive(owner);
}
@Override
public String getNickName(final String name) {
if (name.contains(",")) {
return name.split(",")[0];
} else {
return name.split(" ")[0];
}
}
}

View File

@@ -2,6 +2,7 @@ Name:Dega Disciple
ManaCost:W
Types:Creature Human Wizard
PT:1/1
A:AB$ Pump | Cost$ B T | ValidTgts$ Creature | TgtPrompt$ Select target creature | IsCurse$ True | NumAtt$ -2 | SpellDescription$ Target creature gets -2/-0 until end of turn.
A:AB$ Pump | Cost$ R T | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +2 | SpellDescription$ Target creature gets +2/-0 until end of turn.
A:AB$ Pump | Cost$ B T | ValidTgts$ Creature | IsCurse$ True | NumAtt$ -2 | SpellDescription$ Target creature gets -2/-0 until end of turn.
A:AB$ Pump | Cost$ R T | ValidTgts$ Creature | NumAtt$ +2 | SpellDescription$ Target creature gets +2/+0 until end of turn.
DeckHints:Color$Black|Red
Oracle:{B}, {T}: Target creature gets -2/-0 until end of turn.\n{R}, {T}: Target creature gets +2/+0 until end of turn.

View File

@@ -3,5 +3,5 @@ ManaCost:4 G
Types:Sorcery
A:SP$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Land.Basic,Card.Gate | ChangeTypeDesc$ basic land cards and/or Gate | ChangeNum$ 2 | Tapped$ True | SubAbility$ DBInitiative | SpellDescription$ Search your library for up to two basic land cards and/or Gate cards, put them onto the battlefield tapped, then shuffle.
SVar:DBInitiative:DB$ TakeInitiative | SpellDescription$ You take the initiative.
DeckHints$Type$Gate
DeckHints:Type$Gate
Oracle:Search your library for up to two basic land cards and/or Gate cards, put them onto the battlefield tapped, then shuffle.\nYou take the initiative.

View File

@@ -0,0 +1,8 @@
Name:Artillery Blast
ManaCost:1 W
Types:Instant
A:SP$ DealDamage | ValidTgts$ Creature.tapped | TgtPrompt$ Select target tapped creature |NumDmg$ X | SpellDescription$ Domain — CARDNAME deals X damage to target tapped creature, where X is 1 plus the number of basic land types among lands you control.
SVar:X:Count$Domain/Plus.1
SVar:BuffedBy:Plains,Island,Swamp,Mountain,Forest
AI:RemoveDeck:Random
Oracle:Domain — Artillery Blast deals X damage to target tapped creature, where X is 1 plus the number of basic land types among lands you control.

View File

@@ -0,0 +1,6 @@
Name:Battle-Rage Blessing
ManaCost:1 B
Types:Instant
A:SP$ Pump | ValidTgts$ Creature | KW$ Indestructible & Deathtouch | SpellDescription$ Target creature gains deathtouch and indestructible until end of turn. (Damage and effects that say "destroy" don't destroy it.)
DeckHas:Keyword$Deathtouch|Indestructible
Oracle:Target creature gains deathtouch and indestructible until end of turn. (Damage and effects that say "destroy" don't destroy it.)

View File

@@ -0,0 +1,8 @@
Name:Battlefly Swarm
ManaCost:B
Types:Creature Phyrexian Insect
PT:1/1
K:Flying
A:AB$ Pump | Cost$ B | Defined$ Self | KW$ Deathtouch | SpellDescription$ CARDNAME gains deathtouch until end of turn.
DeckHas:Keyword$Deathtouch
Oracle:Flying\n{B}: Battlefly Swarm gains deathtouch until end of turn.

View File

@@ -0,0 +1,7 @@
Name:Clockwork Drawbridge
ManaCost:W
Types:Artifact Creature Wall
PT:0/3
K:Defender
A:AB$ Tap | Cost$ 2 W T | ValidTgts$ Creature | SpellDescription$ Tap target creature.
Oracle:Defender\n{2}{W}, {T}: Tap target creature

View File

@@ -0,0 +1,7 @@
Name:Deathbloom Gardener
ManaCost:2 G
Types:Creature Elf Druid
PT:1/1
K:Deathtouch
A:AB$ Mana | Cost$ T | Produced$ Any | SpellDescription$ Add one mana of any color.
Oracle:Deathtouch\n{T}: Add one mana of any color.

View File

@@ -0,0 +1,7 @@
Name:Destroy Evil
ManaCost:1 W
Types:Instant
A:SP$ Charm | Choices$ DBDestroyCreature,DBDestroyEnchantment
SVar:DBDestroyCreature:DB$ Destroy | ValidTgts$ Creature.toughnessGE4 | TgtPrompt$ Select target creature with toughness 4 or greater | SpellDescription$ Destroy target creature with toughness 4 or greater.
SVar:DBDestroyEnchantment:DB$ Destroy | ValidTgts$ Enchantment | SpellDescription$ Destroy target enchantment.
Oracle:Choose one — \n• Destroy target creature with toughness 4 or greater.\n• Destroy target enchantment.

View File

@@ -0,0 +1,9 @@
Name:Eerie Soultender
ManaCost:2 B
Types:Creature Spirit Cleric
PT:3/1
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigMill | TriggerDescription$ When CARDNAME enters the battlefield, mill three cards.
SVar:TrigMill:DB$ Mill | NumCards$ 3 | Defined$ You
A:AB$ ChangeZone | Cost$ 4 B ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | Origin$ Graveyard | Destination$ Hand | TgtPrompt$ Select another target creature card in your graveyard | ValidTgts$ Creature.YouOwn+Other | SpellDescription$ Return another target creature card from your graveyard to your hand.
DeckHas:Ability$Graveyard|Mill
Oracle:When Eerie Soultender enters the battlefield, mill three cards. (To mill a card, put the top card of your library into your graveyard.)\n{4}{B}, Exile Eerie Soultender from your graveyard: Return another target creature card from your graveyard to your hand.

View File

@@ -0,0 +1,7 @@
Name:Elfhame Wurm
ManaCost:4 G
Types:Creature Wurm
PT:5/4
K:Vigilance
K:Trample
Oracle:Vigilance, trample

View File

@@ -0,0 +1,7 @@
Name:Ertai's Scorn
ManaCost:1 U U
Types:Instant
S:Mode$ ReduceCost | ValidCard$ Card.Self | CheckSVar$ OppCastThisTurn | SVarCompare$ GE2 | Type$ Spell | Amount$ 1 | Color$ U | EffectZone$ All | Description$ This spell costs {U} less to cast if an opponent cast two or more spells this turn.
A:SP$ Counter | TargetType$ Spell | ValidTgts$ Card | SpellDescription$ Counter target spell.
SVar:OppCastThisTurn:Count$ThisTurnCast_Card.OppCtrl
Oracle:This spell costs {U} less to cast if an opponent cast two or more spells this turn.\nCounter target spell.

View File

@@ -0,0 +1,10 @@
Name:Twinferno
ManaCost:1 R
Types:Instant
A:SP$ Charm | Choices$ DelayedTrigger,DBDoubleStrike
SVar:DelayedTrigger:DB$ DelayedTrigger | AILogic$ SpellCopy | Mode$ SpellCast | ValidCard$ Instant,Sorcery | ValidActivatingPlayer$ You | ThisTurn$ True | Execute$ EffTrigCopy | SpellDescription$ When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy.
SVar:EffTrigCopy:DB$ CopySpellAbility | Defined$ TriggeredSpellAbility | MayChooseTarget$ True
SVar:DBDoubleStrike:DB$ Pump | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | KW$ Double Strike | SpellDescription$ Target creature you control gains double strike until end of turn.
SVar:BuffedBy:Instant,Sorcery
DeckHints:Type$Instant|Sorcery & Keyword$Double Strike
Oracle:Choose one — \n• When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy.\n• Target creature you control gains double strike until end of turn.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,8 @@ import urllib.request
# 'scryfall lang code':'ISO 639 lang code'
languages = {'es': 'es-ES', 'de': 'de-DE', 'it': 'it-IT',
'pt': 'pt-BR', 'zhs': 'zh-CN'}
langfiles = {'es': None, 'de': None, 'it': None, 'zhs': None}
'pt': 'pt-BR', 'zhs': 'zh-CN', 'fr': 'fr-FR'}
langfiles = {'es': None, 'de': None, 'it': None, 'zhs': None, 'fr': None}
# Request Scryfall API to download all_cards json file
request = urllib.request.urlopen('https://api.scryfall.com/bulk-data')