mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
Fix. +2 tests passed.
This commit is contained in:
parent
a922310078
commit
29b7f9ab9b
6 changed files with 48 additions and 19 deletions
18
Mage.Server.Plugins/Mage.Player.AI/mage-player-ai.iml
Normal file
18
Mage.Server.Plugins/Mage.Player.AI/mage-player-ai.iml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
|
||||
<orderEntry type="module" module-name="mage" />
|
||||
<orderEntry type="module" module-name="mage-sets" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -395,6 +395,20 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
|||
else {
|
||||
targets = threats(opponentId, source.getSourceId(), ((FilterCreatureOrPlayer)t.getFilter()).getCreatureFilter(), game, target.getTargets());
|
||||
}
|
||||
|
||||
if (outcome.isGood()) {
|
||||
if (target.canTarget(playerId, source, game)) {
|
||||
target.addTarget(playerId, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (target.canTarget(opponentId, source, game)) {
|
||||
target.addTarget(opponentId, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (targets.isEmpty() && target.isRequired()) {
|
||||
targets = game.getBattlefield().getActivePermanents(((FilterCreatureOrPlayer)t.getFilter()).getCreatureFilter(), playerId, game);
|
||||
}
|
||||
|
@ -407,18 +421,7 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
|||
}
|
||||
}
|
||||
}
|
||||
if (outcome.isGood()) {
|
||||
if (target.canTarget(playerId, source, game)) {
|
||||
target.addTarget(playerId, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (target.canTarget(opponentId, source, game)) {
|
||||
target.addTarget(opponentId, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.isRequired())
|
||||
return false;
|
||||
}
|
||||
|
@ -1498,7 +1501,7 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
|||
protected List<Permanent> threats(UUID playerId, UUID sourceId, FilterPermanent filter, Game game, List<UUID> targets) {
|
||||
List<Permanent> threats = playerId == null ?
|
||||
game.getBattlefield().getAllActivePermanents(filter) :
|
||||
game.getBattlefield().getActivePermanents(filter, playerId, sourceId, game);
|
||||
game.getBattlefield().getAllActivePermanents(filter, playerId);
|
||||
|
||||
Iterator<Permanent> it = threats.iterator();
|
||||
while (it.hasNext()) { // remove permanents already targeted
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.sets.darkascension;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
|
@ -45,6 +44,8 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward
|
||||
|
@ -64,7 +65,7 @@ public class FlayerOfTheHatebound extends CardImpl<FlayerOfTheHatebound> {
|
|||
|
||||
// Whenever Flayer of the Hatebound or another creature enters the battlefield from your graveyard, that creature deals damage equal to its power to target creature or player.
|
||||
Ability ability = new FlayerTriggeredAbility();
|
||||
ability.addTarget(new TargetCreatureOrPlayer());
|
||||
ability.addTarget(new TargetCreatureOrPlayer(true));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ public class FlayerOfTheHateboundTest extends CardTestPlayerBase {
|
|||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt", 1);
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Flayer of the Hatebound");
|
||||
|
||||
setStopAt(2, Constants.PhaseStep.DRAW);
|
||||
execute();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
|
|||
System.gc();
|
||||
}
|
||||
|
||||
Game game = new TwoPlayerDuel(Constants.MultiplayerAttackOption.LEFT, Constants.RangeOfInfluence.ALL);
|
||||
Game game = new TwoPlayerDuel(Constants.MultiplayerAttackOption.LEFT, Constants.RangeOfInfluence.ONE);
|
||||
|
||||
playerA = createNewPlayer("PlayerA");
|
||||
playerA.setTestMode(true);
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
|
||||
package mage.target.common;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -42,6 +39,10 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetImpl;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -50,6 +51,11 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
|
|||
|
||||
protected FilterCreatureOrPlayer filter;
|
||||
|
||||
public TargetCreatureOrPlayer(boolean required) {
|
||||
this();
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCreatureOrPlayer() {
|
||||
this(1, 1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue