Explorable Lairs and other changes I'm trying

Unique Bad Result: While you were Spelunking, someone stole your horse!


On the equipment Idea: If one were to allow multiple "types" of cargo per unit, then you could allow every unit by default to carry 1 Helmet, 1 Armor, 2 Weapons, 1 Horse (if Mounted), 1 Assistant (if Recon)...

Such a change would be far better done after/while adding a TON of items into the game however.
 
Grigori Adventurer units should totally get a bonus to results from lairs, ala the bonus recon units get from villages.
 
Great minds... I was just scribbling some notes and I'd put a % chance of destroying lair next to each result, with a roll at the end to see if it gets collapsed. I had noted that good results should destroy, because you have "found the treasure" or whatever. Perhaps extremely BAD results could do so too. (because you already have enough trouble)



My plan is to have more "top" results. So although adventurers will still score the top result category, there will only be a smallish chance of that category returning Gems. Here's the rough thoughts I had notepadded for categories.
Spoiler :
SeriouslyBadRandomStuff
You opened a portal to hell, tried to shut it, and hurt your thumb​
BigBadMonsters
Hill Giant
Spiders
Azer
Elementals
Big Barbarian spawn
... type based on terrain/type of lair?​
WierdRandomBadStuff
Suffer Damage, maybe even Die
Get driven beserk (chance to turn Barbarian each turn)
Turn Barbarian on the spot
Lost in the caverns - can't move for X turns​
RegularMonsters
Regular sized spawns
...type based on terrain?​
WierdRandomNeutralStuff
Get Mutated
Teleported, or emerge from lair a few tiles away​
SmallGoodies
Gold
Experience
Minor magic like Healing potions or gaining Enchanted Weapon ability​
WierdRandomGoodStuff

BigGoodies
Rescue a prisoner (free great person of random type)
Find a mineral resource : gems, mithril, etc
Magic Items
Huge amounts of Gold​
Is that a useful direction to take?
Another idea would just be to let Adventurers make 2 rolls and keep the highest. But then they don't get their own category I suppose...

Completely seperate thought, penalty for cavalry exploring lairs? :lol:

Oops - I'd been happily editting away at my last post and hadn't noticed that there'd been four others since then :D Have a look at what I've edited in up there if you haven't seen it already. I'd basically taken it as far as I'd considered it so far, but it looks like you have bigger plans :goodjob:

I like the "categories" idea - could even use it to make some "CivSpecific" categories.

"You encounter an imp in the lower levels of the dungeon and strike a bargain" - Sheaim, Gain Imp
"You encounter the remains of a previous party of adventurers. You carry them out of the dungeon and given them a proper burial" - Good only, AC -1

etc...

There's a fair bit of work involved in getting that going though I'd imagine - got plans for implementation already?

EDIT: Some flavourful "NoOps" (i.e. results that actually have no effect beyond the text displayed and removing the lair) might be nice too. "The ruins are infested by Rodents Of Unusual Size, but you quickly exterminate them", "Whatever was living in the ruins seems to have been scared away recently. There are signs of recent campfires, but no creatures dwell amonst the silent stones".
 
Well for implementation, would it work if the original exploration spell calls different functions based on the iRnd result, then we get a new iRnd within the function which actually produces the result?
Would be easier to organize and expand
Code:
	if iRnd >= 20 and iRnd < 30:
		iDestroyLairPercent = MarnokDungeonCategoryBadMonster(caster)
	if iRnd >= 30 and iRnd < 40:
		iDestroyLairPercent = MarnokDungeonCategoryNormalMonster(caster)
... and so on

Code:
def MarnokDungeonCategoryBadMonster
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 10
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
		return 90
	if iRnd >= 20 and iRnd < 30:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 75
... and so on... then use the destroy% variable to decide if the lair survives or not.

(I have not tested this even a little bit.)

