Merge branch 'master' of git.cardforge.org:core-developers/forge into agetian-master

This commit is contained in:
Michael Kamensky
2021-10-05 07:02:29 +03:00
6 changed files with 22 additions and 15 deletions

View File

@@ -417,7 +417,6 @@ public class DamageDealAi extends DamageAiBase {
*/ */
private Card dealDamageChooseTgtPW(final Player ai, final SpellAbility sa, final int d, final boolean noPrevention, private Card dealDamageChooseTgtPW(final Player ai, final SpellAbility sa, final int d, final boolean noPrevention,
final Player pl, final boolean mandatory) { final Player pl, final boolean mandatory) {
final TargetRestrictions tgt = sa.getTargetRestrictions(); final TargetRestrictions tgt = sa.getTargetRestrictions();
final Player activator = sa.getActivatingPlayer(); final Player activator = sa.getActivatingPlayer();
final Card source = sa.getHostCard(); final Card source = sa.getHostCard();
@@ -526,6 +525,9 @@ public class DamageDealAi extends DamageAiBase {
PlayerCollection targetableOpps = ai.getOpponents().filter(PlayerPredicates.isTargetableBy(sa)); PlayerCollection targetableOpps = ai.getOpponents().filter(PlayerPredicates.isTargetableBy(sa));
Player enemy = targetableOpps.min(PlayerPredicates.compareByLife()); Player enemy = targetableOpps.min(PlayerPredicates.compareByLife());
if (enemy == null) {
enemy = ai.getWeakestOpponent();
}
if ("PowerDmg".equals(logic)) { if ("PowerDmg".equals(logic)) {
// check if it is better to target the player instead, the original target is already set in PumpAi.pumpTgtAI() // check if it is better to target the player instead, the original target is already set in PumpAi.pumpTgtAI()
@@ -568,9 +570,8 @@ public class DamageDealAi extends DamageAiBase {
if (shouldTgtP(ai, sa, dmg, noPrevention)) { if (shouldTgtP(ai, sa, dmg, noPrevention)) {
tcs.add(enemy); tcs.add(enemy);
return true; return true;
} else {
return false;
} }
return false;
} }
if ("Polukranos".equals(logic)) { if ("Polukranos".equals(logic)) {
int dmgTaken = 0; int dmgTaken = 0;

View File

@@ -218,14 +218,15 @@ public class FightAi extends SpellAbilityAi {
CardCollection aiCreaturesByPower = new CardCollection(aiCreatures); CardCollection aiCreaturesByPower = new CardCollection(aiCreatures);
CardLists.sortByPowerDesc(aiCreaturesByPower); CardLists.sortByPowerDesc(aiCreaturesByPower);
Card maxPower = aiCreaturesByPower.getFirst(); Card maxPower = aiCreaturesByPower.getFirst();
if (maxPower != null && maxPower != aiCreature) { if (maxPower != aiCreature) {
power += maxPower.getNetPower(); // potential bonus from adding a second target power += maxPower.getNetPower(); // potential bonus from adding a second target
} }
if (FightAi.canKill(aiCreature, humanCreature, power)) { else if ("2".equals(sa.getParam("TargetMin"))) {
sa.getTargets().add(aiCreature); continue;
if (maxPower != null) {
sa.getTargets().add(maxPower);
} }
if (canKill(aiCreature, humanCreature, power)) {
sa.getTargets().add(aiCreature);
sa.getTargets().add(maxPower);
if (!isChandrasIgnition) { if (!isChandrasIgnition) {
tgtFight.resetTargets(); tgtFight.resetTargets();
tgtFight.getTargets().add(humanCreature); tgtFight.getTargets().add(humanCreature);
@@ -234,7 +235,7 @@ public class FightAi extends SpellAbilityAi {
} }
} else { } else {
// Other cards that use AILogic PowerDmg and a single target // Other cards that use AILogic PowerDmg and a single target
if (FightAi.canKill(aiCreature, humanCreature, power)) { if (canKill(aiCreature, humanCreature, power)) {
sa.getTargets().add(aiCreature); sa.getTargets().add(aiCreature);
if (!isChandrasIgnition) { if (!isChandrasIgnition) {
tgtFight.resetTargets(); tgtFight.resetTargets();
@@ -244,7 +245,7 @@ public class FightAi extends SpellAbilityAi {
} }
} }
} else { } else {
if (FightAi.shouldFight(aiCreature, humanCreature, power, toughness)) { if (shouldFight(aiCreature, humanCreature, power, toughness)) {
if ("Time to Feed".equals(sourceName)) { // flip targets if ("Time to Feed".equals(sourceName)) { // flip targets
final Card tmp = aiCreature; final Card tmp = aiCreature;
aiCreature = humanCreature; aiCreature = humanCreature;

View File

@@ -128,6 +128,7 @@ public abstract class FDisplayObject {
public abstract void draw(Graphics g); public abstract void draw(Graphics g);
public void buildTouchListeners(float screenX, float screenY, List<FDisplayObject> listeners) { public void buildTouchListeners(float screenX, float screenY, List<FDisplayObject> listeners) {
boolean exact = !GuiBase.isAndroid() && (this instanceof FCardPanel);
if (enabled && visible && screenPos.contains(screenX, screenY)) { if (enabled && visible && screenPos.contains(screenX, screenY)) {
listeners.add(this); listeners.add(this);
} }
@@ -136,9 +137,13 @@ public abstract class FDisplayObject {
Forge.hoveredCount = listeners.size(); Forge.hoveredCount = listeners.size();
if (!Forge.getCurrentScreen().toString().contains("Match")) if (!Forge.getCurrentScreen().toString().contains("Match"))
Forge.hoveredCount = 1; Forge.hoveredCount = 1;
if (exact) {
setHovered(this.enabled && this.visible && ((FCardPanel) this).renderedCardContains(screenToLocalX(screenX), screenToLocalY(screenY)) && Forge.hoveredCount < 2);
} else {
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2); setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2);
} }
} }
}
public boolean press(float x, float y) { public boolean press(float x, float y) {
return false; return false;

View File

@@ -1,7 +1,7 @@
Name:Band Together Name:Band Together
ManaCost:2 G ManaCost:2 G
Types:Instant Types:Instant
A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select up to two target creatures you control | ImprintCards$ Targeted | AILogic$ PowerDmg | SubAbility$ DBPump | TargetMin$ 0 | TargetMax$ 2 | StackDescription$ SpellDescription | SpellDescription$ Up to two target creatures you control each deal damage equal to their power to another target creature. A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select up to two target creatures you control | ImprintCards$ ThisTargetedCard | AILogic$ PowerDmg | SubAbility$ DBPump | TargetMin$ 0 | TargetMax$ 2 | StackDescription$ SpellDescription | SpellDescription$ Up to two target creatures you control each deal damage equal to their power to another target creature.
SVar:DBPump:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature to be dealt damage | RememberObjects$ ThisTargetedCard | IsCurse$ True | SubAbility$ DBEachDamage | StackDescription$ None SVar:DBPump:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature to be dealt damage | RememberObjects$ ThisTargetedCard | IsCurse$ True | SubAbility$ DBEachDamage | StackDescription$ None
SVar:DBEachDamage:DB$ EachDamage | ValidCards$ Creature.IsImprinted | NumDmg$ X | DamageDesc$ damage equal to its power | DefinedCards$ Remembered | SubAbility$ DBCleanup | StackDescription$ None SVar:DBEachDamage:DB$ EachDamage | ValidCards$ Creature.IsImprinted | NumDmg$ X | DamageDesc$ damage equal to its power | DefinedCards$ Remembered | SubAbility$ DBCleanup | StackDescription$ None
#NumDmg isn't really used here. It is left for clarity. The AF pulls Damage straight from "X" hardcoded. #NumDmg isn't really used here. It is left for clarity. The AF pulls Damage straight from "X" hardcoded.

View File

@@ -1,7 +1,7 @@
Name:Combo Attack Name:Combo Attack
ManaCost:2 G ManaCost:2 G
Types:Sorcery Types:Sorcery
A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature.YourTeamCtrl | TgtPrompt$ Select two target creatures your team controls | ImprintCards$ Targeted | TargetMin$ 2 | TargetMax$ 2 | AILogic$ PowerDmg | SubAbility$ DBPump | StackDescription$ SpellDescription | SpellDescription$ Two target creatures your team controls each deal damage equal to their power to target creature. A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature.YourTeamCtrl | TgtPrompt$ Select two target creatures your team controls | ImprintCards$ ThisTargetedCard | TargetMin$ 2 | TargetMax$ 2 | AILogic$ PowerDmg | SubAbility$ DBPump | StackDescription$ SpellDescription | SpellDescription$ Two target creatures your team controls each deal damage equal to their power to target creature.
SVar:DBPump:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature to be dealt damage | RememberObjects$ ThisTargetedCard | IsCurse$ True | SubAbility$ DBEachDamage | StackDescription$ None SVar:DBPump:DB$ Pump | ValidTgts$ Creature | TgtPrompt$ Select target creature to be dealt damage | RememberObjects$ ThisTargetedCard | IsCurse$ True | SubAbility$ DBEachDamage | StackDescription$ None
SVar:DBEachDamage:DB$ EachDamage | ValidCards$ Creature.IsImprinted | NumDmg$ X | DefinedCards$ Remembered | SubAbility$ DBCleanup | StackDescription$ None SVar:DBEachDamage:DB$ EachDamage | ValidCards$ Creature.IsImprinted | NumDmg$ X | DefinedCards$ Remembered | SubAbility$ DBCleanup | StackDescription$ None
#NumDmg isn't really used here. It is left for clarity. The AF pulls Damage straight from "X" hardcoded. #NumDmg isn't really used here. It is left for clarity. The AF pulls Damage straight from "X" hardcoded.