mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
ComputerUtilCombat: canCrew now checks if the creatures can crew a vehicle, also use CardLists functions to clean up the code
This commit is contained in:
@@ -31,6 +31,7 @@ import forge.game.card.CardCollection;
|
|||||||
import forge.game.card.CardCollectionView;
|
import forge.game.card.CardCollectionView;
|
||||||
import forge.game.card.CardFactoryUtil;
|
import forge.game.card.CardFactoryUtil;
|
||||||
import forge.game.card.CardLists;
|
import forge.game.card.CardLists;
|
||||||
|
import forge.game.card.CardPredicates.Presets;
|
||||||
import forge.game.card.CardUtil;
|
import forge.game.card.CardUtil;
|
||||||
import forge.game.card.CounterType;
|
import forge.game.card.CounterType;
|
||||||
import forge.game.combat.Combat;
|
import forge.game.combat.Combat;
|
||||||
@@ -2404,12 +2405,12 @@ public class ComputerUtilCombat {
|
|||||||
* @return true if a vehicle can be crewed at this moment, false otherwise
|
* @return true if a vehicle can be crewed at this moment, false otherwise
|
||||||
*/
|
*/
|
||||||
public final static boolean canCrew(Player p, SpellAbility crewSa) {
|
public final static boolean canCrew(Player p, SpellAbility crewSa) {
|
||||||
int totPower = 0;
|
// get Untapped Creatures
|
||||||
for (Card c : p.getZone(ZoneType.Battlefield).getCards()) {
|
CardCollectionView typeList = CardLists.filter(p.getCreaturesInPlay(), Presets.UNTAPPED);
|
||||||
if (c.isCreature() && !c.isTapped()) {
|
// remove them which can't crew Vehicles
|
||||||
totPower += c.getCurrentPower();
|
typeList = CardLists.getNotKeyword(typeList, "CARDNAME can't crew Vehicles.");
|
||||||
}
|
// get Total Power
|
||||||
}
|
int totPower = CardLists.getTotalPower(typeList);
|
||||||
|
|
||||||
int crewReq = Integer.parseInt(TextUtil.split(crewSa.getParam("CostDesc"), ' ', 3)[1]);
|
int crewReq = Integer.parseInt(TextUtil.split(crewSa.getParam("CostDesc"), ' ', 3)[1]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user