EDIT: A more concrete example
Code:
def spellMarnokDungeoneer(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 21:
		iDestroyLair = MarnokDungeoneerBigBad(caster)
	if iRnd >= 21 and iRnd < 30:
		iDestroyLair = MarnokDungeoneerBadRandom(caster)		
	if iRnd >= 30 and iRnd < 40:
		iDestroyLair = MarnokDungeoneerMonster(caster)		
	if iRnd >= 40 and iRnd < 50:
		iDestroyLair = MarnokDungeoneerRandomStuff(caster)		
	if iRnd >= 50 and iRnd < 60
		iDestroyLair = MarnokDungeoneerCivSpecific(caster)		
	if iRnd >= 60 and iRnd < 70:
		iDestroyLair = MarnokDungeoneerAlignSpecific(caster)			
	if iRnd >= 70 and iRnd < 80:
		iDestroyLair = MarnokDungeoneerReligionSpecific(caster)			
	if iRnd >= 80 and iRnd < 90:
		iDestroyLair = MarnokDungeoneerGood(caster)			
	if iRnd >= 90:
		iDestroyLair = MarnokDungeoneerBigGood(caster)	
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")		
	if iRnd <= iDestroyLair
		pPlot.setImprovementType(-1)
		#possibly a message here to say it has gone
	if iRnd > iDestroyLair
		#ought to be a message to say the lair is still intact. Perhaps one of a number of random messages!
 
Both Rod of Winds & Jade Torc are available only through the Hero Event for exploring a dungeon, so might be appropriate to offer the Rod of Winds as well.


For the map:

I haven't tested it all yet, but as I read it:
<iMapOffset>4</iMapOffset>
<iMapRange>4</iMapRange>
<iMapProb>100</iMapProb>

Means that you will reveal a 4x4 square, centered 4 tiles in the direction that your unit is facing.

I think that it would be enjoyable to change it to:

<iMapOffset>30</iMapOffset>
<iMapRange>6</iMapRange>
<iMapProb>100</iMapProb>

Which means you get a LARGE chunk of map exposed, but it is quite a ways off, and won't directly connect to what you have already explored. Might show a new continent, the middle of the ocean... anything.
 
Quick example of what I meant for the category functions:
Code:
def MarnokCivSpecific(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	if pPlayer.getCivilizationType() = gc.getInfoTypeForString('CIVILIZATION_LUCHUIRP'):	
		# some luchuirp specific result here
		return 40
	if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_KHAZAD'):
		# a khazad result
		return 100
	# default result here in case civ was not represented or did not qualify for some reason
	return 100
 
Well for implementation, would it work if the original exploration spell calls different functions based on the iRnd result, then we get a new iRnd within the function which actually produces the result?
Would be easier to organize and expand
Code:
	if iRnd >= 20 and iRnd < 30:
		iDestroyLairPercent = MarnokDungeonCategoryBadMonster(caster)
	if iRnd >= 30 and iRnd < 40:
		iDestroyLairPercent = MarnokDungeonCategoryNormalMonster(caster)
... and so on

Code:
def MarnokDungeonCategoryBadMonster
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 10
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
		return 90
	if iRnd >= 20 and iRnd < 30:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 75
... and so on... then use the destroy% variable to decide if the lair survives or not.

(I have not tested this even a little bit.)

EDIT: A more concrete example
Code:
def spellMarnokDungeoneer(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 21:
		iDestroyLair = MarnokDungeoneerBigBad(caster)
	if iRnd >= 21 and iRnd < 30:
		iDestroyLair = MarnokDungeoneerBadRandom(caster)		
	if iRnd >= 30 and iRnd < 40:
		iDestroyLair = MarnokDungeoneerMonster(caster)		
	if iRnd >= 40 and iRnd < 50:
		iDestroyLair = MarnokDungeoneerRandomStuff(caster)		
	if iRnd >= 50 and iRnd < 60
		iDestroyLair = MarnokDungeoneerCivSpecific(caster)		
	if iRnd >= 60 and iRnd < 70:
		iDestroyLair = MarnokDungeoneerAlignSpecific(caster)			
	if iRnd >= 70 and iRnd < 80:
		iDestroyLair = MarnokDungeoneerReligionSpecific(caster)			
	if iRnd >= 80 and iRnd < 90:
		iDestroyLair = MarnokDungeoneerGood(caster)			
	if iRnd >= 90:
		iDestroyLair = MarnokDungeoneerBigGood(caster)	
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")		
	if iRnd <= iDestroyLair
		pPlot.setImprovementType(-1)
		#possibly a message here to say it has gone
	if iRnd > iDestroyLair
		#ought to be a message to say the lair is still intact. Perhaps one of a number of random messages!

Looks great - the challenge now becomes filling all those categories :D

For the "specific" categories, it probably needs a "generic" event in there too that is used if the caster doesn't meet any of the requirements for the results (or at least "the results that have been coded so far"). For instance, there might not be a Lanun specific result or a Doviello specific result, so they'd both default to something more mundane until there is an result for them.

Xienwolf said:
Both Rod of Winds & Jade Torc are available only through the Hero Event for exploring a dungeon, so might be appropriate to offer the Rod of Winds as well.

Good point, though I was hoping to have some more items in general by the time it was close to release. The way it looks now, the whole system may be overhauled by then...
 
For the "specific" categories, it probably needs a "generic" event in there too that is used if the caster doesn't meet any of the requirements for the results (or at least "the results that have been coded so far"). For instance, there might not be a Lanun specific result or a Doviello specific result, so they'd both default to something more mundane until there is an result for them.

Great minds again... see my previous post, done at the same time as your post!

Currently working on a first draft of filling the categories in. I'll probably post before testing because I can happily type at the moment but not run the game.

EDIT : CvSpelInterface.py current state. Untested, probably error-filled. Not created the associated goody entries or text keys yet.
Code:
def reqMarnokDungeoneer(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	eTeam = gc.getTeam(gc.getPlayer(gc.getBARBARIAN_PLAYER()).getTeam())
	iTeam = pPlayer.getTeam()
	if eTeam.isAtWar(iTeam) == False:
		return False
	#if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_BARBARIAN')):
	#	return False
	if pPlayer.isBarbarian():
		return False		
	return True


def spellMarnokDungeoneer(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	# Vehem's Adventurer promotion
	iAdventurer = gc.getInfoTypeForString('PROMOTION_ADVENTURER')
	if caster.isHasPromotion(iAdventurer):
		iRnd = iRnd + 20
	# ---------------------------------------------------------	
	if iRnd < 21:
		iDestroyLair = MarnokDungeoneerBadRandom(caster)
	if iRnd >= 21 and iRnd < 30:
		iDestroyLair = MarnokDungeoneerBigBad(caster)
	if iRnd >= 30 and iRnd < 40:
		iDestroyLair = MarnokDungeoneerMonster(caster)		
	if iRnd >= 40 and iRnd < 50:
		iDestroyLair = MarnokDungeoneerRandomStuff(caster)		
	if iRnd >= 50 and iRnd < 60
		iDestroyLair = MarnokDungeoneerCivSpecific(caster)		
	if iRnd >= 60 and iRnd < 70:
		iDestroyLair = MarnokDungeoneerAlignSpecific(caster)			
	if iRnd >= 70 and iRnd < 80:
		iDestroyLair = MarnokDungeoneerReligionSpecific(caster)			
	if iRnd >= 80 and iRnd < 90:
		iDestroyLair = MarnokDungeoneerGood(caster)			
	if iRnd >= 90:
		iDestroyLair = MarnokDungeoneerBigGood(caster)
	# Destroy the Lair, or not:
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")		
	if iRnd <= iDestroyLair
		pPlot.setImprovementType(-1)
		#possibly a message here to say it has gone
	if iRnd > iDestroyLair
		#ought to be a message to say the lair is still intact. Perhaps one of a number of random messages!
		
def MarnokDungeoneerBigBad(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<31:
		# Terrain Specific. Note order; first listed will occur.
		if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_HILL'):	
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
			return 100
		if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_FOREST'):	
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TREANT'), caster)
			return 100			
		# default for terrain type, generate this if no specific terrain monster is specified
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 80	
	if iRnd<61:
		#Lair-Type Specific	
		if pPlot.getImprovementType() == gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)		
			return 80
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BARROW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LICH'), caster)		
			return 80
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_PITBEAST'), caster)
			return 80
		# default for lair type, in case the lair is one not specified (if new lairs are added)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DEATHKNIGHT'), caster)
		return 80
	# list of individual entries not linked to terrain or lair type
	# (none at present)	
	#default entry
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_GARGOYLE'), caster)
	return 100
		

def MarnokDungeoneerBadRandom(caster)
	# what's the worst that could happen?
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	# Vehem's Adventurer promotion
	# even though this is a bad result table, adventurers should be able to avoid the worst of it
	iAdventurer = gc.getInfoTypeForString('PROMOTION_ADVENTURER')
	if caster.isHasPromotion(iAdventurer):
		iRnd = iRnd + 20
	# ---------------------------------------------------------	
	if iRnd<26:
		#DEATH!
		caster.kill(False,0)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MYSTERYDEATH'), caster)
		return 0
	if iRnd<31:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_POSSESSED'), caster)
		return 80
	if iRnd<36:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_VAMPIRE'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BITTEN'), caster)
		return 80
	if iRnd<41:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_WITHERED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_WITHERED'), caster)
		return 80			
	if iRnd<51:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENRAGED'), caster)
		return 80	
	if iRnd<61:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENERVATED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENERVATED'), caster)
		return 80
	if iRnd<71:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DISEASED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DISEASED'), caster)
		return 80
	if iRnd<81:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_PLAGUED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_PLAGUED'), caster)
		return 80
	if iRnd<91:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_POISONED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_POISONED'), caster)
		return 80
	#default entry
	caster.doDamageNoCaster(25, 100, gc.getInfoTypeForString('DAMAGE_DEATH'), false)
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DUNGEONCOLLAPSE'), caster)
	return 100
	

def MarnokDungeoneerMonster(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<30:
		# Terrain Specific. Note order.
		if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SNOW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FROSTLINGS'), caster)
			return 50
		#Default Terrain Monster; generate this if we don't care
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)		
		return 50
	if iRnd<60:
		#Lair-Type Specific
		if pPlot.getImprovementType() == gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)		
			return 50
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BARROW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SKELETONS'), caster)		
			return 50
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LIZARDMEN_STRONG'), caster)
			return 50
		#default for lairtype	
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
		return 50
	# general random monsters	
	if iRnd<70:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPECTRE'), caster)		
		return 50
	if iRnd<80:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 50
	#default entry
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 50
	

def MarnokDungeoneerRandomStuff(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NOTHING'), caster)
		return 0
	if iRnd<41:	
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MUTATED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MUTATED'), caster)
		return 50
	#default	
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
	return 100	

def MarnokDungeoneerCivSpecific(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())	
	#default
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
	
def MarnokDungeoneerAlignSpecific(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	#default
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
		
def MarnokDungeoneerReligionSpecific(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	# NOTE : could use religion of unit and state religion as seperate sub-categories!	
	#default entry, where state religion is not represented here or some factor means other entries not used
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
		
def MarnokDungeoneerGood(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HIGH_GOLD'), caster)
		return 90
	if iRnd<41:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MAP'), caster)
		return 80
	if iRnd<61:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
		return 80
	if iRnd<66:
		iProm = gc.getInfoTypeForString('PROMOTION_SPIRIT_GUIDE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIRIT_GUIDE'), caster)
		return 80
	if iRnd<81:
		#find a minor magic item; healing salve
		iProm = gc.getInfoTypeForString('PROMOTION_HEALING_SALVE')
		caster.setHasPromotion(iProm, True)
		# goody given only for messaging purposes? Is there a better way?
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SALVE'), caster)
		return 100
	#DEFAULT ENTRY
	#find an enchanted weapon
	iProm = gc.getInfoTypeForString('PROMOTION_ENCHANTED_BLADE')
	caster.setHasPromotion(iProm, True)
	# goody given only for messaing purposes? Is there a better way?
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENCHANTED_BLADE'), caster)
	return 100
			
def MarnokDungeoneerBigGood(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TECH'), caster)
		return 100
	if iRnd<31:
		MarnokDungeoneerMinerals(caster)
		return 100
	if iRnd<41:
		MarnokDungeoneerMana(caster)
		return 100		
	#rescue a prisoner series (free great person)
	if iRnd<43:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ARTIST') , caster)		
		return 100
	if iRnd<45:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_SCIENTIST') , caster)		
		return 100	
	if iRnd<47:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ENGINEER') , caster)		
		return 100	
	if iRnd<49:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_COMMANDER') , caster)		
		return 100	
	if iRnd<51:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_MERCHANT') , caster)		
		return 100
	if iRnd<53:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_PROPHET') , caster)		
		return 100			
	if iRnd<55:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ADVENTURER') , caster)		
		return 100	
	if iRnd<61:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_IMMORTAL'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_IMMORTAL') , caster)
		return 100		
	if iRnd<71:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TREASURE_VAULT') , caster)
		return 100
	if iRnd<81:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FAMOUS_ADVENTURE') , caster)
		caster.setHasPromotion(iCourage, True)
		caster.setHasPromotion(iValor, True)
		return 100	
	# DEFAULT ENTRY
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MAGIC_ITEM') , caster)
	iItem = receiveDungeonMagicItem(caster)
	return 100		
		
def MarnokDungeoneerMinerals(caster)
	# reveals a new mineral resource.
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<11:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_COPPER'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_COPPER') , caster)		
		return 100	
	if iRnd<21:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_IRON'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_IRON') , caster)		
		return 100	
	if iRnd<31:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GOLD'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_GOLD') , caster)		
		return 100		
	if iRnd<41:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GEMS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_GEMS') , caster)		
		return 100		
	if iRnd<51:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MITHRIL'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_GOLD') , caster)		
		return 100	
	if iRnd<61:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_REAGENTS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_REAGENTS') , caster)		
		return 100	
	#default
	pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GUNPOWDER'))
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_GUNPOWDER') , caster)		
	return 100		
	# other ideas : 
	#+hammers, like the "tin mine" event
	#+gold, perhaps a silver mine?
	# maybe even +food for an underground mushroom forest. 	
	
