I had this idea of simplifying the way I'm doing unit spawns for scenarios. So instead of doing series of if statements to trigger the spawn, I though I'd create a Spawn() class and wrap these different checks into a set of functions. Something like this:
The function achieving the spawn would be the fifth one and the first to fourth would be different sets of checks used to trigger the last. The point of the whole exercise would of course be that these functions or checks could be used in any possible combination, depending on what needs to be done. The alternative, as I see it, would be to overload the different unit spawning functions with arguments for all these checks.
The problem is that I seem only be able to get errors like:
I realize that getMap() returns a CyMap instance, plot() returns a CyPlot instance and getPlotCity() returns a CyCity instance, but could I have my functions also produce an "instance" of sorts? Like a "this check i cleared" instance, or something. 
Is there any other way of having "modular" checks without having to type if statements for every spawn? (Not counting making functions wrapping different sets of checks.)
edit: And it would also be very useful to be able to create something like a Plot() class that would take the coordinates and then be able to stack sets of spawn functions (for cities, buildings, units, XP or whatever) on the same line (so that they all use the same CyPlot instance without having to define a variable and type a line for each function). But I'm guessing that's not gonna happen...
Code:
Spawn().trigger(iTurn1, iTurn2).interval(iInterval, iModulo).player(iCiv, bHuman).landPlot(bNoUnits, bNoCities, bWithinBorders).createUnits(iCiv, tCoords, iUnitType, iNumUnits)
The problem is that I seem only be able to get errors like:
Is there a way of chain-linking functions like this? It would almost be like using the inherit CivIV functions:"trigger" instance has no argument "player"
Code:
CyGlobalContext().getMap().plot(x, y).getPlotCity()

Is there any other way of having "modular" checks without having to type if statements for every spawn? (Not counting making functions wrapping different sets of checks.)
edit: And it would also be very useful to be able to create something like a Plot() class that would take the coordinates and then be able to stack sets of spawn functions (for cities, buildings, units, XP or whatever) on the same line (so that they all use the same CyPlot instance without having to define a variable and type a line for each function). But I'm guessing that's not gonna happen...