mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Added some more canTarget checks to AI targeting (WIP).
This commit is contained in:
@@ -2419,7 +2419,6 @@ public abstract class Player extends GameEntity {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final boolean hasProperty(final String property, final Player sourceController, final Card source) {
|
public final boolean hasProperty(final String property, final Player sourceController, final Card source) {
|
||||||
System.out.println(property + this.assignedDamage);
|
|
||||||
if (property.equals("You")) {
|
if (property.equals("You")) {
|
||||||
if (!this.equals(sourceController)) {
|
if (!this.equals(sourceController)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -848,17 +848,7 @@ public class AbilityFactoryAttach {
|
|||||||
*/
|
*/
|
||||||
public static Player attachToPlayerAIPreferences(final AbilityFactory af, final SpellAbility sa,
|
public static Player attachToPlayerAIPreferences(final AbilityFactory af, final SpellAbility sa,
|
||||||
final boolean mandatory) {
|
final boolean mandatory) {
|
||||||
final Target tgt = sa.getTarget();
|
|
||||||
Player p;
|
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"))) {
|
if ("Curse".equals(af.getMapParams().get("AILogic"))) {
|
||||||
p = AllZone.getHumanPlayer();
|
p = AllZone.getHumanPlayer();
|
||||||
@@ -866,7 +856,7 @@ public class AbilityFactoryAttach {
|
|||||||
p = AllZone.getComputerPlayer();
|
p = AllZone.getComputerPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.canBeTargetedBy(sa)) {
|
if (sa.canTarget(p)) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,7 +865,7 @@ public class AbilityFactoryAttach {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = p.getOpponent();
|
p = p.getOpponent();
|
||||||
if (p.canBeTargetedBy(sa)) {
|
if (sa.canTarget(p)) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -426,9 +426,9 @@ public final class AbilityFactoryChangeZone {
|
|||||||
pDefined.add(source.getController());
|
pDefined.add(source.getController());
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
if ((tgt != null) && tgt.canTgtPlayer()) {
|
if ((tgt != null) && tgt.canTgtPlayer()) {
|
||||||
if (af.isCurse()) {
|
if (af.isCurse() && sa.canTarget(AllZone.getHumanPlayer())) {
|
||||||
tgt.addTarget(AllZone.getHumanPlayer());
|
tgt.addTarget(AllZone.getHumanPlayer());
|
||||||
} else {
|
} else if (sa.canTarget(AllZone.getComputerPlayer())){
|
||||||
tgt.addTarget(AllZone.getComputerPlayer());
|
tgt.addTarget(AllZone.getComputerPlayer());
|
||||||
}
|
}
|
||||||
pDefined = tgt.getTargetPlayers();
|
pDefined = tgt.getTargetPlayers();
|
||||||
@@ -495,9 +495,9 @@ public final class AbilityFactoryChangeZone {
|
|||||||
// make sure this will actually do something:
|
// make sure this will actually do something:
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
if ((tgt != null) && tgt.canTgtPlayer()) {
|
if ((tgt != null) && tgt.canTgtPlayer()) {
|
||||||
if (af.isCurse()) {
|
if (af.isCurse() && sa.canTarget(AllZone.getHumanPlayer())) {
|
||||||
tgt.addTarget(AllZone.getHumanPlayer());
|
tgt.addTarget(AllZone.getHumanPlayer());
|
||||||
} else {
|
} else if (sa.canTarget(AllZone.getComputerPlayer())){
|
||||||
tgt.addTarget(AllZone.getComputerPlayer());
|
tgt.addTarget(AllZone.getComputerPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -543,15 +543,15 @@ public final class AbilityFactoryChangeZone {
|
|||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
if ((tgt != null) && tgt.canTgtPlayer()) {
|
if ((tgt != null) && tgt.canTgtPlayer()) {
|
||||||
if (af.isCurse()) {
|
if (af.isCurse()) {
|
||||||
if (AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
|
if (sa.canTarget(AllZone.getHumanPlayer())) {
|
||||||
tgt.addTarget(AllZone.getHumanPlayer());
|
tgt.addTarget(AllZone.getHumanPlayer());
|
||||||
} else if (mandatory && AllZone.getComputerPlayer().canBeTargetedBy(sa)) {
|
} else if (mandatory && sa.canTarget(AllZone.getComputerPlayer())) {
|
||||||
tgt.addTarget(AllZone.getComputerPlayer());
|
tgt.addTarget(AllZone.getComputerPlayer());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (AllZone.getComputerPlayer().canBeTargetedBy(sa)) {
|
if (sa.canTarget(AllZone.getComputerPlayer())) {
|
||||||
tgt.addTarget(AllZone.getComputerPlayer());
|
tgt.addTarget(AllZone.getComputerPlayer());
|
||||||
} else if (mandatory && AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
|
} else if (mandatory && sa.canTarget(AllZone.getHumanPlayer())) {
|
||||||
tgt.addTarget(AllZone.getHumanPlayer());
|
tgt.addTarget(AllZone.getHumanPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user