def MarnokDungeoneerMana(caster)
	# reveals a new Mana node. This is a pretty big deal and ought to come with some cost, I think.
	# associaed goodie event ought to spawn bad monsters - elementals of course, shadows, etc
	# and/or add an effect to represent explosive release of mystical forces
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<4:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_DEATH'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DEATHMANA') , caster)		
		return 100		
	if iRnd<7:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_FIRE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FIREMANA') , caster)		
		return 100		
	if iRnd<10:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_AIR'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_AIRMANA') , caster)		
		return 100
	if iRnd<13:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_BODY'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BODYMANA') , caster)		
		return 100	
	if iRnd<16:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_CHAOS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_CHAOSMANA') , caster)		
		return 100	
	if iRnd<19:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_EARTH'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EARTHMANA') , caster)		
		return 100	
	if iRnd<22:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_ENCHANTMENT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENCHANTMENTMANA') , caster)		
		return 100	
	if iRnd<25:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_ENTROPY'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENTROPYMANA') , caster)		
		return 100	
	if iRnd<28:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_FIRE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FIREMANA') , caster)		
		return 100	
	if iRnd<31:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_LAW'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LAWMANA') , caster)		
		return 100	
	if iRnd<34:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_LIFE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LIFEMANA') , caster)		
		return 100	
	if iRnd<37:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_METAMAGIC'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_METAMAGICMANA') , caster)		
		return 100	
	if iRnd<40:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_MIND'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MINDMANA') , caster)		
		return 100	
	if iRnd<43:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_NATURE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NATUREMANA') , caster)		
		return 100
	if iRnd<46:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SPIRIT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIRITMANA') , caster)		
		return 100
	if iRnd<49:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_WATER'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_WATERMANA') , caster)		
		return 100
	if iRnd<54:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SUN'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SUNMANA') , caster)		
		return 100
	if iRnd<57:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SHADOW'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SHADOWMANA') , caster)		
		return 100	
	#default
	# basic raw mana
	pPlot.setBonusType(-1)
	pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA'))
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BASICMANA') , caster)		
	return 100			

def receiveDungeonMagicItem(caster)
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd<20:
		iProm = gc.getInfoTypeForString('PROMOTION_HEALING_SALVE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SALVE'), caster)
		return 100
	if iRnd<40:
		iProm = gc.getInfoTypeForString('PROMOTION_HEALING_SALVE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SALVE'), caster)
		return 100
	if iRnd<60:
		iProm = gc.getInfoTypeForString('PROMOTION_ENCHANTED_BLADE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENCHANTED_BLADE'), caster)
		return 100
	if iRnd<70:
		iProm = gc.getInfoTypeForString('PROMOTION_ROD_OF_WINDS')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ROD_OF_WINDS'), caster)
		return 100
	if iRnd<75:
		iProm = gc.getInfoTypeForString('PROMOTION_INFERNAL_GRIMOIRE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_INFERNAL_GRIMOIRE'), caster)
		return 100
	if iRnd<80:
		iProm = gc.getInfoTypeForString('PROMOTION_JADE_TORC')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_JADE_TORC'), caster)
		return 100
	if iRnd<85:
		iProm = gc.getInfoTypeForString('PROMOTION_NETHER_BLADE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NETHER_BLADE'), caster)
		return 100
	if iRnd<90:
		iProm = gc.getInfoTypeForString('PROMOTION_ORTHUSS_AXE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ORTHUSS_AXE'), caster)
		return 100
	if iRnd<95:
		iProm = gc.getInfoTypeForString('PROMOTION_STAFF_OF_SOULS')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_STAFF_OF_SOULS'), caster)
		return 100
	#default
	iProm = gc.getInfoTypeForString('PROMOTION_GOLDEN_HAMMER')
	caster.setHasPromotion(iProm, True)
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_GOLDEN_HAMMER'), caster)
	return 100	
		
