mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Card: add Table for ChangedSVars (#426)
* Card: add Table for ChangedSVars
This commit is contained in:
@@ -1925,8 +1925,8 @@ public class AiController {
|
||||
return Math.min(player.getLife() -1,MyRandom.getRandom().nextInt(Math.max(player.getLife() / 3, player.getWeakestOpponent().getLife())) + 1);
|
||||
} else if ("HighestGetCounter".equals(logic)) {
|
||||
return MyRandom.getRandom().nextInt(3);
|
||||
} else if (source.hasSVar("EnergyToPay")) {
|
||||
return AbilityUtils.calculateAmount(source, source.getSVar("EnergyToPay"), sa);
|
||||
} else if (sa.hasSVar("EnergyToPay")) {
|
||||
return AbilityUtils.calculateAmount(source, sa.getSVar("EnergyToPay"), sa);
|
||||
} else if ("Vermin".equals(logic)) {
|
||||
return MyRandom.getRandom().nextInt(Math.max(player.getLife() - 5, 0));
|
||||
} else if ("SweepCreatures".equals(logic)) {
|
||||
|
||||
@@ -500,17 +500,19 @@ public class AnimateAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
// give sVars
|
||||
if (sVars.size() > 0) {
|
||||
for (final String s : sVars) {
|
||||
String actualsVar = source.getSVar(s);
|
||||
if (sa.hasParam("sVars")) {
|
||||
Map<String, String> sVarsMap = Maps.newHashMap();
|
||||
for (final String s : sa.getParam("sVars").split(",")) {
|
||||
String actualsVar = AbilityUtils.getSVar(sa, s);
|
||||
String name = s;
|
||||
if (actualsVar.startsWith("SVar:")) {
|
||||
actualsVar = actualsVar.split("SVar:")[1];
|
||||
name = actualsVar.split(":")[0];
|
||||
actualsVar = actualsVar.split(":")[1];
|
||||
}
|
||||
card.setSVar(name, actualsVar);
|
||||
sVarsMap.put(name, actualsVar);
|
||||
}
|
||||
card.addChangedSVars(sVarsMap, timestamp, 0);
|
||||
}
|
||||
ComputerUtilCard.applyStaticContPT(game, card, null);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ import forge.util.MyRandom;
|
||||
public class DamageDealAi extends DamageAiBase {
|
||||
@Override
|
||||
public boolean chkAIDrawback(SpellAbility sa, Player ai) {
|
||||
final SpellAbility root = sa.getRootAbility();
|
||||
final String damage = sa.getParam("NumDmg");
|
||||
Card source = sa.getHostCard();
|
||||
int dmg = AbilityUtils.calculateAmount(source, damage, sa);
|
||||
@@ -76,7 +77,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
if (dmg > energy || dmg < 1) {
|
||||
continue; // in case the calculation gets messed up somewhere
|
||||
}
|
||||
source.setSVar("EnergyToPay", "Number$" + dmg);
|
||||
root.setSVar("EnergyToPay", "Number$" + dmg);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,7 +731,7 @@ public class PumpAi extends PumpAiBase {
|
||||
if (minus > energy || minus < 1) {
|
||||
continue; // in case the calculation gets messed up somewhere
|
||||
}
|
||||
source.setSVar("EnergyToPay", "Number$" + minus);
|
||||
root.setSVar("EnergyToPay", "Number$" + minus);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user