zeroToNine
Member
Running BatBrain 1.2 in the latest KoLmafia (r9390), I get the following error every battle:
It appears the problem is in line 873 of BatBrain:
Since a is only just being defined, the second parameter to merge appears to be passed as 0 in ASH, and the KoLmafia Java exception happens in BatBrain's merge function at line 109, when it tries to defererence sec.id.
I'm not entirely sure why the correct merge function (the one that takes advevent arguments) gets called at all, and whether the not-yet-defined "a" gets somehow semi-cast to an advevent in order to satisfy the function definition, but then this gets forgotten when KoLmafia tries to get the "id" field; however, a short-term workaround in BatBrain appears to be to change line 873 to:
The same construct appears to be necessary at line 583.
Code:
class java.lang.ClassCastException: net.sourceforge.kolmafia.textui.parsetree.Value cannot be cast to net.sourceforge.kolmafia.textui.parsetree.CompositeValue
java.lang.ClassCastException: net.sourceforge.kolmafia.textui.parsetree.Value cannot be cast to net.sourceforge.kolmafia.textui.parsetree.CompositeValue
at net.sourceforge.kolmafia.textui.parsetree.CompositeReference.getSlice(CompositeReference.java:107)
at net.sourceforge.kolmafia.textui.parsetree.CompositeReference.getValue(CompositeReference.java:178)
at net.sourceforge.kolmafia.textui.parsetree.CompositeReference.execute(CompositeReference.java:91)
at net.sourceforge.kolmafia.textui.parsetree.Operator.applyTo(Operator.java:391)
at net.sourceforge.kolmafia.textui.parsetree.Expression.execute(Expression.java:221)
at net.sourceforge.kolmafia.textui.parsetree.Expression.execute(Expression.java:150)
at net.sourceforge.kolmafia.textui.parsetree.Operator.applyTo(Operator.java:591)
at net.sourceforge.kolmafia.textui.parsetree.Expression.execute(Expression.java:221)
at net.sourceforge.kolmafia.textui.parsetree.Assignment.execute(Assignment.java:101)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:129)
at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:166)
at net.sourceforge.kolmafia.textui.parsetree.Assignment.execute(Assignment.java:101)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:129)
at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:166)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:129)
at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:166)
at net.sourceforge.kolmafia.textui.parsetree.FunctionReturn.execute(FunctionReturn.java:98)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:129)
at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:166)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.Else.execute(Else.java:63)
at net.sourceforge.kolmafia.textui.parsetree.If.execute(If.java:81)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:129)
at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:166)
at net.sourceforge.kolmafia.textui.parsetree.Assignment.execute(Assignment.java:101)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:129)
at net.sourceforge.kolmafia.textui.Interpreter.executeScope(Interpreter.java:282)
at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:213)
at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:206)
at net.sourceforge.kolmafia.request.FightRequest.nextRound(FightRequest.java:613)
at net.sourceforge.kolmafia.request.FightRequest.runOnce(FightRequest.java:1257)
at net.sourceforge.kolmafia.request.FightRequest.run(FightRequest.java:1281)
at net.sourceforge.kolmafia.request.GenericRequest.handleServerRedirect(GenericRequest.java:1682)
at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1519)
at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1231)
at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1119)
at net.sourceforge.kolmafia.request.AdventureRequest.run(AdventureRequest.java:220)
at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:73)
at net.sourceforge.kolmafia.KoLAdventure.run(KoLAdventure.java:987)
at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:103)
at net.sourceforge.kolmafia.KoLmafia.executeAdventureOnce(KoLmafia.java:1443)
at net.sourceforge.kolmafia.KoLmafia.executeRequestOnce(KoLmafia.java:1461)
at net.sourceforge.kolmafia.KoLmafia.executeRequest(KoLmafia.java:1351)
at net.sourceforge.kolmafia.KoLmafia.makeRequest(KoLmafia.java:1233)
at net.sourceforge.kolmafia.textui.command.AdventureCommand.run(AdventureCommand.java:103)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:538)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:412)
at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:202)
at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:183)
It appears the problem is in line 873 of BatBrain:
Code:
advevent a = merge(adjustment,a);
Since a is only just being defined, the second parameter to merge appears to be passed as 0 in ASH, and the KoLmafia Java exception happens in BatBrain's merge function at line 109, when it tries to defererence sec.id.
I'm not entirely sure why the correct merge function (the one that takes advevent arguments) gets called at all, and whether the not-yet-defined "a" gets somehow semi-cast to an advevent in order to satisfy the function definition, but then this gets forgotten when KoLmafia tries to get the "id" field; however, a short-term workaround in BatBrain appears to be to change line 873 to:
Code:
advevent a; a = merge(adjustment,a);
The same construct appears to be necessary at line 583.