def reqMarnokHillGiantLairMaking(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_TOWER') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	if pPlot.getTerrainType() != gc.getInfoTypeForString('TERRAIN_HILL'):
		return False	
	if caster.getUnitType() == gc.getInfoTypeForString('UNIT_HILL_GIANT'):
		return True
	return False		
	
def spellMarnokHillGiantLairMaking(caster):
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlot.setImprovementType(gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'))
	
def reqMarnokHillGiantLairEvent(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
		return False
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd > 10:
		return False
	if pPlayer.isBarbarian():
		return True		
		
def spellMarnokHillGiantLairEvent(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 20:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
	if iRnd >= 20 and iRnd < 35:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE'), caster)
	if iRnd >= 35 and iRnd < 60:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 60 and iRnd < 80:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)
	if iRnd >= 80 and iRnd < 85:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE_STONESKIN'), caster)
	if iRnd >= 85 and iRnd < 90:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE_CHIEF'), caster)		
	if iRnd >= 90: 
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
	
def reqMarnokBarbarianAllyDungeoneer(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	if pPlayer.getGold() < 50:
		return False
	if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_BARBARIAN')):
		return True
	return False		
		
def spellMarnokBarbarianAllyDungeoneer(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	pPlayer.changeGold(-50)
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 20:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 20 and iRnd < 30:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)
	if iRnd >= 30 and iRnd < 40:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
	if iRnd >= 40 and iRnd < 45:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
	if iRnd >= 45 and iRnd < 55:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
	if iRnd >= 55 and iRnd < 65:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 65: 
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NOTHING'), caster)
 
Loaded and tested. This set of code runs smoothly, I'm not saying it works as intended but it doesn't seem to have any typo errors or anything which causes that jerky behaviour associated with badly formed Python.

CVSepllInterface.py:
Code:
def reqMarnokDungeoneer(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	eTeam = gc.getTeam(gc.getPlayer(gc.getBARBARIAN_PLAYER()).getTeam())
	iTeam = pPlayer.getTeam()
	if eTeam.isAtWar(iTeam) == False:
		return False
	# if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_BARBARIAN')):
		# return False
	if pPlayer.isBarbarian():
		return False		
	return True


def spellMarnokDungeoneer(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	#pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	# Vehem's Adventurer promotion
	#iAdventurer = gc.getInfoTypeForString('PROMOTION_ADVENTURER')
	#if caster.isHasPromotion(iAdventurer):
	#	iRnd = iRnd + 20
	# ---------------------------------------------------------	
	#iDestroyLair=100
	if iRnd < 21:
		iDestroyLair = MarnokDungeoneerBadRandom(caster)
	if iRnd >= 21 and iRnd < 30:
		iDestroyLair = MarnokDungeoneerBigBad(caster)
	if iRnd >= 30 and iRnd < 40:
		iDestroyLair = MarnokDungeoneerMonster(caster)		
	if iRnd >= 40 and iRnd < 50:
		iDestroyLair = MarnokDungeoneerRandomStuff(caster)		
	if iRnd >= 50 and iRnd < 60:
		iDestroyLair = MarnokDungeoneerCivSpecific(caster)		
	if iRnd >= 60 and iRnd < 70:
		iDestroyLair = MarnokDungeoneerAlignSpecific(caster)			
	if iRnd >= 70 and iRnd < 80:
		iDestroyLair = MarnokDungeoneerReligionSpecific(caster)			
	if iRnd >= 80 and iRnd < 90:
		iDestroyLair = MarnokDungeoneerGood(caster)			
	if iRnd >= 90:
		iDestroyLair = MarnokDungeoneerBigGood(caster)
	# Destroy the Lair, or not:
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")		
	if iRnd <= iDestroyLair:
		pPlot.setImprovementType(-1)
		#possibly a message here to say it has gone
		return TRUE
	if iRnd > iDestroyLair:
		#ought to be a message to say the lair is still intact. Perhaps one of a number of random messages!
		return FALSE
		
def MarnokDungeoneerBigBad(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 31:
		# Terrain Specific. Note order; first listed will occur.
		if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_HILL'):	
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
			return 100
		if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_FOREST'):	
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TREANT'), caster)
			return 100			
		# default for terrain type, generate this if no specific terrain monster is specified
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 80	
	if iRnd < 61:
		#Lair-Type Specific	
		if pPlot.getImprovementType() == gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)		
			return 80
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BARROW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LICH'), caster)		
			return 80
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_PITBEAST'), caster)
			return 80
		# default for lair type, in case the lair is one not specified (if new lairs are added)
		MarnokSpawnMonster(caster,gc.getInfoTypeForString('UNIT_DEATHKNIGHT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DEATHKNIGHT'), caster)
		return 80
	# list of individual entries not linked to terrain or lair type
	# (none at present)	
	#default entry
	MarnokSpawnMonster(caster,gc.getInfoTypeForString('UNIT_GARGOYLE'))
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_GARGOYLE'), caster)
	return 100
		
def MarnokDungeoneerBadRandom(caster):
	# what's the worst that could happen?
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	# Vehem's Adventurer promotion
	# even though this is a bad result table, adventurers should be able to avoid the worst of it
	#iAdventurer = gc.getInfoTypeForString('PROMOTION_ADVENTURER')
	#if caster.isHasPromotion(iAdventurer):
	#	iRnd = iRnd + 20
	# ---------------------------------------------------------	
	if iRnd < 26:
		#DEATH!
		caster.kill(True,0)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MYSTERYDEATH'), caster)
		return 0
	if iRnd < 31:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_POSSESSED'), caster)
		return 80
	if iRnd < 36:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_VAMPIRE'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BITTEN'), caster)
		return 80
	if iRnd < 41:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_WITHERED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_WITHERED'), caster)
		return 80			
	if iRnd < 51:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENRAGED'), caster)
		return 80	
	if iRnd < 61:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENERVATED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENERVATED'), caster)
		return 80
	if iRnd < 71:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DISEASED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DISEASED'), caster)
		return 80
	if iRnd < 81:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_PLAGUED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_PLAGUED'), caster)
		return 80
	if iRnd < 91:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_POISONED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_POISONED'), caster)
		return 80
	#default entry
	caster.doDamageNoCaster(25, 100, gc.getInfoTypeForString('DAMAGE_DEATH'), false)
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DUNGEONCOLLAPSE'), caster)
	return 100
	

def MarnokDungeoneerMonster(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 30:
		# Terrain Specific. Note order.
		if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SNOW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FROSTLINGS'), caster)
			return 50
		#Default Terrain Monster; generate this if we don't care
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)		
		return 50
	if iRnd < 60:
		#Lair-Type Specific
		if pPlot.getImprovementType() == gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)		
			return 50
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BARROW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SKELETONS'), caster)		
			return 50
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LIZARDMEN_STRONG'), caster)
			return 50
		#default for lairtype	
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
		return 50
	# general random monsters	
	if iRnd < 70:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPECTRE'), caster)		
		return 50
	if iRnd < 80:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 50
	#default entry
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 50
	

def MarnokDungeoneerRandomStuff(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NOTHING'), caster)
		return 0
	if iRnd < 41:	
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MUTATED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MUTATED'), caster)
		return 50
	#default	
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
	return 100	

def MarnokDungeoneerCivSpecific(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())	
	#default
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
	
def MarnokDungeoneerAlignSpecific(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	#default
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
		
def MarnokDungeoneerReligionSpecific(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	# NOTE : could use religion of unit and state religion as seperate sub-categories!	
	#default entry, where state religion is not represented here or some factor means other entries not used
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
		
def MarnokDungeoneerGood(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HIGH_GOLD'), caster)
		return 90
	if iRnd < 41:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MAP'), caster)
		return 80
	if iRnd < 61:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
		return 80
	if iRnd < 66:
		iProm = gc.getInfoTypeForString('PROMOTION_SPIRIT_GUIDE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIRIT_GUIDE'), caster)
		return 80
	if iRnd < 81:
		#find a minor magic item; healing salve
		iProm = gc.getInfoTypeForString('PROMOTION_HEALING_SALVE')
		caster.setHasPromotion(iProm, True)
		# goody given only for messaging purposes? Is there a better way?
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SALVE'), caster)
		return 100
	#DEFAULT ENTRY
	#find an enchanted weapon
	iProm = gc.getInfoTypeForString('PROMOTION_ENCHANTED_BLADE')
	caster.setHasPromotion(iProm, True)
	# goody given only for messaing purposes? Is there a better way?
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENCHANTED_BLADE'), caster)
	return 100
			
def MarnokDungeoneerBigGood(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TECH'), caster)
		return 100
	if iRnd < 31:
		MarnokDungeoneerMinerals(caster)
		return 100
	if iRnd < 41:
		MarnokDungeoneerMana(caster)
		return 100		
	#rescue a prisoner series (free great person)
	if iRnd < 43:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ARTIST') , caster)		
		return 100
	if iRnd < 45:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_SCIENTIST') , caster)		
		return 100	
	if iRnd < 47:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ENGINEER') , caster)		
		return 100	
	if iRnd < 49:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_COMMANDER') , caster)		
		return 100	
	if iRnd < 51:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_MERCHANT') , caster)		
		return 100
	if iRnd < 53:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_PROPHET') , caster)		
		return 100			
	if iRnd < 55:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ADVENTURER') , caster)		
		return 100	
	if iRnd < 61:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_IMMORTAL'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_IMMORTAL') , caster)
		return 100		
	if iRnd < 71:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TREASURE_VAULT') , caster)
		return 100
	if iRnd < 81:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FAMOUS_ADVENTURE') , caster)
		caster.setHasPromotion(iCourage, True)
		caster.setHasPromotion(iValor, True)
		return 100	
	# DEFAULT ENTRY
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MAGIC_ITEM') , caster)
	iItem = receiveDungeonMagicItem(caster)
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MAGICITEM'), caster)
	return 100		
		
def MarnokDungeoneerMinerals(caster):
	# reveals a new mineral resource.
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 11:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_COPPER'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_RESOURCE') , caster)		
		return 100	
	if iRnd < 21:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_IRON'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_RESOURCE') , caster)		
		return 100	
	if iRnd < 31:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GOLD'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_RESOURCE') , caster)		
		return 100		
	if iRnd < 41:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GEMS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_RESOURCE') , caster)		
		return 100		
	if iRnd < 51:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MITHRIL'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_RESOURCE') , caster)		
		return 100	
	if iRnd < 61:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_REAGENTS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_RESOURCE') , caster)		
		return 100	
	#default
	pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GUNPOWDER'))
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_RESOURCE') , caster)		
	return 100		
	# other ideas : 
	#+hammers, like the "tin mine" event
	#+gold, perhaps a silver mine?
	# maybe even +food for an underground mushroom forest. 	
	
