<data>
	<activables>
		<!--	-->
		<!-- generic Template -->
		<!--	-->
		<activableTemplate r_name="'mainActivableTemplate'" r_graphic="''" r_occupySquare="0" r_autoActivation="0" r_category="'standard'" r_visible="1" isDead="0" r_faction="4" isActor="0" w_isInDungeon="0" tooltip="''" r_explorable="0">
			<actionTemplate r_name="'activableActionTemplate'" r_template="'mainActionTemplate'" r_canTarget="1"/>
		</activableTemplate>

		<activableTemplate r_name="'explorableOnceInterface'" r_explorable="1">
			<event r_name="'actorsChange'" r_template="'mainEventTemplate'" r_eventTarget="'actors'" r_targetType="'evaluator'">
				<!-- exists(actors.@0) is needed when hero swap with a summon over a activable -->
				<effect r_name="'setNoExplorable'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="(actors.count>0)&&exists(actors.@0)&&exists(actors.@0.w_autoExplore)&&actors.@0.w_autoExplore" r_effect="r_explorable=0"/>
			</event>
		</activableTemplate>
		
		<activableTemplate r_name="'objectiveInterface'">
			<modifier r_name="'losMask'" r_template="'mainModifierTemplate'" r_modifierTarget="'rw_isKnown'" r_modifiedValue="$0||gameParameters.objectiveVisibility"/>
			<event r_name="'objectiveVisibilityChange'" r_template="'mainEventTemplate'" r_eventTarget="'gameParameters.objectiveVisibility'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="tileName"/>
			</event>
		</activableTemplate>

		<activableTemplate r_name="'alwaysVisibleInterface'" permanentGraphic="''">
			<!-- square graphic modification to stay visible when out of sight -->
			<modifier r_name="'additionalGraphic'" r_template="'mainModifierTemplate'" r_modifierTarget="'additionalGraphic'" r_modifiedValue="$0+(r_visible?permanentGraphic:{})"/>
		</activableTemplate>
		
		<!--	-->
		<!-- dungeon features -->
		<!--	-->
		<activable r_name="'door'" r_template="{'mainActivableTemplate','alwaysVisibleInterface'}" permanentGraphic="isOpen?{}:{doorGraphic}" doorGraphic="''" isOpen="0" r_occupySquare="!isOpen" r_explorable="!isOpen" r_category="isOpen?'none':'moveActivate'">
			<action r_name="'use'" r_template="'activableActionTemplate'"
							timeCost="actor.openCost"
							r_range="1"
							r_targetingType="'wall'">
				<effect r_name="'mainEffect'">
					<effect r_name="'switch'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="!isOpen" r_effect="isOpen=!isOpen"/>
					<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="tileName"/>
					<effect r_name="'visionUpdate'" r_template="'mainSelfEffectTemplate'" r_type="'Visibility'"/>
				</effect>
			</action>
			<modifier r_name="'losMask'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_losMask'" r_modifiedValue="isOpen?$0:$0|2"/>
			<modifier r_name="'moveMask'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_moveMask'" r_modifiedValue="isOpen?$0:$0|2"/>
		</activable>
		
		<!-- Chests -->
		<activable r_name="'lootHolderTemplate'" r_template="{'mainActivableTemplate','alwaysVisibleInterface'}" r_occupySquare="1" r_explorable="1" r_category="'moveActivate'">
			<action r_name="'use'" r_template="'activableActionTemplate'"
							timeCost="actor.openCost"
							r_range="1">
				<effect r_name="'mainEffect'">
					<effect r_name="'remove'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectDestructor'" r_loot="1"/>
				</effect>
			</action>
			<modifier r_name="'moveMask'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_moveMask'" r_modifiedValue="$0|1"/>
		</activable>
		<activable r_name="'standardChest'" r_template="{'lootHolderTemplate','objectiveInterface'}"
							 permanentGraphic="{{'coffre1.png','coffre2.png','coffre3.png','coffre4.png'}[max(lootValuesArray)-1]}"
							 randomLootCount="randomLootCount=((1==1D2)?2:(2D2))"
							 randomLootArray="randomLootArray=shuffle(createArray(randomLootCount,1)+createArray(3-randomLootCount,0))"
							 lootValuesArray="lootValuesArray=simplifyArray({(randomLootArray[0])?(gameParameters.lootPowerChest):0,(randomLootArray[1])?(gameParameters.lootPowerChest):0,(randomLootArray[2])?(gameParameters.lootPowerChest):0})"
							 tooltip="text.activableTooltipChest">
			<!-- lootValuesArray means 0: no loot, 1: not branded, 2: branded or jewel -->
			<item r_name="'weapon'" r_template="{'randomWeapon','randomWeapon','randomBrandedWeapon','randomRareWeapon','randomArtefactWeapon'}[lootValuesArray[0]]"
						r_lootable="r_lootable=(lootValuesArray[0]>0)"/>
			<item r_name="'armor'" r_template="{'randomArmor','randomArmor','randomEnchantedArmor','randomRareArmor','randomArtefactArmor'}[lootValuesArray[1]]"
						r_lootable="r_lootable=(lootValuesArray[1]>0)"/>
			<item r_name="'jewellery'" r_template="{'randomJewellery','randomJewellery','randomJewellery','randomRareJewellery','randomArtefactJewellery'}[lootValuesArray[2]]"
						r_lootable="r_lootable=(lootValuesArray[2]>1)"/>
		</activable>
		<activable r_name="'standardBookshelf'" r_template="{'lootHolderTemplate','objectiveInterface'}"
							 permanentGraphic="{'bookshelf.png'}"
							 tooltip="text.activableTooltipBookshelf">
			<item r_name="'book1'" r_template="{'randomBook','randomBook','randomBook','randomRareBook','randomArtefactBook'}[gameParameters.lootPowerChest]"/>
			<item r_name="'book2'" r_template="{'randomBook','randomBook','randomBook','randomRareBook','randomArtefactBook'}[gameParameters.lootPowerChest]"
						r_lootable="r_lootable=(1D2==1)"/>
			<item r_name="'book3'" r_template="{'randomBook','randomBook','randomBook','randomRareBook','randomArtefactBook'}[gameParameters.lootPowerChest]"
						r_lootable="r_lootable=(1D5==1)"/>
		</activable>
		<activable r_name="'standardArmorRack'" r_template="{'lootHolderTemplate','objectiveInterface'}"
							 permanentGraphic="{'armorrack.png'}"
							 randomLootCount="randomLootCount=4D2-3"
							 randomLootArray="randomLootArray=shuffle(createArray(randomLootCount,1)+createArray(6-randomLootCount,0))"
							 tooltip="text.activableTooltipArmorRack">
			<item r_name="'ArmorLoot'" r_template="(1D3==1)?(randomElement({'randomRobe','randomLightArmor','randomHeavyArmor'})):({randomElement({'randomEnchantedRobe','randomEnchantedLightArmor','randomEnchantedHeavyArmor'})}+((1D5==1)?{'randomRareArmorAdditionalTemplate'}:{}))"/>
			<item r_name="'HelmLoot'" r_template="(1D3!=1)?'randomHelm':({'randomEnchantedHelm'}+((1D5==1)?{'randomRareArmorAdditionalTemplate'}:{}))" r_lootable="r_lootable=randomLootArray[0]"/>
			<item r_name="'CloakLoot'" r_template="(1D3!=1)?'randomCloak':({'randomEnchantedCloak'}+((1D5==1)?{'randomRareArmorAdditionalTemplate'}:{}))" r_lootable="r_lootable=randomLootArray[1]"/>
			<item r_name="'BracersLoot'" r_template="(1D3!=1)?'randomBracers':({'randomEnchantedBracers'}+((1D5==1)?{'randomRareArmorAdditionalTemplate'}:{}))" r_lootable="r_lootable=randomLootArray[2]"/>
			<item r_name="'GlovesLoot'" r_template="(1D3!=1)?'randomGloves':({'randomEnchantedGloves'}+((1D5==1)?{'randomRareArmorAdditionalTemplate'}:{}))" r_lootable="r_lootable=randomLootArray[3]"/>
			<item r_name="'BeltLoot'" r_template="(1D3!=1)?'randomBelt':({'randomEnchantedBelt'}+((1D5==1)?{'randomRareArmorAdditionalTemplate'}:{}))" r_lootable="r_lootable=randomLootArray[4]"/>
			<item r_name="'BootsLoot'" r_template="(1D3!=1)?'randomBoots':({'randomEnchantedBoots'}+((1D5==1)?{'randomRareArmorAdditionalTemplate'}:{}))" r_lootable="r_lootable=randomLootArray[5]"/>
		</activable>
		<activable r_name="'standardJewelleryDisplay'" r_template="{'lootHolderTemplate','objectiveInterface'}"
							 permanentGraphic="{'jewelrydisplay.png'}"
							 tooltip="text.activableTooltipJewelleryDisplay">
			<item r_name="'jewellery1'" r_template="{'randomJewellery','randomJewellery','randomJewellery','randomRareJewellery','randomArtefactJewellery'}[gameParameters.lootPowerChest]"/>
			<item r_name="'jewellery2'" r_template="{'randomJewellery','randomJewellery','randomJewellery','randomRareJewellery','randomArtefactJewellery'}[gameParameters.lootPowerChest]"/>
			<item r_name="'jewellery3'" r_template="{'randomJewellery','randomJewellery','randomJewellery','randomRareJewellery','randomArtefactJewellery'}[gameParameters.lootPowerChest]"
						r_lootable="r_lootable=(1D2==1)"/>
			<item r_name="'jewellery4'" r_template="{'randomJewellery','randomJewellery','randomJewellery','randomRareJewellery','randomArtefactJewellery'}[gameParameters.lootPowerChest]"
						r_lootable="r_lootable=(1D2==1)"/>
		</activable>

		<!-- Loots -->
		<activableTemplate 	r_name="'lootTemplate'" r_template="{'mainActivableTemplate','explorableOnceInterface','alwaysVisibleInterface'}"
												pickupTarget="self"
												permanentGraphic="auraGraphic+simplifyArray(arraysToArray((($0!=null)&&($0.r_lootable))?$0.r_graphic:'',evaluatorArray(items)))"
												auraGraphic="{{},{'aura_vert'},{'aura_bleu'},{'aura_vio'},{'aura_gold'}}[magicLevel]"
												magicLevel="max(arraysToArray((($0!=null)&&($0.r_lootable))?$0.magicLevel:0,evaluatorArray(items)))"
												lootList="self.getLootList()"
												tooltip="text.activableTooltipLoot"
												r_category="'r_loot'">
			<action r_name="'use'" r_template="'activableActionTemplate'"
							r_range="0">
				<effect r_name="'mainEffect'">
					<effect r_name="'pickupRequest'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({gameParameters.pickupTarget=pickupTarget,gameParameters.picker=actor,r_explorable=0})"/>
				</effect>
			</action>
			<event r_name="'onItem'" r_template="'mainEventTemplate'" r_eventTarget="'items'" r_targetType="'evaluator'">
				<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="tileName"/>
				<effect r_name="'remove'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_enabled="length(items)==0" r_className="'CctlEffectDestructor'" r_loot="0"/>
			</event>
		</activableTemplate>
		<activable r_name="'r_lootFromDrop'" r_template="'lootTemplate'" r_explorable="0"/> <!-- used by SDK for DropContent slot event -->
		<activable r_name="'r_lootFromDestruction'" r_template="'lootTemplate'"/> <!-- used by SDK for CctlEffectDestructor effect -->
		<activable r_name="'specificLoot'" r_template="'lootTemplate'" specificLoot="''">
			<item r_template="specificLoot"/>
		</activable>
		<activable r_name="'standardLoot'" r_template="'lootTemplate'">
			<item r_template="{	randomElement({'randomArmor','randomWeapon'}),
												randomElement({'randomArmor','randomWeapon'}),
												randomElement({'randomEnchantedArmor','randomBrandedWeapon','randomJewellery'}+((1D3==1)?{'randomBook'}:{})),
												randomElement({'randomRareArmor','randomRareWeapon','randomRareJewellery'}+((1D3==1)?{'randomRareBook'}:{})),
												'randomArtefact'}[gameParameters.lootPowerLoot]"/>
		</activable>
		<activable r_name="'standardPotion'" r_template="'lootTemplate'">
			<item r_name="'potionLoot'" r_template="'randomPotion'"/>
		</activable>
		<activable r_name="'merchantLoot'" r_template="'lootTemplate'">
			<itemTemplate r_name="'bestWeapon1h'" r_template="(arrayToValue(($0[1]>$1[1])?($0):($1),shuffle({{'Stilleto',heroes.@0.Dagger},{'Flamberge',heroes.@0.Sword},{'Flail',heroes.@0.Mace},{'BattleAxe',heroes.@0.Axe}})))[0]"/>
			<itemTemplate r_name="'bestWeapon2h'" r_template="(arrayToValue(($0[1]>$1[1])?($0):($1),shuffle({{'Claymore',heroes.@0.Sword},{'TwoHandedFlail',heroes.@0.Mace},{'Cleaver',heroes.@0.Axe},{'Halberd',heroes.@0.Polearm},{'Quaterstaff',heroes.@0.Staff}})))[0]"/>
			<itemTemplate r_name="'bestWeaponRanged'" r_template="(arrayToValue(($0[1]>$1[1])?($0):($1),shuffle({{'CompositeLongbow',heroes.@0.Bow},{'HeavyCrossbow',heroes.@0.Crossbow},{'Franciscas',heroes.@0.Throw}})))[0]"/>

			<item r_name="'weapon1h'" r_template="{'bestWeapon1h','randomEnhancementBonusStandard'}+((lootPower>1D6)?({'randomWeaponBrand'}+((lootPower>1D10)?{'randomRareWeaponAdditionalTemplate'}:{})):{})"/>
			<item r_name="'weapon2h'" r_template="{'bestWeapon2h','randomEnhancementBonusStandard'}+((lootPower>1D6)?({'randomWeaponBrand'}+((lootPower>1D10)?{'randomRareWeaponAdditionalTemplate'}:{})):{})"/>
			<item r_name="'weaponRanged'" r_template="{'bestWeaponRanged','randomEnhancementBonusStandard'}+((lootPower>1D6)?({'randomWeaponBrand'}+((lootPower>1D10)?{'randomRareWeaponAdditionalTemplate'}:{})):{})"/>
		</activable>
		
		<!-- Altars -->
		<activableTemplate r_name="'elementalAltarTemplate'" r_template="{'mainActivableTemplate','explorableOnceInterface','objectiveInterface','alwaysVisibleInterface'}"
											 r_occupySquare="0"
											 r_explorable="!dungeonAltarActivated"
											 permanentGraphic="dungeonAltarActivated?{'altar_off.png'}:{altarGraphic}"
											 tooltip="text.activableTooltipAltar">
			<action r_name="'use'" r_template="'activableActionTemplate'" r_enabled="!dungeonAltarActivated" r_range="0">
				<effect r_name="'mainEffect'">
					<effect r_name="'benediction'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({dungeonAltarActivated=1,actor.attributeByName(affinityName+'Bonus')++})"/>
					<effect r_name="'log'" r_template="'logAltar'"/>
				</effect>
			</action>
			<event r_name="'dungeonAltarActivated'" r_template="'mainEventTemplate'" r_eventTarget="'dungeonAltarActivated'" r_targetType="'attribute'">
				<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="tileName"/>
			</event>
		</activableTemplate>
		<activable r_name="'AirAltar'" r_template="'elementalAltarTemplate'" affinityName="'Air'" altarGraphic="'altar_air.png'"/>
		<activable r_name="'DeathAltar'" r_template="'elementalAltarTemplate'" affinityName="'Death'" altarGraphic="'altar_death.png'"/>
		<activable r_name="'EarthAltar'" r_template="'elementalAltarTemplate'" affinityName="'Earth'" altarGraphic="'altar_earth.png'"/>
		<activable r_name="'FireAltar'" r_template="'elementalAltarTemplate'" affinityName="'Fire'" altarGraphic="'altar_fire.png'"/>
		<activable r_name="'HolyAltar'" r_template="'elementalAltarTemplate'" affinityName="'Holy'" altarGraphic="'altar_holy.png'"/>
		<activable r_name="'WaterAltar'" r_template="'elementalAltarTemplate'" affinityName="'Water'" altarGraphic="'altar_water.png'"/>
		
		<!-- Stairs -->
		<activable r_name="'upstairTemplate'" r_template="{'mainActivableTemplate','objectiveInterface'}" r_category="'stair'" r_displayName="'upstair'">
			<action r_name="'use'" r_template="'activableActionTemplate'" timeCost="(w_levelIndex==0)?0:100" r_range="0">
				<effect r_name="'mainEffect'">
					<effect r_name="'launchSound'" r_template="{'mainSelfEffectTemplate','controllerEffect'}"
									r_enabled="w_levelIndex>0"
									r_className="'CctlEffectSound'"
									r_soundName="'stairs.mp3'"
									r_recastTimer="0.3"/>
					<effect r_name="'stair'" r_template="{'mainActorEffectTemplate','controllerEffect'}"
									r_enabled="w_levelIndex>0"
									r_className="'CctlEffectTeleportation'"
									r_targetLevelIndex="w_levelIndex-1"
									rw_xTarget="currentDungeon.levels.(attributeByName('@'+r_targetLevelIndex)).downstairXCoord"
									rw_yTarget="currentDungeon.levels.(attributeByName('@'+r_targetLevelIndex)).downstairYCoord"
									r_walkSimulation="0"
									w_crossedSquare="0"/>
					<effect r_name="'exitUp'" r_template="{'mainSelfEffectTemplate','multiEffect'}" r_enabled="(w_levelIndex==0)&&canFleeDungeon">
						<effect r_name="'registerEffect'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectRegistred'" r_launch="0">
							<effect r_name="'fleeingHero'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="gameParameters.fleeingCount++"/>
							<effect r_name="'exitUp'" r_template="{'mainActorEffectTemplate','controllerEffect'}" r_className="'CctlEffectDestructor'" r_loot="0"/>
						</effect>
						<effect r_name="'askForFlee'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="gameParameters.fleeingDungeon=1"/>
					</effect>
					<effect r_name="'cannotExit'" r_template="'logCannotExitBattle'" r_enabled="(w_levelIndex==0)&&!canFleeDungeon"/>
				</effect>
			</action>
		</activable>
		<activable r_name="'downstairTemplate'" r_template="{'mainActivableTemplate','objectiveInterface'}" r_category="'stair'" r_displayName="'downstair'" r_explorable="exitStairExplorable">
			<action r_name="'use'" r_template="'activableActionTemplate'" timeCost="(w_levelIndex==(levels.count-1))?0:100" r_range="0">
				<effect r_name="'mainEffect'">
					<effect r_name="'launchSound'" r_template="{'mainSelfEffectTemplate','controllerEffect'}"
									r_enabled="(levels.count-1)>w_levelIndex"
									r_className="'CctlEffectSound'"
									r_soundName="'stairs.mp3'"
									r_recastTimer="0.3"/>
					<effect r_name="'stair'" r_template="{'mainActorEffectTemplate','controllerEffect'}"
									r_enabled="(levels.count-1)>w_levelIndex"
									r_className="'CctlEffectTeleportation'"
									r_targetLevelIndex="w_levelIndex+1"
									rw_xTarget="currentDungeon.levels.(attributeByName('@'+r_targetLevelIndex)).upstairXCoord"
									rw_yTarget="currentDungeon.levels.(attributeByName('@'+r_targetLevelIndex)).upstairYCoord"
									r_walkSimulation="0"
									w_crossedSquare="0"/>
					<effect r_name="'exitDown'" r_template="{'mainSelfEffectTemplate','multiEffect'}" r_enabled="w_levelIndex==(levels.count-1)">
						<!-- NPC effect -->
						<effect r_name="'exitNPC'" r_template="{'mainSelfEffectTemplate','multiEffect'}" r_enabled="actor!=heroes.@0">
							<effect r_name="'stairNPCConditionVictory'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="(victoryCondition=='saveNPC')&&exists(actor.mainNPC)&&actor.mainNPC" r_effect="world.currentDungeon.conditionVictory=1"/>
							<effect r_name="'exitDown'" r_template="{'mainActorEffectTemplate','controllerEffect'}" r_className="'CctlEffectDestructor'" r_loot="1"/>
						</effect>
						<!-- Hero effect -->
						<effect r_name="'exitHero'" r_template="{'mainSelfEffectTemplate','multiEffect'}" r_enabled="actor==heroes.@0">
							<effect r_name="'stairConditionVictory'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="victoryCondition=='stair'" r_effect="world.currentDungeon.conditionVictory=1"/>
							<effect r_name="'stairVictory'" r_template="{'mainSelfEffectTemplate','multiEffect'}" r_enabled="world.currentDungeon.conditionVictory">
								<effect r_name="'stairVictory'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({world.currentDungeon.stairVictory=1,world.currentDungeon.victory=1})"/>
								<effect r_name="'exitDown'" r_template="{'mainActorEffectTemplate','controllerEffect'}" r_className="'CctlEffectDestructor'" r_loot="0"/>
							</effect>
							<effect r_name="'noExitDown'" r_template="'logCannotExitYet'" r_enabled="!world.currentDungeon.conditionVictory"/>
						</effect>
					</effect>
				</effect>
			</action>
		</activable>
		<activable r_name="'portalTemplate'" r_template="{'mainActivableTemplate','objectiveInterface'}" r_category="'stair'" r_displayName="'portal'" r_explorable="exitStairExplorable">
			<action r_name="'use'" r_template="'activableActionTemplate'" timeCost="0" r_range="0">
				<effect r_name="'mainEffect'">
					<effect r_name="'launchSound'" r_template="{'mainSelfEffectTemplate','controllerEffect'}"
									r_enabled="(levels.count-1)>w_levelIndex"
									r_className="'CctlEffectSound'"
									r_soundName="'stairs.mp3'"
									r_recastTimer="0.3"/>
					<effect r_name="'exit'" r_template="{'mainSelfEffectTemplate','multiEffect'}">
						<effect r_name="'exitHero'" r_template="{'mainSelfEffectTemplate','multiEffect'}" r_enabled="actor==heroes.@0">
							<effect r_name="'stairVictory'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="world.currentDungeon.stairVictory=1"/>
							<effect r_name="'exitDungeon'" r_template="{'mainActorEffectTemplate','controllerEffect'}" r_className="'CctlEffectDestructor'" r_loot="0"/>
						</effect>
					</effect>
				</effect>
			</action>
		</activable>
		
		<!-- Statue -->
		<activableTemplate r_name="'statueTemplate'" r_template="{'mainActivableTemplate','objectiveInterface','alwaysVisibleInterface'}" r_occupySquare="1" r_explorable="0" r_category="'moveActivate'">
			<action r_name="'use'" r_template="'activableActionTemplate'"
							timeCost="actor.openCost"
							r_range="1"
							r_targetingType="'wall'">
				<effect r_name="'mainEffect'">
					<effect r_name="'switchAndBoost'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="!downstairVisible" r_effect="all({downstairVisible=1,attributeBoost,r_visible=0})"/>
					<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="tileName"/>
					<effect r_name="'remove'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectDestructor'" r_loot="0"/>
					<effect r_name="'visionUpdate'" r_template="'mainSelfEffectTemplate'" r_type="'Visibility'"/>
					<effect r_name="'log'" r_template="'logStatue'"/>
				</effect>
			</action>
			<modifier r_name="'moveMask'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_moveMask'" r_modifiedValue="$0|2"/>
		</activableTemplate>
		<activable r_name="'statueAir'" r_template="'statueTemplate'" permanentGraphic="{'StatueAir.png'}" attributeBoost="actor.DexterityBonus++"/>
		<activable r_name="'statueEarth'" r_template="'statueTemplate'" permanentGraphic="{'StatueEarth.png'}" attributeBoost="actor.ConstitutionBonus++"/>
		<activable r_name="'statueFire'" r_template="'statueTemplate'" permanentGraphic="{'StatueFire.png'}" attributeBoost="actor.StrengthBonus++"/>
		<activable r_name="'statueWater'" r_template="'statueTemplate'" permanentGraphic="{'StatueWater.png'}" attributeBoost="actor.IntelligenceBonus++"/>

		<!-- DemonInvocator -->
		<activableTemplate r_name="'DemonInvocator'" r_template="{'mainActivableTemplate','alwaysVisibleInterface'}" permanentGraphic="{'StatueFire.png'}" r_visible="gameParameters.princessAlive" r_occupySquare="gameParameters.princessAlive" r_explorable="0" r_category="'none'">
			<event r_name="'onChildDieTemplate'" r_template="'mainEventTemplate'" r_eventTarget="'gameParameters.princessAlive'" r_targetType="'attribute'">
				<effect r_name="'everyoneDead'" r_template="{'mainSelfEffectTemplate','multiEffect'}" r_enabled="!gameParameters.princessAlive&&(0==gameParameters.childrenAlive)">
					<effect r_name="'noExploration'" r_template="'manualLogTemplate'" text="text.earlyDemonSummoning"/>
					<effect r_name="'summonDemon'" r_template="{'mainSelfEffectTemplate','controllerEffect'}"
									r_className="'CctlEffectCreation'"
									rw_xTarget="w_xCoord"
									rw_yTarget="w_yCoord"
									r_creationType="'monster'"
									r_creationName="'DemonGod'"
									r_params="{}"/>
				</effect>
			</event>
			<event r_name="'onPrincessDie'" r_template="'onChildDieTemplate'" r_eventTarget="'gameParameters.princessAlive'"/>
			<event r_name="'onKidDie'" r_template="'onChildDieTemplate'" r_eventTarget="'gameParameters.childrenAlive'"/>
			<modifier r_name="'moveMask'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_moveMask'" r_modifiedValue="gameParameters.princessAlive?$0|2:$0"/>
		</activableTemplate>
		
		<!--	-->
		<!-- Traps -->
		<!--	-->
		<activableTemplate r_name="'trapTemplate'" r_template="{'mainActivableTemplate','alwaysVisibleInterface'}"
											 trapName="r_name"
											 r_displayName="text.activableTrap"
											 permanentGraphic="{'floorTrap.png'}"
											 r_autoActivation="1"
											 r_category="'trap'"
											 r_visible="0"
											 charge="5"
											 isAnimated="0"
											 Strength="0"
											 Dexterity="0"
											 trapHitBonus="10"
											 trapDamageBonus="10"
											 tooltip="text.activableTooltipTrap">
			<action r_name="'use'" r_template="'activableActionTemplate'" timeCost="0">
				<effect r_name="'mainEffect'">
					<effect r_name="'strike'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectLaunchAction'" r_newActor="'target'" r_newTarget="'actor'" r_newActionType="'item'" r_newActionName="0" r_delayRequest="0" r_params="{{'isFree',1}}"/>
					<effect r_name="'visible'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({charge--,r_visible=(charge>0)})"/>
					<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="tileName"/>
					<effect r_name="'remove'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_enabled="charge==0" r_className="'CctlEffectDestructor'" r_loot="0"/>
				</effect>
			</action>
			<item r_name="'arrow'" r_template="'mainRangedWeaponTemplate'"
						w_equipped="1"
						r_lootable="0"
						weaponMinRange="0"
						r_displayName="text.trapArrow"
						weaponHitBonus="trapHitBonus"
						weaponDamage="trapDamageBonus"
						customRangedPiercingBonus="10"
						itemTags="{'piercing'}"
						itemName="'Arrow'">
				<action r_name="'attackAction'" timeCost="0" canTargetFaction="1" r_range="0"/>
			</item>
		</activableTemplate>
		<activable r_name="'monsterTrap'" r_template="'trapTemplate'"
							 r_visible="gameParameters.trapVisibility"
							 trapHitBonus="10+3*dungeonDepth"
							 trapDamageBonus="10+3*dungeonDepth">
			<modifier r_name="'movePlannerCost'" r_template="'mainModifierTemplate'" r_modifierTarget="'movePlannerCost'" r_modifiedValue="$0*(((actor==heroes.@0)&&!r_visible)?1:actor.knownTrapMoveCost)"/>
			<event r_name="'onHeroSeeTraps'" r_template="'mainEventTemplate'" r_eventTarget="'gameParameters.trapVisibility'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="tileName"/>
			</event>
		</activable>
		<activable r_name="'heroTrap'" r_template="'trapTemplate'"
							 r_visible="1"
							 trapHitBonus="10+4*creator.packages.Assassin.classLevel"
							 trapDamageBonus="10+4*creator.packages.Assassin.classLevel">
			<modifier r_name="'movePlannerCost'" r_template="'mainModifierTemplate'" r_modifierTarget="'movePlannerCost'" r_modifiedValue="$0*((actor!=heroes.@0)?1:actor.knownTrapMoveCost)"/>
		</activable>

		<!--	-->
		<!-- Clouds -->
		<!--	-->
		<!-- zoneEffectInterfaces -->
		<activableTemplate	r_name="'zoneEffectInterface'"
												r_category="'zoneEffect'">
			<event r_name="'onEnterInDungeon'" r_template="'mainEventTemplate'" r_eventTarget="'w_isInDungeon'" r_targetType="'attribute'"/>
		</activableTemplate>
		<activableTemplate r_name="'zoneEffectTimedInterface'" r_template="'zoneEffectInterface'">
			<event r_name="'onEnterInDungeon'">
				<effect r_name="'destruction'" r_template="{'mainSelfEffectTemplate','mainDurableEffectTemplate'}"
								r_enabled="w_isInDungeon"
								r_className="'CctlEffectCreateDurable'"
								r_tickDuration="zoneEffectDuration">
					<effect r_name="'endEffect'">
						<effect r_name="'remove'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_enabled="(r_enabled=0)||1" r_className="'CctlEffectDestructor'" r_loot="0"/>
					</effect>
				</effect>
			</event>
		</activableTemplate>
		<activableTemplate r_name="'zoneEffectWithAttackInterface'" r_template="'zoneEffectTimedInterface'" r_autoActivation="1" attackName="'ToBeReplaced'" isDangerous="1">
			<action r_name="'use'" r_template="'activableActionTemplate'" timeCost="0">
				<effect r_name="'mainEffect'">
					<effect r_name="'attack'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectLaunchAction'" r_newActor="'target'" r_newTarget="'actor'" r_newActionType="'power'" r_newActionName="attackName" r_delayRequest="0" r_params="{{'isFree',1}}"/>
				</effect>
			</action>
			<event r_name="'onEnterInDungeon'">
				<effect r_name="'debuff'" r_template="{'mainSelfEffectTemplate','controllerEffect'}"
								r_className="'CctlEffectLaunchAction'"
								r_newActor="'self'"
								r_newTarget="'targetSquare'"
								rw_xTarget="square.w_xCoord"
								rw_yTarget="square.w_yCoord"
								r_newActionType="'power'"
								r_newActionName="attackName"
								r_delayRequest="0"
								r_params="{{'isFree',1}}"/>
			</event>
			<modifier r_name="'movePlannerCost'" r_template="'mainModifierTemplate'" r_modifierTarget="'movePlannerCost'" r_modifiedValue="$0*(isDangerous?actor.knownTrapMoveCost:1)"/>
			<modifier r_name="'dangerousTile'" r_template="'mainModifierTemplate'" r_modifierTarget="'dangerousTile'" r_modifiedValue="$0||isDangerous"/>
		</activableTemplate>

		<!-- cloud -->
		<activable r_name="'smokeCloud'" r_template="'mainActivableTemplate'" r_graphic="'Smoke'">
			<modifier r_name="'losMask'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_losMask'" r_modifiedValue="$0|4"/>
		</activable>
		<!-- blinkingCloud -->
		<activable r_name="'blinkingCloud'" r_template="{'smokeCloud','zoneEffectInterface'}">
			<event r_name="'onEnterInDungeon'">
				<effect r_name="'blinkingDebuff'" r_template="{'mainSelfEffectTemplate','permanentTickEffectTemplate'}"
								r_enabled="w_isInDungeon"
								r_className="'CctlEffectCreateDurable'"
								r_tickDuration="100*1D30">
					<effect r_name="'tickEffect'">
						<effect r_name="'blink'" r_template="{'mainSelfEffectTemplate','controllerEffect'}"
										r_className="'CctlEffectTeleportation'"
										r_targetLevelIndex="w_levelIndex"
										rw_xTarget="w_xCoord"
										rw_yTarget="w_yCoord"
										r_randomDestination="1"
										r_randomRange="1"
										r_randomTargetingType="'anyNonWall'"
										r_walkSimulation="0"
										w_crossedSquare="0"/>
						<effect r_name="'visionUpdate'" r_template="'mainSelfEffectTemplate'" r_type="'Visibility'"/>
					</effect>
				</effect>
			</event>
		</activable>
		<!-- Smoke -->
		<activable r_name="'smoke'" r_template="{'smokeCloud','zoneEffectTimedInterface'}" zoneEffectDuration="zoneEffectDuration=(200+2D900)"/>
		<!-- fireCloud -->
		<activable r_name="'fireCloud'" r_template="{'mainActivableTemplate','zoneEffectWithAttackInterface'}" r_displayName="text.powerFireCloud" r_graphic="'fireAreaEffect'" r_category="'fireCloud'" zoneEffectDuration="1000" attackName="'fireCloudAttack'">
			<power r_name="'fireCloudAttack'" r_template="'activePowerTemplate'"
						 r_displayName="text.powerFireCloud"
						 powerEffectTemplate="'fireCloudEffect'"
						 powerDamage="5"
						 actionLogMethod="'logDebuffEffect'">
				<action r_name="'use'" timeCost="0" canTargetFaction="1" r_range="0"/>
			</power>
		</activable>		
		<!-- quicksand -->
		<activable r_name="'quicksand'" r_template="{'mainActivableTemplate','zoneEffectWithAttackInterface'}" r_displayName="text.powerQuicksand" r_graphic="'earthAreaEffect'" r_category="'quicksand'" zoneEffectDuration="500" attackName="'quicksandAttack'">
			<power r_name="'quicksandAttack'" r_template="'activePowerTemplate'"
						 r_displayName="text.powerQuicksand"
						 powerEffectTemplate="'quicksandEffect'"
						 powerDamage="3"
						 actionLogMethod="'logDebuffEffect'">
				<action r_name="'use'" timeCost="0" canTargetFaction="1" r_range="0"/>
			</power>
		</activable>		
		<!-- poisonCloud -->
		<activable r_name="'poisonCloud'" r_template="{'mainActivableTemplate','zoneEffectWithAttackInterface'}" r_displayName="text.powerPoisonCloud" r_graphic="'poisoncloud.png'" r_category="'poisonCloud'" zoneEffectDuration="zoneEffectDuration=10D100" attackName="'poisonCloudAttack'" cloudLevel="1" isDangerous="!contains(actor.immunities,'Poison')">
			<power r_name="'poisonCloudAttack'" r_template="'activePowerTemplate'"
						 r_displayName="text.powerPoisonCloud"
						 powerEffectTemplate="'poisonCloudEffect'"
						 powerDamage="5"
						 actionLogMethod="'logDebuffEffect'"
						 powerHitBonus="5+2*cloudLevel"
						 poisonDamage="cloudLevel">
				<action r_name="'use'" timeCost="0" canTargetFaction="1" r_range="0">
					<modifier r_name="'immunity'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_canTarget'" r_modifiedValue="$0&&!contains(target.immunities,'Poison')"/>
				</action>
			</power>
		</activable>		

		<!--	-->
		<!-- Life Orb -->
		<!--	-->
		<activable r_name="'LifeOrb'" r_template="'mainActivableTemplate'"
							 r_displayName="text.activableLifeOrb"
							 r_graphic="'heart'"
							 r_autoActivation="1"
							 r_explorable="heroes.@0.maxHitPoints>heroes.@0.hitPoints"
							 r_category="'LifeOrb'"
							 lifeGain="0"
							 existanceDuration="2000"
							 isDestroyed="0"
							 tooltip="text.activableTooltipLifeOrb">
			<event r_name="'onEnterInDungeon'" r_template="'mainEventTemplate'" r_eventTarget="'w_isInDungeon'" r_targetType="'attribute'">
				<effect r_name="'destruction'" r_template="{'mainSelfEffectTemplate','mainDurableEffectTemplate'}"
								r_enabled="w_isInDungeon"
								r_className="'CctlEffectCreateDurable'"
								r_tickDuration="existanceDuration">
					<effect r_name="'endEffect'">
						<effect r_name="'remove'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_enabled="!isDestroyed" r_className="'CctlEffectDestructor'" r_loot="0"/>
					</effect>
				</effect>
			</event>
			<action r_name="'use'" r_template="'activableActionTemplate'" timeCost="0">
				<effect r_name="'mainEffect'" r_enabled="actor==heroes.@0">
					<effect r_name="'setup'" r_template="{'mainActorEffectTemplate','evaluationEffect'}" r_effect="all({isDestroyed=1,lifeGain=(5+actor.maxHitPoints*0.1)})"/>
					<effect r_name="'heal'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectLaunchAction'" r_newActor="'target'" r_newTarget="'actor'" r_newActionType="'power'" r_newActionName="'heal'" r_delayRequest="0" r_params="{{'isFree',1}}"/>
					<effect r_name="'remove'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectDestructor'" r_loot="0"/>
				</effect>
			</action>
			<power r_name="'heal'" r_template="'activePowerTemplate'"
						 powerEffectTemplate="{'mainSelfEffectTemplate','standardHealTemplate'}"
						 actionLogMethod="'logOrbLifeHeal'">
				<action r_name="'use'" timeCost="0" canTargetFaction="1" r_range="0">
					<effect r_name="'mainEffect'" healBonus="lifeGain"/>
				</action>
			</power>
		</activable>		
	</activables>
</data>