Merge branch 'sentry-bug-fixes' into 'master'

Sentry bug fixes

See merge request core-developers/forge!948
This commit is contained in:
Michael Kamensky
2018-09-26 05:25:58 +00:00
3 changed files with 26 additions and 18 deletions

View File

@@ -1483,23 +1483,25 @@ public class AiController {
boolean hasLeyline1 = false;
SpellAbility saGemstones = null;
for(int i = 0; i < result.size(); i++) {
SpellAbility sa = result.get(i);
List<SpellAbility> toRemove = Lists.newArrayList();
for(SpellAbility sa : result) {
String srcName = sa.getHostCard().getName();
if ("Gemstone Caverns".equals(srcName)) {
if (saGemstones == null)
saGemstones = sa;
else
result.remove(i--);
toRemove.add(sa);
} else if ("Leyline of Singularity".equals(srcName)) {
if (!hasLeyline1)
hasLeyline1 = true;
else
result.remove(i--);
toRemove.add(sa);
}
}
for(SpellAbility sa : toRemove) {
result.remove(sa);
}
// Play them last
if (saGemstones != null) {

View File

@@ -798,16 +798,18 @@ public class GameAction {
public boolean visit(final Card c) {
// need to get Card from preList if able
final Card co = preList.get(c);
for (int i = 0; i < co.getStaticAbilities().size(); i++) {
final StaticAbility stAb = co.getStaticAbilities().get(i);
List<StaticAbility> toRemove = Lists.newArrayList();
for (StaticAbility stAb : co.getStaticAbilities()) {
if (stAb.getMapParams().get("Mode").equals("Continuous")) {
staticAbilities.add(stAb);
}
if (stAb.isTemporary()) {
co.removeStaticAbility(stAb);
i--;
toRemove.add(stAb);
}
}
for (StaticAbility stAb : toRemove) {
co.removeStaticAbility(stAb);
}
if (!co.getStaticCommandList().isEmpty()) {
staticList.add(co);
}
@@ -851,8 +853,8 @@ public class GameAction {
}
for (final Card c : staticList) {
for (int i = 0; i < c.getStaticCommandList().size(); i++) {
final Object[] staticCheck = c.getStaticCommandList().get(i);
List<Object[]> toRemove = Lists.newArrayList();
for (Object[] staticCheck : c.getStaticCommandList()) {
final String leftVar = (String) staticCheck[0];
final String rightVar = (String) staticCheck[1];
final Card affected = (Card) staticCheck[2];
@@ -863,11 +865,13 @@ public class GameAction {
final int operandValue = AbilityUtils.calculateAmount(c, svarOperand, null);
if (Expressions.compare(sVar, svarOperator, operandValue)) {
((GameCommand) staticCheck[3]).run();
c.getStaticCommandList().remove(i);
i--;
toRemove.add(staticCheck);
affectedCards.add(c);
}
}
for (Object[] staticCheck : c.getStaticCommandList()) {
c.getStaticCommandList().remove(staticCheck);
}
}
// Exclude cards in hidden zones from update
Iterator<Card> it = affectedCards.iterator();

View File

@@ -309,13 +309,15 @@ public class ReplacementHandler {
game.forEachCardInGame(new Visitor<Card>() {
@Override
public boolean visit(Card c) {
for (int i = 0; i < c.getReplacementEffects().size(); i++) {
ReplacementEffect rep = c.getReplacementEffects().get(i);
List<ReplacementEffect> toRemove = Lists.newArrayList();
for (ReplacementEffect rep : c.getReplacementEffects()) {
if (rep.isTemporary()) {
c.removeReplacementEffect(rep);
i--;
toRemove.add(rep);
}
}
for (ReplacementEffect rep : toRemove) {
c.removeReplacementEffect(rep);
}
return true;
}
});