def MarnokDungeoneerMana(caster):
	# reveals a new Mana node. This is a pretty big deal and ought to come with some cost, I think.
	# associaed goodie event ought to spawn bad monsters - elementals of course, shadows, etc
	# and/or add an effect to represent explosive release of mystical forces
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 4:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_DEATH'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DEATHMANA') , caster)		
		return 100		
	if iRnd < 7:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_FIRE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FIREMANA') , caster)		
		return 100		
	if iRnd < 10:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_AIR'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_AIRMANA') , caster)		
		return 100
	if iRnd < 13:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_BODY'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BODYMANA') , caster)		
		return 100	
	if iRnd < 16:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_CHAOS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_CHAOSMANA') , caster)		
		return 100	
	if iRnd < 19:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_EARTH'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EARTHMANA') , caster)		
		return 100	
	if iRnd < 22:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_ENCHANTMENT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENCHANTMENTMANA') , caster)		
		return 100	
	if iRnd < 25:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_ENTROPY'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENTROPYMANA') , caster)		
		return 100	
	if iRnd < 28:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_FIRE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FIREMANA') , caster)		
		return 100	
	if iRnd < 31:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_LAW'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LAWMANA') , caster)		
		return 100	
	if iRnd < 34:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_LIFE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LIFEMANA') , caster)		
		return 100	
	if iRnd < 37:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_METAMAGIC'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_METAMAGICMANA') , caster)		
		return 100	
	if iRnd < 40:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_MIND'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MINDMANA') , caster)		
		return 100	
	if iRnd < 43:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_NATURE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NATUREMANA') , caster)		
		return 100
	if iRnd < 46:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SPIRIT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIRITMANA') , caster)		
		return 100
	if iRnd < 49:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_WATER'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_WATERMANA') , caster)		
		return 100
	if iRnd < 54:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SUN'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SUNMANA') , caster)		
		return 100
	if iRnd < 57:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SHADOW'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SHADOWMANA') , caster)		
		return 100	
	#default
	# basic raw mana
	pPlot.setBonusType(-1)
	pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA'))
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BASICMANA') , caster)		
	return 100			

