Merge branch 'oxplow' into 'master'

KHM - new keyword for farm animals

See merge request core-developers/forge!3694
This commit is contained in:
Michael Kamensky
2021-02-02 05:05:57 +00:00
6 changed files with 28 additions and 5 deletions

View File

@@ -1179,7 +1179,7 @@ public class AiAttackController {
CardPredicates.hasKeyword(Keyword.LIFELINK))).isEmpty();
// total power of the defending creatures, used in predicting whether a gang block can kill the attacker
int defPower = CardLists.getTotalPower(validBlockers, true);
int defPower = CardLists.getTotalPower(validBlockers, true, false);
if (!hasCombatEffect) {
for (KeywordInterface inst : attacker.getKeywords()) {

View File

@@ -401,11 +401,15 @@ public class CardLists {
*
* @param cardList the list of creature cards for which to sum the power
* @param ignoreNegativePower if true, treats negative power as 0
* @param crew for cards that crew with toughness rather than power
*/
public static int getTotalPower(Iterable<Card> cardList, boolean ignoreNegativePower) {
public static int getTotalPower(Iterable<Card> cardList, boolean ignoreNegativePower, boolean crew) {
int total = 0;
for (final Card crd : cardList) {
total += ignoreNegativePower ? Math.max(0, crd.getNetPower()) : crd.getNetPower();
if (crew && crd.hasKeyword("CARDNAME crews Vehicles using its toughness rather than its power.")) {
total += ignoreNegativePower ? Math.max(0, crd.getNetToughness()) : crd.getNetToughness();
}
else total += ignoreNegativePower ? Math.max(0, crd.getNetPower()) : crd.getNetPower();
}
return total;
}

View File

@@ -146,7 +146,7 @@ public class CostTapType extends CostPartWithList {
if (totalPower) {
final int i = Integer.parseInt(totalP);
return CardLists.getTotalPower(typeList, true) >= i;
return CardLists.getTotalPower(typeList, true, ability.hasParam("Crew")) >= i;
}
final Integer amount = this.convertAmount();

View File

@@ -0,0 +1,12 @@
Name:Colossal Plow
ManaCost:2
Types:Artifact Vehicle
PT:6/3
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigMana | TriggerDescription$ Whenever CARDNAME attacks, add {W}{W}{W} and you gain 3 life. Until end of turn, you don't lose this mana as steps and phases end.
SVar:TrigMana:DB$ Mana | Produced$ W W W | PersistentMana$ True | SubAbility$ DBGainLife
SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ 3
K:Crew:6
SVar:HasAttackEffect:TRUE
DeckHas:Ability$LifeGain
DeckHints:Color$White
Oracle:Whenever Colossal Plow attacks, add {W}{W}{W} and you gain 3 life. Until end of turn, you dont lose this mana as steps and phases end.\nCrew 6 (Tap any number of creatures you control with total power 6 or more: This Vehicle becomes an artifact creature until end of turn.)

View File

@@ -0,0 +1,7 @@
Name:Giant Ox
ManaCost:1 W
Types:Creature Ox
PT:0/6
K:CARDNAME crews Vehicles using its toughness rather than its power.
DeckHints:Type$Vehicle
Oracle:Giant Ox crews Vehicles using its toughness rather than its power.

View File

@@ -1247,7 +1247,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
inp.setCancelAllowed(true);
inp.showAndWait();
if (inp.hasCancelled() || CardLists.getTotalPower(inp.getSelected(), true) < i) {
if (inp.hasCancelled() || CardLists.getTotalPower(inp.getSelected(), true, ability.hasParam("Crew")) < i) {
return null;
}
return PaymentDecision.card(inp.getSelected());