mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Fix DamageDealAi math for untargeted players
This commit is contained in:
@@ -707,8 +707,7 @@ public class CountersPutAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (choice == null) { // can't find anything left
|
if (choice == null) { // can't find anything left
|
||||||
if ((!sa.isTargetNumberValid())
|
if ((!sa.isTargetNumberValid()) || (sa.getTargets().size() == 0)) {
|
||||||
|| (sa.getTargets().size() == 0)) {
|
|
||||||
sa.resetTargets();
|
sa.resetTargets();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -806,18 +806,20 @@ public class DamageDealAi extends DamageAiBase {
|
|||||||
} else if (o instanceof Player) {
|
} else if (o instanceof Player) {
|
||||||
final Player p = (Player) o;
|
final Player p = (Player) o;
|
||||||
final int restDamage = ComputerUtilCombat.predictDamageTo(p, dmg, saMe.getHostCard(), false);
|
final int restDamage = ComputerUtilCombat.predictDamageTo(p, dmg, saMe.getHostCard(), false);
|
||||||
if (!p.isOpponentOf(ai) && p.canLoseLife() && restDamage + 3 >= p.getLife() && restDamage > 0) {
|
if (restDamage > 0 && p.canLoseLife()) {
|
||||||
|
if (!p.isOpponentOf(ai) && restDamage + 3 >= p.getLife()) {
|
||||||
// from this spell will kill me
|
// from this spell will kill me
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (p.isOpponentOf(ai) && p.canLoseLife()) {
|
if (p.isOpponentOf(ai)) {
|
||||||
positive = true;
|
positive = true;
|
||||||
if (p.getLife() + 3 <= restDamage) {
|
if (p.getLife() - 3 <= restDamage) {
|
||||||
urgent = true;
|
urgent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!positive && !(saMe instanceof AbilitySub)) {
|
if (!positive && !(saMe instanceof AbilitySub)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class RepeatEachAi extends SpellAbilityAi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("OpponentHasCreatures".equals(logic)) {
|
} else if ("OpponentHasCreatures".equals(logic)) { //TODO convert this to NeedsToPlayVar
|
||||||
for (Player opp : aiPlayer.getOpponents()) {
|
for (Player opp : aiPlayer.getOpponents()) {
|
||||||
if (!opp.getCreaturesInPlay().isEmpty()){
|
if (!opp.getCreaturesInPlay().isEmpty()){
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -235,7 +235,6 @@ public class ImageCache {
|
|||||||
|
|
||||||
final BufferedImage cached = _CACHE.getIfPresent(resizedKey);
|
final BufferedImage cached = _CACHE.getIfPresent(resizedKey);
|
||||||
if (null != cached) {
|
if (null != cached) {
|
||||||
//System.out.println("found cached image: " + resizedKey);
|
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +274,6 @@ public class ImageCache {
|
|||||||
result = resampler.filter(original, null);
|
result = resampler.filter(original, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//System.out.println("caching image: " + resizedKey);
|
|
||||||
_CACHE.put(resizedKey, result);
|
_CACHE.put(resizedKey, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Name:Crackling Doom
|
Name:Crackling Doom
|
||||||
ManaCost:R W B
|
ManaCost:R W B
|
||||||
Types:Instant
|
Types:Instant
|
||||||
A:SP$ DealDamage | Cost$ R B W | Defined$ Player.Opponent | NumDmg$ 2 | AILogic$ OpponentHasCreatures | SubAbility$ DBRepeat | SpellDescription$ CARDNAME deals 2 damage to each opponent. Each opponent sacrifices a creature with the greatest power among creatures that player controls.
|
A:SP$ DealDamage | Cost$ R B W | Defined$ Player.Opponent | NumDmg$ 2 | SubAbility$ DBRepeat | SpellDescription$ CARDNAME deals 2 damage to each opponent. Each opponent sacrifices a creature with the greatest power among creatures that player controls.
|
||||||
SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ Player.Opponent | RepeatSubAbility$ DBChooseCard | SubAbility$ DBSac
|
SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ Player.Opponent | RepeatSubAbility$ DBChooseCard | SubAbility$ DBSac
|
||||||
SVar:DBChooseCard:DB$ ChooseCard | Defined$ Player.IsRemembered | Choices$ Creature.greatestPowerControlledByRemembered | ChoiceTitle$ Choose a creature you control with the greatest power | Mandatory$ True | RememberChosen$ True
|
SVar:DBChooseCard:DB$ ChooseCard | Defined$ Player.IsRemembered | Choices$ Creature.greatestPowerControlledByRemembered | ChoiceTitle$ Choose a creature you control with the greatest power | Mandatory$ True | RememberChosen$ True
|
||||||
SVar:DBSac:DB$ SacrificeAll | ValidCards$ Card.IsRemembered | SubAbility$ DBCleanup | StackDescription$ Each opponent sacrifices a creature with the greatest power among creatures they control.
|
SVar:DBSac:DB$ SacrificeAll | ValidCards$ Card.IsRemembered | SubAbility$ DBCleanup | StackDescription$ Each opponent sacrifices a creature with the greatest power among creatures they control.
|
||||||
|
|||||||
Reference in New Issue
Block a user