def receiveDungeonMagicItem(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 40:
		iProm = gc.getInfoTypeForString('PROMOTION_HEALING_SALVE')
		caster.setHasPromotion(iProm, True)
		return 100
	if iRnd < 60:
		iProm = gc.getInfoTypeForString('PROMOTION_ENCHANTED_BLADE')
		caster.setHasPromotion(iProm, True)
		return 100
	if iRnd < 70:
		iProm = gc.getInfoTypeForString('PROMOTION_ROD_OF_WINDS')
		caster.setHasPromotion(iProm, True)
		return 100
	if iRnd < 75:
		iProm = gc.getInfoTypeForString('PROMOTION_INFERNAL_GRIMOIRE')
		caster.setHasPromotion(iProm, True)
		return 100
	if iRnd < 80:
		iProm = gc.getInfoTypeForString('PROMOTION_JADE_TORC')
		caster.setHasPromotion(iProm, True)
		return 100
	if iRnd < 85:
		iProm = gc.getInfoTypeForString('PROMOTION_NETHER_BLADE')
		caster.setHasPromotion(iProm, True)
		return 100
	if iRnd < 90:
		iProm = gc.getInfoTypeForString('PROMOTION_ORTHUSS_AXE')
		caster.setHasPromotion(iProm, True)
		return 100
	if iRnd < 95:
		iProm = gc.getInfoTypeForString('PROMOTION_STAFF_OF_SOULS')
		caster.setHasPromotion(iProm, True)
		return 100
	#default
	iProm = gc.getInfoTypeForString('PROMOTION_GOLDEN_HAMMER')
	caster.setHasPromotion(iProm, True)
	return 100	
		
def reqMarnokHillGiantLairMaking(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_TOWER') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	if pPlot.getTerrainType() != gc.getInfoTypeForString('TERRAIN_HILL'):
		return False	
	if caster.getUnitType() == gc.getInfoTypeForString('UNIT_HILL_GIANT'):
		return True
	return False		
	
def spellMarnokHillGiantLairMaking(caster):
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlot.setImprovementType(gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'))
	
def reqMarnokHillGiantLairEvent(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
		return False
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd > 10:
		return False
	if pPlayer.isBarbarian():
		return True		
		
def spellMarnokHillGiantLairEvent(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 20:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
	if iRnd >= 20 and iRnd < 35:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE'), caster)
	if iRnd >= 35 and iRnd < 60:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 60 and iRnd < 80:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)
	if iRnd >= 80 and iRnd < 85:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE_STONESKIN'), caster)
	if iRnd >= 85 and iRnd < 90:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE_CHIEF'), caster)		
	if iRnd >= 90: 
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
	
def reqMarnokBarbarianAllyDungeoneer(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	if pPlayer.getGold()<50:
		return False
	if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_BARBARIAN')):
		return True
	return False		
		
def spellMarnokBarbarianAllyDungeoneer(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	pPlayer.changeGold(-50)
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 20:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 20 and iRnd < 30:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)
	if iRnd >= 30 and iRnd < 40:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
	if iRnd >= 40 and iRnd < 45:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
	if iRnd >= 45 and iRnd < 55:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
	if iRnd >= 55 and iRnd < 65:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 65: 
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NOTHING'), caster)
	

def MarnokSpawnMonster(caster, monster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	pNewPlot = cf.findClearPlot(-1, pPlot)
	if pNewPlot != -1:
		pOwner=gc.getPlayer(gc.getBARBARIAN_PLAYER())
		pOwner.initUnit(monster, caster.getX(), caster.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
		return 1
	return 0
 
Actually this was too big to post here, so I've zipped up my working files to :

http://www.marnok.com/Civ4/CvMarnokStuff.rar

Not completed the text entries yet.

I've just had a quick look through it and it looks excellent - it has developed really quickly from a solid initial release into an easily adaptable and robust system - good work :goodjob:

==

Just as a quick suggestion if you wanted to shrink the download size - distributing the CIV4GameText_FFH2.xml tends to bump up the download sizes a fair bit and isn't really needed. All of the text keys for your mod could be placed in a file named CIV4GameText_Marnok.xml in the Text directory and it would work fine. In fact - in the first version I added to Fall Further, they're already in a file by that name.

Not really an issue at all in these broadband days - but it just jumps out that there's a single file adding 720kb to the compressed mod size, when the other files combined only total around 22kb - the GameText can feasibly be the smallest file of the lot.

==

Not really an issue as I said - especially if you've got your own webspace - and definitely doesn't change how good the mod itself is - but I mentioned the same thing to Xienwolf the other day and he seemed to think it was useful so I'll just repeat it here.
 
This looks really very cool. If I was anything of a modder type person I'd offer to help. What I can really do is offer to keep my fingers out of it and watch quitely from the sidelines anxious to try it!
 
1. Fixed download with smaller text file - now about 24k.
2. Changed a couple of the mana-node goodies. I had intended Mind to give a tech, but had copied that down to a few others which were giving techs also, a bit too generous.

If anyone wants to test this out, just download the rar file (see above), make backups of the files in the ffh mod folder, and replace them with my copies.
Please note these are test copies, so not only may there be balance issues (and missing text, I might get time to fill those in tomorrow) but also, the game will generate about 10 times the normal number of lairs. This may be too many! I certainly like a lot of them.

Things people can look out for and let me know about:
1. Bugs, obviously.
2. Hill Giant lairs. Are they making any? I need to set up a hillgiant-rich test environment to see if that bit of the code is even doing anything.
3. General balance and suggestions for more events. I don't have any alignment/civ/religion specific things filled in yet.


Things I am thinking of for the future:
1. Perhaps subtract a random number between 0 and the AC level from first table results. So as AC rises, Dungeons become more deadly.
2. Perhaps add unit level to the result, so high level units stand a better chance of a good result. This makes a tough choice between risking an experienced unit or sending a bunch of newbies down.
3. Make sure things like Fireballs can't explore the lairs.
4. Make lair-creators. 2 or more monsters of the same type can create a new lair in appropriate tiles. Also perhaps, creatures can occupy the ancient tower, and over time slowly cause lairs to appear in the surrounding tiles!
5. Make more special monster lairs. So, you managed to unleash a lich. Nice work, genius. Now it has moved into that ancient tower and established a power base!
6. Put a lot of work in and make Sunken Treasure! A sunken ship graphic could give us lairs at sea. Of course they would need their own version of the table.
7. Your Idea Here. Already a lot of this system is inspired and informed by feedback from posters, for which I cam grateful (and claiming all the credit;)).
 
I've just finished working on some additional magic items (basically as I'm planning to keep Orthus's Axe/Staff of Souls etc as unique items with their usual owners) - make use of them as you wish :) All items use the "Healing Salve" ArtDef until someone can be persuaded to do a little modeling.

I side-stepped the issue of "57 swords" by just making sure the items are generally of differing types. Some are deliberately more useful than others (a range of item-strengths).

Spoiler Item Details :

Arranged in order of suggested rarity, common to rare.

Healing Potion -- As Healing Salve, but is only used up 50% of the time (otherwise, can be used again)
Newt's Draught -- Allows a spell caster to cast a second spell (as Spellstaff)
Heart Amulet -- Unit can heal whilst moving, +10% heal rate
Swift Boots -- +1 Movement Rate
Travellers Cloak -- -1 Terrain Cost
Ring of Perception -- +2 Visibility
Ring of Striking -- Immune to First Strikes, +1-3 First Strikes
Compelling Jewel -- +10% chance to capture enemy unit in combat
Cursed Token of Ragnarok -- Adds a combat bonus equal to 50% of Armageddon Counter (as with Stigmata), -10% heal rate for units in the same tile
Menacing Helm -- Causes Fear
Hauberk of Abjuration -- Immune to Magic


I also added {Item} to the start of all equipment promotion TXT_KEY's, so that they are all grouped together on the Promotions list at the end - using (Item) puts them at the start, {Item} at the end.

EDIT: It just occurred to me that the files I posted will probably contain tags specific to the Broader Alignment mod so it might take a little work to add them (simply deleting the extra tags). Hopefully it's still useful though.
 

Attachments

  • Magic Items.jpg
    Magic Items.jpg
    29.2 KB · Views: 104
  • MagicItems.zip
    MagicItems.zip
    143.9 KB · Views: 65
I've just finished working on some additional magic items (basically as I'm planning to keep Orthus's Axe/Staff of Souls etc as unique items with their usual owners) - make use of them as you wish :) All items use the "Healing Salve" ArtDef until someone can be persuaded to do a little modeling.

This has a coolness rating of "cool!"
I agree about those unique items, I just used them in my results because I didn't have a range of items ready to use. Now I can plunder this treasure trove the results can be much better.
 
I've had a play around with it (again, it's taking a FF form rather than FfH - Adventurer promotions etc. - so there's probably a few things in that you don't want/need) and fixed one or two "quirks".

==
MarnokSpawnMonster was finding a freeSpace to spawn a unit but then spawned the monster on the adventurer's square, which kicked the adventurer into a neighbouring space.

GOODY_MARNOK_GARGOYLE, GOODY_MARNOK_DEATH_KNIGHT and GOODY_MARNOK_SALVE weren't defined yet - which throws up my favourite Python error ever. "Unidentifiable C++ Exception". If you come across anymore of these, check the GOODY defines first (can be a pain in the rear end to work out what that message means sometimes).

I reworked a couple of the "default" results so that I could implement the Adventurer to have some unique results.

I switched GOODY_LICH to MarnokSpawnMonster and made that function return the creature it spawns, so that I could add "PROMOTION_DEATH2" to the spawned Lich (which allows it to summon spectres)

I had a quick play with the Magic Item function so that it will drop the item on the floor if the unit already has one - before hand it was just wasting the item if it was a duplicate (Healing Salves are common, but you might still want it to give to another unit)

I also threw in a message TXT_KEY for the "Lair (not) Destroyed" and a few comments - search for "Vehem" if you want to find them easily...


====
EDIT: The text that you have entered is too long (30100 characters). Please shorten it to 30000 characters long.

:goodjob:

Will put the code in the next post.
====

Xienwolf said:
Vehem! Go read the Dungeon Adventures Mod thread PL posted a ton of nice icons you can use for equipment

Aye - I remembered those as I was posting it - but was suffering from a bad case of laziness :mischief:

(*cough* Fine, fine... I'll go do some ART_DEF's :D)
 
Code:
##### MARNOK LAIRS

def reqMarnokDungeoneer(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	eTeam = gc.getTeam(gc.getPlayer(gc.getBARBARIAN_PLAYER()).getTeam())
	iTeam = pPlayer.getTeam()
	if eTeam.isAtWar(iTeam) == False:
		return False
	# if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_BARBARIAN')):
		# return False
	if pPlayer.isBarbarian():
		return False		
	return True


def spellMarnokDungeoneer(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	#pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	iDestroyLair=100

	# Vehem's Adventurer promotion
	iAdventurer = gc.getInfoTypeForString('PROMOTION_ADVENTURER')
	if caster.isHasPromotion(iAdventurer):
		iRnd += 10
	
	#iRnd = 79   ### Testing
	
	if iRnd < 21:
		iDestroyLair = MarnokDungeoneerBadRandom(caster)
	if iRnd >= 21 and iRnd < 30:
		iDestroyLair = MarnokDungeoneerBigBad(caster)
	if iRnd >= 30 and iRnd < 50:
		iDestroyLair = MarnokDungeoneerMonster(caster)		
	if iRnd >= 50 and iRnd < 60:
		iDestroyLair = MarnokDungeoneerRandomStuff(caster)		
	if iRnd >= 60 and iRnd < 65:
		iDestroyLair = MarnokDungeoneerCivSpecific(caster)		
	if iRnd >= 65 and iRnd < 70:
		iDestroyLair = MarnokDungeoneerAlignSpecific(caster)			
	if iRnd >= 70 and iRnd < 75:
		iDestroyLair = MarnokDungeoneerReligionSpecific(caster)			
	if iRnd >= 75 and iRnd < 90:
		iDestroyLair = MarnokDungeoneerGood(caster)			
	if iRnd >= 90:
		iDestroyLair = MarnokDungeoneerBigGood(caster)
	# Destroy the Lair, or not:
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")		
	if iRnd <= iDestroyLair:
		pPlot.setImprovementType(-1)
		#possibly a message here to say it has gone
		CyInterface().addMessage(caster.getOwner(),True,25,CyTranslator().getText("TXT_KEY_MESSAGE_LAIR_DESTROYED", ()),'AS2D_POSITIVE_DINK',1,'Art/Interface/Buttons/Spells/Rob Grave.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
		return True
	if iRnd > iDestroyLair:
		#ought to be a message to say the lair is still intact. Perhaps one of a number of random messages!
		CyInterface().addMessage(caster.getOwner(),True,25,CyTranslator().getText("TXT_KEY_MESSAGE_LAIR_NOT_DESTROYED", ()),'AS2D_DEAL_CANCELLED',1,'Art/Interface/Buttons/Spells/Rob Grave.dds',ColorTypes(7),pPlot.getX(),pPlot.getY(),True,True)
		return False
		
def MarnokDungeoneerBigBad(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 31:
		# Terrain Specific. Note order; first listed will occur.
		if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_HILL'):	
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
			return 100
		if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_FOREST'):	
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TREANT'), caster)
			return 100			
		# default for terrain type, generate this if no specific terrain monster is specified
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 80	
	if iRnd < 61:
		#Lair-Type Specific	
		if pPlot.getImprovementType() == gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)		
			return 80
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BARROW'):
			### Comment by Vehem: Altered this one to give him Summon Spectre (uses MarnokSpawn instead of Goody)
			unitLich = MarnokSpawnMonster(caster,gc.getInfoTypeForString('UNIT_GARGOYLE'))
			unitLich.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DEATH2'), True)
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LICH'), caster)		
			return 80
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_PITBEAST'), caster)
			return 80
		# default for lair type, in case the lair is one not specified (if new lairs are added)
		MarnokSpawnMonster(caster,gc.getInfoTypeForString('UNIT_DEATHKNIGHT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DEATHKNIGHT'), caster)
		return 80
	# list of individual entries not linked to terrain or lair type
	# (none at present)	
	#default entry
	MarnokSpawnMonster(caster,gc.getInfoTypeForString('UNIT_GARGOYLE'))
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_GARGOYLE'), caster)
	return 100
		
def MarnokDungeoneerBadRandom(caster):
	# what's the worst that could happen?
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	
	# Vehem's Adventurer promotion
	# even though this is a bad result table, adventurers should be able to avoid the worst of it
	iAdventurer = gc.getInfoTypeForString('PROMOTION_ADVENTURER')
	if caster.isHasPromotion(iAdventurer):
		iRnd = iRnd + 20
	
	if iRnd <= 26:
		#DEATH!
		caster.kill(True,0)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MYSTERYDEATH'), caster)
		return 0
	if iRnd <= 31:
		caster.doDamageNoCaster(25, 100, gc.getInfoTypeForString('DAMAGE_PHYSICAL'), false)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DUNGEONCOLLAPSE'), caster)
		return 100		
	if iRnd <= 36:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_POSSESSED'), caster)
		return 80
	if iRnd <= 41:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_VAMPIRE'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BITTEN'), caster)
		return 80
	if iRnd <= 46:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_WITHERED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_WITHERED'), caster)
		return 80			
	if iRnd <= 56:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENRAGED'), caster)
		return 80	
	if iRnd <= 66:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENERVATED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENERVATED'), caster)
		return 80
	if iRnd <= 76:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DISEASED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DISEASED'), caster)
		return 80
	if iRnd <= 86:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_PLAGUED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_PLAGUED'), caster)
		return 80
	if iRnd > 86:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_POISONED'), True)
		caster.doDamageNoCaster(25, 50, gc.getInfoTypeForString('DAMAGE_POISON'), false)		
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_POISONED'), caster)
		return 80

	return 100
	

def MarnokDungeoneerMonster(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 30:
		# Terrain Specific. Note order.
		if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SNOW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FROSTLINGS'), caster)
			return 50
		#Default Terrain Monster; generate this if we don't care
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)		
		return 50
	if iRnd < 60:
		#Lair-Type Specific
		if pPlot.getImprovementType() == gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)		
			return 50
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_BARROW'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SKELETONS'), caster)		
			return 50
		if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
			pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LIZARDMEN_STRONG'), caster)
			return 50
		#default for lairtype	
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
		return 50
	# general random monsters	
	if iRnd < 70:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPECTRE'), caster)		
		return 50
	if iRnd < 80:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
		return 50
	#default entry
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 50
	

def MarnokDungeoneerRandomStuff(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd <= 21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NOTHING'), caster)
		return 0
	if iRnd <= 41:	
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MUTATED'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MUTATED'), caster)
		return 50
	if iRnd > 41:	
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ADVENTURER'), True)	
		return 100
	return 100

def MarnokDungeoneerCivSpecific(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())	
	#default
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
	
def MarnokDungeoneerAlignSpecific(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	#default
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
		
def MarnokDungeoneerReligionSpecific(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	# NOTE : could use religion of unit and state religion as seperate sub-categories!	
	#default entry, where state religion is not represented here or some factor means other entries not used
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	return 80	
		
def MarnokDungeoneerGood(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	CyInterface().addMessage(caster.getOwner(),True,25,CyTranslator().getText("DUNGEONEER_GOOD", ()),'AS2D_POSITIVE_DINK',1,'Art/Interface/Buttons/Spells/Rob Grave.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	CyInterface().addMessage(caster.getOwner(),True,25,CyTranslator().getText("iRND GENERATED", ()),'AS2D_POSITIVE_DINK',1,'Art/Interface/Buttons/Spells/Rob Grave.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
	
	#iRnd = 35 ### Testing
	
	if iRnd <= 21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HIGH_GOLD'), caster)
		return 90
	if iRnd <= 41:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MAP'), caster)
		return 80
	if iRnd <= 61:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ADVENTURER'), True)
		return 80
	if iRnd <= 66:
		iProm = gc.getInfoTypeForString('PROMOTION_SPIRIT_GUIDE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIRIT_GUIDE'), caster)
		return 80
	if iRnd <= 81:
		#find a minor magic item; healing salve
		iProm = gc.getInfoTypeForString('PROMOTION_HEALING_SALVE')
		caster.setHasPromotion(iProm, True)
		# goody given only for messaging purposes? Is there a better way?
		### Comment by Vehem: You can just send a message if you like (see below, and the "Lair (not) Destroyed" ones I added) - nothing much wrong with the Goody Method though - and it's consistent.
		### CyInterface().addMessage(caster.getOwner(),True,25,CyTranslator().getText("TXT_KEY_MARNOK_GOODY_SALVE", ()),'AS2D_POSITIVE_DINK',1,'Art/Interface/Buttons/Equipment/HealingSalve.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SALVE'), caster)
		return 100
	if iRnd > 81:	
		iProm = gc.getInfoTypeForString('PROMOTION_ENCHANTED_BLADE')
		caster.setHasPromotion(iProm, True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENCHANTED_BLADE'), caster)
		return 100

	return 100
	
def MarnokDungeoneerBigGood(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")

	### Comment by Vehem: Made Immortal a very rare option for non-adventurers and moved it to the top of the list.
	
	if caster.isHasPromotion(gc.getInfoTypeForString('PROMOTION_ADVENTURER')):	
		iRnd += 10	
	
	if iRnd <= 21:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TREASURE_VAULT') , caster)
		return 100	
	if iRnd <= 31:
		MarnokDungeoneerMinerals(caster)
		return 100
	if iRnd <= 41:
		MarnokDungeoneerMana(caster)
		return 100		
	#rescue a prisoner series (free great person)
	if iRnd <= 43:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ARTIST') , caster)		
		return 100
	if iRnd <= 45:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_SCIENTIST') , caster)		
		return 100	
	if iRnd <= 47:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ENGINEER') , caster)		
		return 100	
	if iRnd <= 49:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_COMMANDER') , caster)		
		return 100	
	if iRnd <= 51:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_MERCHANT') , caster)		
		return 100
	if iRnd <= 53:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_PROPHET') , caster)		
		return 100			
	if iRnd <= 55:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_RELEASE_PRISONER_ADVENTURER') , caster)		
		return 100	
	if iRnd <= 61:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_TECH'), caster)
		return 100
	if iRnd <= 81:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FAMOUS_ADVENTURE') , caster)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ADVENTURER'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_COURAGE'), True)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_VALOR'), True)
		return 100	
	if iRnd <= 98:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MAGIC_ITEM') , caster)
		iItem = receiveDungeonMagicItem(caster)
		return 100
	if iRnd > 98:
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_IMMORTAL'), True)
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_IMMORTAL') , caster)
		return 100

	return 100		
		
def MarnokDungeoneerMinerals(caster):
	# reveals a new mineral resource.
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(50, "Rob Grave")

	if caster.isHasPromotion(gc.getInfoTypeForString('PROMOTION_ADVENTURER')):	
		iRnd += 10	

	### Comment by Vehem: Shuffled things around, made it so that only adventurers can find the really rare ones. Also - made this one a "Rnd(50)".
	
	if iRnd <= 20:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_COPPER'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_COPPER') , caster)		
		return 100	
	if iRnd <= 30:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_IRON'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_IRON') , caster)		
		return 100	
	if iRnd <= 40:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GOLD'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_GOLD') , caster)		
		return 100		
	if iRnd <= 50:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_GEMS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_GEMS') , caster)		
		return 100		
	if iRnd <= 55:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MITHRIL'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_MITHRIL') , caster)		
		return 100	
	if iRnd > 55:
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_REAGENTS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BONUS_REAGENTS') , caster)		
		return 100	
	#default
	# other ideas : 
	#+hammers, like the "tin mine" event
	#+gold, perhaps a silver mine?
	# maybe even +food for an underground mushroom forest. 	
	### Comment by Vehem: I looked into this one, but can't see a way to add yields to a plot using Python alone.
	
