- Added some more canTarget checks to AI targeting (WIP).

This commit is contained in:
Sloth
2012-02-23 20:09:15 +00:00
parent 0df7791a1e
commit 02e91dd4f0
3 changed files with 10 additions and 21 deletions

View File

@@ -2419,7 +2419,6 @@ public abstract class Player extends GameEntity {
*/
@Override
public final boolean hasProperty(final String property, final Player sourceController, final Card source) {
System.out.println(property + this.assignedDamage);
if (property.equals("You")) {
if (!this.equals(sourceController)) {
return false;

View File

@@ -848,17 +848,7 @@ public class AbilityFactoryAttach {
*/
public static Player attachToPlayerAIPreferences(final AbilityFactory af, final SpellAbility sa,
final boolean mandatory) {
final Target tgt = sa.getTarget();
Player p;
if (tgt.canOnlyTgtOpponent()) {
// If can Only Target Opponent, do so.
p = AllZone.getHumanPlayer();
if (p.canBeTargetedBy(sa)) {
return p;
} else {
return null;
}
}
if ("Curse".equals(af.getMapParams().get("AILogic"))) {
p = AllZone.getHumanPlayer();
@@ -866,7 +856,7 @@ public class AbilityFactoryAttach {
p = AllZone.getComputerPlayer();
}
if (p.canBeTargetedBy(sa)) {
if (sa.canTarget(p)) {
return p;
}
@@ -875,7 +865,7 @@ public class AbilityFactoryAttach {
}
p = p.getOpponent();
if (p.canBeTargetedBy(sa)) {
if (sa.canTarget(p)) {
return p;
}

View File

@@ -426,9 +426,9 @@ public final class AbilityFactoryChangeZone {
pDefined.add(source.getController());
final Target tgt = sa.getTarget();
if ((tgt != null) && tgt.canTgtPlayer()) {
if (af.isCurse()) {
if (af.isCurse() && sa.canTarget(AllZone.getHumanPlayer())) {
tgt.addTarget(AllZone.getHumanPlayer());
} else {
} else if (sa.canTarget(AllZone.getComputerPlayer())){
tgt.addTarget(AllZone.getComputerPlayer());
}
pDefined = tgt.getTargetPlayers();
@@ -495,9 +495,9 @@ public final class AbilityFactoryChangeZone {
// make sure this will actually do something:
final Target tgt = sa.getTarget();
if ((tgt != null) && tgt.canTgtPlayer()) {
if (af.isCurse()) {
if (af.isCurse() && sa.canTarget(AllZone.getHumanPlayer())) {
tgt.addTarget(AllZone.getHumanPlayer());
} else {
} else if (sa.canTarget(AllZone.getComputerPlayer())){
tgt.addTarget(AllZone.getComputerPlayer());
}
}
@@ -543,15 +543,15 @@ public final class AbilityFactoryChangeZone {
final Target tgt = sa.getTarget();
if ((tgt != null) && tgt.canTgtPlayer()) {
if (af.isCurse()) {
if (AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
if (sa.canTarget(AllZone.getHumanPlayer())) {
tgt.addTarget(AllZone.getHumanPlayer());
} else if (mandatory && AllZone.getComputerPlayer().canBeTargetedBy(sa)) {
} else if (mandatory && sa.canTarget(AllZone.getComputerPlayer())) {
tgt.addTarget(AllZone.getComputerPlayer());
}
} else {
if (AllZone.getComputerPlayer().canBeTargetedBy(sa)) {
if (sa.canTarget(AllZone.getComputerPlayer())) {
tgt.addTarget(AllZone.getComputerPlayer());
} else if (mandatory && AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
} else if (mandatory && sa.canTarget(AllZone.getHumanPlayer())) {
tgt.addTarget(AllZone.getHumanPlayer());
}
}