mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Merge branch 'damagedeal' into 'master'
DamageDealAi: Improve mandatory targeting with stuff like Fury, so AI less masochistic See merge request core-developers/forge!5522
This commit is contained in:
@@ -344,7 +344,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
final Player activator = sa.getActivatingPlayer();
|
||||
final Card source = sa.getHostCard();
|
||||
final Game game = source.getGame();
|
||||
List<Card> hPlay = getTargetableCards(mandatory ? pl : ai, sa, pl, tgt, activator, source, game);
|
||||
List<Card> hPlay = getTargetableCards(ai, sa, pl, tgt, activator, source, game);
|
||||
|
||||
// Filter MustTarget requirements
|
||||
StaticAbilityMustTarget.filterMustTargetCards(ai, hPlay, sa);
|
||||
@@ -381,15 +381,20 @@ public class DamageDealAi extends DamageAiBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
// try unfiltered now
|
||||
hPlay = getTargetableCards(pl, sa, pl, tgt, activator, source, game);
|
||||
List<Card> controlledByOpps = CardLists.filterControlledBy(hPlay, ai.getOpponents());
|
||||
|
||||
if (!hPlay.isEmpty()) {
|
||||
if (pl.isOpponentOf(ai) && activator.equals(ai)) {
|
||||
if (sa.getTargetRestrictions().canTgtPlaneswalker()) {
|
||||
targetCard = ComputerUtilCard.getBestPlaneswalkerAI(hPlay);
|
||||
targetCard = ComputerUtilCard.getBestPlaneswalkerAI(controlledByOpps);
|
||||
}
|
||||
if (targetCard == null) {
|
||||
targetCard = ComputerUtilCard.getBestCreatureAI(hPlay);
|
||||
targetCard = ComputerUtilCard.getBestCreatureAI(controlledByOpps);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (targetCard == null) {
|
||||
targetCard = ComputerUtilCard.getWorstCreatureAI(hPlay);
|
||||
}
|
||||
|
||||
@@ -714,7 +719,6 @@ public class DamageDealAi extends DamageAiBase {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (tgt.canTgtCreature() || tgt.canTgtPlaneswalker()) {
|
||||
final Card c = dealDamageChooseTgtC(ai, sa, dmg, noPrevention, enemy, mandatory);
|
||||
if (c != null) {
|
||||
@@ -726,7 +730,13 @@ public class DamageDealAi extends DamageAiBase {
|
||||
}
|
||||
tcs.add(c);
|
||||
if (divided) {
|
||||
final int assignedDamage = ComputerUtilCombat.getEnoughDamageToKill(c, dmg, source, false, noPrevention);
|
||||
// if only other legal targets hurt own stuff just dump all dmg into this
|
||||
final Card nextTarget = dealDamageChooseTgtC(ai, sa, dmg, noPrevention, enemy, mandatory);
|
||||
boolean dump = false;
|
||||
if (nextTarget != null && nextTarget.getController().equals(ai)) {
|
||||
dump = true;
|
||||
}
|
||||
final int assignedDamage = dump ? dmg : ComputerUtilCombat.getEnoughDamageToKill(c, dmg, source, false, noPrevention);
|
||||
if (assignedDamage <= dmg) {
|
||||
sa.addDividedAllocation(c, assignedDamage);
|
||||
} else {
|
||||
|
||||
@@ -259,8 +259,7 @@ public class CardView extends GameEntityView {
|
||||
//store alternate type for oathbreaker or signature spell for display in card text
|
||||
if (c.getPaperCard().getRules().canBeSignatureSpell()) {
|
||||
set(TrackableProperty.CommanderAltType, "Signature Spell");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
set(TrackableProperty.CommanderAltType, "Oathbreaker");
|
||||
}
|
||||
} else {
|
||||
@@ -945,8 +944,7 @@ public class CardView extends GameEntityView {
|
||||
|
||||
if (alternateState == null) {
|
||||
set(TrackableProperty.AlternateState, null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CardStateView alternateStateView = alternateState.getView();
|
||||
if (getAlternateState() != alternateStateView) {
|
||||
set(TrackableProperty.AlternateState, alternateStateView);
|
||||
|
||||
Reference in New Issue
Block a user