def MarnokDungeoneerMana(caster):
	# reveals a new Mana node. This is a pretty big deal and ought to come with some cost, I think.
	# associaed goodie event ought to spawn bad monsters - elementals of course, shadows, etc
	# and/or add an effect to represent explosive release of mystical forces
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 4:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_DEATH'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_DEATHMANA') , caster)		
		return 100		
	if iRnd < 7:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_FIRE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FIREMANA') , caster)		
		return 100		
	if iRnd < 10:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_AIR'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_AIRMANA') , caster)		
		return 100
	if iRnd < 13:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_BODY'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BODYMANA') , caster)		
		return 100	
	if iRnd < 16:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_CHAOS'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_CHAOSMANA') , caster)		
		return 100	
	if iRnd < 19:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_EARTH'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EARTHMANA') , caster)		
		return 100	
	if iRnd < 22:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_ENCHANTMENT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENCHANTMENTMANA') , caster)		
		return 100	
	if iRnd < 25:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_ENTROPY'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_ENTROPYMANA') , caster)		
		return 100	
	if iRnd < 28:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_FIRE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_FIREMANA') , caster)		
		return 100	
	if iRnd < 31:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_LAW'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LAWMANA') , caster)		
		return 100	
	if iRnd < 34:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_LIFE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_LIFEMANA') , caster)		
		return 100	
	if iRnd < 37:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_METAMAGIC'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_METAMAGICMANA') , caster)		
		return 100	
	if iRnd < 40:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_MIND'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_MINDMANA') , caster)		
		return 100	
	if iRnd < 43:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_NATURE'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NATUREMANA') , caster)		
		return 100
	if iRnd < 46:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SPIRIT'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIRITMANA') , caster)		
		return 100
	if iRnd < 49:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_WATER'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_WATERMANA') , caster)		
		return 100
	if iRnd < 54:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SUN'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SUNMANA') , caster)		
		return 100
	if iRnd < 57:
		pPlot.setBonusType(-1)
		pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA_SHADOW'))
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SHADOWMANA') , caster)		
		return 100	
	#default
	# basic raw mana
	pPlot.setBonusType(-1)
	pPlot.setBonusType(gc.getInfoTypeForString('BONUS_MANA'))
	pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BASICMANA') , caster)		
	return 100			

