mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
NEO: "crews Vehicles as though its power were X greater" support
This commit is contained in:
committed by
Michael Kamensky
parent
6fda10fa20
commit
b981b52f83
@@ -31,6 +31,7 @@ import forge.game.keyword.Keyword;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.spellability.TargetRestrictions;
|
import forge.game.spellability.TargetRestrictions;
|
||||||
|
import forge.game.staticability.StaticAbilityCrewValue;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
import forge.util.collect.FCollectionView;
|
import forge.util.collect.FCollectionView;
|
||||||
|
|
||||||
@@ -455,8 +456,13 @@ public class CardLists {
|
|||||||
public static int getTotalPower(Iterable<Card> cardList, boolean ignoreNegativePower, boolean crew) {
|
public static int getTotalPower(Iterable<Card> cardList, boolean ignoreNegativePower, boolean crew) {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (final Card crd : cardList) {
|
for (final Card crd : cardList) {
|
||||||
if (crew && crd.hasKeyword("CARDNAME crews Vehicles using its toughness rather than its power.")) {
|
if (crew && StaticAbilityCrewValue.hasAnyCrewValue(crd)) {
|
||||||
|
if (StaticAbilityCrewValue.crewsWithToughness(crd)) {
|
||||||
total += ignoreNegativePower ? Math.max(0, crd.getNetToughness()) : crd.getNetToughness();
|
total += ignoreNegativePower ? Math.max(0, crd.getNetToughness()) : crd.getNetToughness();
|
||||||
|
} else {
|
||||||
|
int m = StaticAbilityCrewValue.getCrewMod(crd);
|
||||||
|
total += ignoreNegativePower ? Math.max(0, crd.getNetPower() + m) : crd.getNetPower() + m;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else total += ignoreNegativePower ? Math.max(0, crd.getNetPower()) : crd.getNetPower();
|
else total += ignoreNegativePower ? Math.max(0, crd.getNetPower()) : crd.getNetPower();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package forge.game.staticability;
|
||||||
|
|
||||||
|
import forge.game.Game;
|
||||||
|
import forge.game.card.Card;
|
||||||
|
import forge.game.zone.ZoneType;
|
||||||
|
|
||||||
|
public class StaticAbilityCrewValue {
|
||||||
|
|
||||||
|
static String MODE = "CrewValue";
|
||||||
|
|
||||||
|
public static boolean hasAnyCrewValue(final Card card) {
|
||||||
|
final Game game = card.getGame();
|
||||||
|
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||||
|
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||||
|
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (hasAnyCrewValue(stAb, card)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasAnyCrewValue(final StaticAbility stAb, final Card card) {
|
||||||
|
return stAb.matchesValidParam("ValidCard", card);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean crewsWithToughness(final Card card) {
|
||||||
|
final Game game = card.getGame();
|
||||||
|
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||||
|
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||||
|
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (crewsWithToughness(stAb, card)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean crewsWithToughness(final StaticAbility stAb, final Card card) {
|
||||||
|
return stAb.getParam("Value").equals("Toughness") && stAb.matchesValidParam("ValidCard", card);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCrewMod(final Card card) {
|
||||||
|
int i = 0;
|
||||||
|
final Game game = card.getGame();
|
||||||
|
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||||
|
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||||
|
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int t = Integer.parseInt(stAb.getParam("Value"));
|
||||||
|
i = i + t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,6 @@ Name:Giant Ox
|
|||||||
ManaCost:1 W
|
ManaCost:1 W
|
||||||
Types:Creature Ox
|
Types:Creature Ox
|
||||||
PT:0/6
|
PT:0/6
|
||||||
K:CARDNAME crews Vehicles using its toughness rather than its power.
|
S:Mode$ CrewValue | Affected$ Card.Self | Value$ Toughness | Description$ CARDNAME crews Vehicles using its toughness rather than its power.
|
||||||
DeckHints:Type$Vehicle
|
DeckHints:Type$Vehicle
|
||||||
Oracle:Giant Ox crews Vehicles using its toughness rather than its power.
|
Oracle:Giant Ox crews Vehicles using its toughness rather than its power.
|
||||||
|
|||||||
12
forge-gui/res/cardsfolder/upcoming/born_to_drive.txt
Normal file
12
forge-gui/res/cardsfolder/upcoming/born_to_drive.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Name:Born to Drive
|
||||||
|
ManaCost:2 W
|
||||||
|
Types:Enchantment Aura
|
||||||
|
K:Enchant artifact or creature
|
||||||
|
A:SP$ Attach | ValidTgts$ Creature,Artifact | TgtPrompt$ Select target artifact or creature | AILogic$ Pump
|
||||||
|
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ X | AddToughness$ X | Description$ As long as enchanted permanent is a creature, it gets +1/+1 for each creature and/or Vehicle you control.
|
||||||
|
SVar:X:Count$Valid Creature.YouCtrl,Vehicle.YouCtrl
|
||||||
|
A:AB$ Token | PrecostDesc$ Channel — | Cost$ 2 W Discard<1/CARDNAME> | TokenAmount$ 2 | TokenScript$ c_1_1_pilot_crewbuff | ActivationZone$ Hand | SpellDescription$ Create two 1/1 colorless Pilot creature tokens with "This creature crews Vehicles as though its power were 2 greater."
|
||||||
|
SVar:BuffedBy:Creature,Vehicle
|
||||||
|
DeckHints:Type$Creature|Vehicle
|
||||||
|
DeckHas:Ability$Token|Discard & Type$Pilot
|
||||||
|
Oracle:Enchant artifact or creature\nAs long as enchanted permanent is a creature, it gets +1/+1 for each creature and/or Vehicle you control.\nChannel — {2}{W}, Discard Born to Drive: Create two 1/1 colorless Pilot creature tokens with "This creature crews Vehicles as though its power were 2 greater."
|
||||||
7
forge-gui/res/cardsfolder/upcoming/hotshot_mechanic.txt
Normal file
7
forge-gui/res/cardsfolder/upcoming/hotshot_mechanic.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Name:Hotshot Mechanic
|
||||||
|
ManaCost:W
|
||||||
|
Types:Artifact Creature Fox Pilot
|
||||||
|
PT:2/1
|
||||||
|
S:Mode$ CrewValue | Affected$ Card.Self | Value$ 2 | Description$ CARDNAME crews Vehicles as though its power were 2 greater.
|
||||||
|
DeckHints:Type$Vehicle
|
||||||
|
Oracle:Hotshot Mechanic crews Vehicles as though its power were 2 greater.
|
||||||
10
forge-gui/res/cardsfolder/upcoming/prodigys_prototype.txt
Normal file
10
forge-gui/res/cardsfolder/upcoming/prodigys_prototype.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Name:Prodigy's Prototype
|
||||||
|
ManaCost:1 W U
|
||||||
|
Types:Artifact Vehicle
|
||||||
|
PT:3/4
|
||||||
|
T:Mode$ AttackersDeclared | ValidAttackers$ Vehicle.YouCtrl | Execute$ TrigToken | TriggerZones$ Battlefield | TriggerDescription$ Whenever one or more Vehicles you control attack, create a 1/1 colorless Pilot creature token with "This creature crews Vehicles as though its power were 2 greater."
|
||||||
|
SVar:TrigToken:DB$ Token | TokenScript$ c_1_1_pilot_crewbuff
|
||||||
|
K:Crew:2
|
||||||
|
DeckHints:Type$Vehicle
|
||||||
|
DeckHas:Ability$Token & Type$Pilot
|
||||||
|
Oracle:Whenever one or more Vehicles you control attack, create a 1/1 colorless Pilot creature token with "This creature crews Vehicles as though its power were 2 greater."\nCrew 2 (Tap any number of creatures you control with total power 2 or more: This Vehicle becomes an artifact creature until end of turn.)
|
||||||
6
forge-gui/res/tokenscripts/c_1_1_pilot_crewbuff.txt
Normal file
6
forge-gui/res/tokenscripts/c_1_1_pilot_crewbuff.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Name:Pilot Token
|
||||||
|
ManaCost:no cost
|
||||||
|
Types:Creature Pilot
|
||||||
|
PT:1/1
|
||||||
|
S:Mode$ CrewValue | Affected$ Card.Self | Value$ 2 | Description$ This creature crews Vehicles as though its power were 2 greater.
|
||||||
|
Oracle:This creature crews Vehicles as though its power were 2 greater.
|
||||||
Reference in New Issue
Block a user