def receiveDungeonMagicItem(caster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")

	if caster.isHasPromotion(gc.getInfoTypeForString('PROMOTION_ADVENTURER')):	
		iRnd += 10


	### Comment by Vehem: Added the new items in...
			
	if iRnd <= 20:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_HEALING_SALVE')
	if iRnd > 20 and iRnd <= 30:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_HEALING_POTION')
	if iRnd > 30 and iRnd <= 35:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_NEWTS_DRAUGHT')
	if iRnd > 35 and iRnd <= 45:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_HEART_AMULET')
	if iRnd > 45 and iRnd <= 50:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_SWIFT_BOOTS')
	if iRnd > 50 and iRnd <= 60:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_TRAVELLERS_CLOAK')
	if iRnd > 60 and iRnd <= 70:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_RING_OF_PERCEPTION')
	if iRnd > 70 and iRnd <= 75:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_RING_OF_STRIKING')
	if iRnd > 75 and iRnd <= 80:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_COMPELLING_JEWEL')
	if iRnd > 80 and iRnd <= 85:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_CURSED_TOKEN_OF_RAGNAROK')
	if iRnd > 85 and iRnd <= 90:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_ROD_OF_WINDS')
	if iRnd > 90 and iRnd <= 95:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_JADE_TORC')
	if iRnd > 95 and iRnd <= 99:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_MENACING_HELM')
	if iRnd > 99 and iRnd <= 105:
		iEquipment = gc.getInfoTypeForString('EQUIPMENT_HAUBERK_OF_ABJURATION')
	if iRnd > 105:
		#Double prize!
		receiveDungeonMagicItem(caster)
		receiveDungeonMagicItem(caster)
	
	
	### Comment by Vehem: This way the item should drop on the floor if the unit already has one of them (so that he doesn't lose out of multiple common items).
		
	iPromotion = gc.getUnitInfo(iEquipment).getEquipmentPromotion()
	if caster.isHasPromotion(iPromotion) == False:
		caster.setHasPromotion(iPromotion, True)
	else:
		newUnit = pPlayer.initUnit(iEquipment, caster.getX(), caster.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
		
	return 100
	
	
		
def reqMarnokHillGiantLairMaking(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_TOWER') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	if pPlot.getTerrainType() != gc.getInfoTypeForString('TERRAIN_HILL'):
		return False	
	if caster.getUnitType() == gc.getInfoTypeForString('UNIT_HILL_GIANT'):
		return True
	return False		
	
def spellMarnokHillGiantLairMaking(caster):
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlot.setImprovementType(gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'))
	
def reqMarnokHillGiantLairEvent(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('MARNOK_HILLGIANT_STEADING'):
		return False
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd > 10:
		return False
	if pPlayer.isBarbarian():
		return True		
		
def spellMarnokHillGiantLairEvent(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 20:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
		caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ADVENTURER'), True)
	if iRnd >= 20 and iRnd < 35:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE'), caster)
	if iRnd >= 35 and iRnd < 60:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 60 and iRnd < 80:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)
	if iRnd >= 80 and iRnd < 85:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE_STONESKIN'), caster)
	if iRnd >= 85 and iRnd < 90:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_OGRE_CHIEF'), caster)		
	if iRnd >= 90: 
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
	
def reqMarnokBarbarianAllyDungeoneer(caster):
	pPlot = caster.plot()
	if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_BARROW') and pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_RUINS'):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	if pPlayer.getGold()<50:
		return False
	if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_BARBARIAN')):
		return True
	return False		
		
def spellMarnokBarbarianAllyDungeoneer(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	pPlayer.changeGold(-50)
	iRnd = CyGame().getSorenRandNum(100, "Rob Grave")
	if iRnd < 20:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 20 and iRnd < 30:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_STRONG'), caster)
	if iRnd >= 30 and iRnd < 40:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_EXPERIENCE'), caster)
	if iRnd >= 40 and iRnd < 45:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_SPIDER'), caster)
	if iRnd >= 45 and iRnd < 55:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_HILLGIANT'), caster)
	if iRnd >= 55 and iRnd < 65:
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_BARBARIANS_WEAK'), caster)
	if iRnd >= 65: 
		pPlayer.receiveGoody(pPlot, gc.getInfoTypeForString('GOODY_MARNOK_NOTHING'), caster)
	

def MarnokSpawnMonster(caster, monster):
	iPlayer = caster.getOwner()
	pPlot = caster.plot()
	pPlot.setImprovementType(-1)
	pPlayer = gc.getPlayer(caster.getOwner())
	pNewPlot = cf.findClearPlot(-1, pPlot)
	if pNewPlot != -1:
		pOwner=gc.getPlayer(gc.getBARBARIAN_PLAYER())
		unitMonster = pOwner.initUnit(monster, pNewPlot.getX(), pNewPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
		return unitMonster
	return -1
 
And some TXT_KEYs...

EDIT: Actually attached the file now - tried to upload the XML directly, forgot that it doesn't accept those, then didn't notice it wasn't there.
 

Attachments

Back
Top Bottom