<data>
	<effects>
		<!-- -->
		<!-- ATTACK EFFECTS -->
		<!-- -->
		<!-- defense, mitigation and absorption depends on the effect. Attack and damage should be computed by the power/item -->
		<!-- main template -->
		<effectTemplate r_name="'mainAttackEffect'" r_template="{'mainTargetEffectTemplate','multiEffect'}"
										onHitEffectTemplate="'ToBeReplaced'"
										onMissEffectTemplate="'ToBeReplaced'"
										r_enabled="exists(target)&&!target.isDead"
										offensiveHitBonus="'ToBeReplaced'"
										defensiveHitBonus="'ToBeReplaced'"
										offensiveHitRoll="0"
										wasHit="0"
										roll="2D11">
			<effect r_name="'evaluateRolls'" r_template="{'mainSelfEffectTemplate','multiEffect'}">
				<effect r_name="'evaluateHit'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({offensiveHitRoll=roll-roll,wasHit=(round(offensiveHitBonus)+offensiveHitRoll>=round(defensiveHitBonus))})"/>
			</effect>
			<effect r_name="'hitEffect'" r_template="onHitEffectTemplate">
				<modifier r_name="'wasHit'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_enabled'" r_modifiedValue="$0&&wasHit"/>
			</effect>
			<effect r_name="'missEffect'" r_template="onMissEffectTemplate">
				<modifier r_name="'wasNotHit'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_enabled'" r_modifiedValue="$0&&!wasHit"/>
			</effect>
		</effectTemplate>

		<!-- interfaces -->
		<effectTemplate r_name="'powerAttackEffectInterface'"
										onHitEffectTemplate="powerHitEffectTemplate"
										onMissEffectTemplate="powerMissEffectTemplate"
										actionMissLogMethod="'logPowerMissed'"
					 					offensiveHitBonus="powerHitBonus"/>
		<effectTemplate r_name="'weaponAttackEffectInterface'"
										onHitEffectTemplate="'weaponStrikeDamageEffect'"
										onMissEffectTemplate="'standardMissTemplate'"
										actionMissLogMethod="'logAttackMissed'"
					 					offensiveHitBonus="weaponHitBonus"/>
		
		<!-- There are 5 standards ways to attack -->
		<!-- close combat -->
		<effectTemplate r_name="'mainCloseCombatAttackEffect'" r_template="'mainAttackEffect'"
										defensiveHitBonus="target.closeCombatDefense"/>
		<effectTemplate r_name="'powerCloseCombatAttackEffect'" r_template="{'mainCloseCombatAttackEffect','powerAttackEffectInterface'}"/>
		<effectTemplate r_name="'weaponCloseCombatAttackEffect'" r_template="{'mainCloseCombatAttackEffect','weaponAttackEffectInterface'}"/>
		<!-- ranged combat -->
		<effectTemplate r_name="'mainRangedAttackEffect'" r_template="'mainAttackEffect'"
										defensiveHitBonus="target.rangedDefense"/>
		<effectTemplate r_name="'powerRangedAttackEffect'" r_template="{'mainRangedAttackEffect','powerAttackEffectInterface'}"/>
		<effectTemplate r_name="'weaponRangedAttackEffect'" r_template="{'mainRangedAttackEffect','weaponAttackEffectInterface'}"/>
		<!-- attack spell -->
		<effectTemplate r_name="'mainSpellAttackEffect'" r_template="'mainAttackEffect'"
										defensiveHitBonus="target.spellDefense"/>
		<effectTemplate r_name="'powerSpellAttackEffect'" r_template="{'mainSpellAttackEffect','powerAttackEffectInterface'}"/>
		<!-- physical effect -->
		<effectTemplate r_name="'mainPhysicalAttackEffect'" r_template="'mainAttackEffect'"
										defensiveHitBonus="target.PhysicalResistance"/>
		<effectTemplate r_name="'powerPhysicalAttackEffect'" r_template="{'mainPhysicalAttackEffect','powerAttackEffectInterface'}"/>
		<effectTemplate r_name="'weaponPhysicalAttackEffect'" r_template="{'mainPhysicalAttackEffect','weaponAttackEffectInterface'}"/>
		<!-- mental effect -->
		<effectTemplate r_name="'mainMentalAttackEffect'" r_template="'mainAttackEffect'"
										defensiveHitBonus="target.MentalResistance"/>
		<effectTemplate r_name="'powerMentalAttackEffect'" r_template="{'mainMentalAttackEffect','powerAttackEffectInterface'}"/>
		<effectTemplate r_name="'weaponMentalAttackEffect'" r_template="{'mainMentalAttackEffect','weaponAttackEffectInterface'}"/>

		<!-- -->
		<!-- STATUS ATTACK EFFECTS -->
		<!-- -->
		<!-- templates -->
		<effect r_name="'mainEffectAttackAdditionalInterface'"
						onHitEffectTemplate="'ToBeReplaced'"
	 					onMissEffectTemplate="'standardMissTemplate'"
	 					actionLogMethod="'logPowerWithEffect'"
	 					immunityName="'ToBeReplaced'"
						immunityDisplayName="text.(attributeByName('effectName'+immunityName))">
			<effect r_name="'hitEffect'">
				<modifier r_name="'immunity'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_enabled'" r_modifiedValue="$0&&!contains(target.immunities,immunityName)"/>
			</effect>
			<effect r_name="'missEffect'">
				<modifier r_name="'immunity'" r_template="'mainModifierTemplate'" r_modifierTarget="'r_enabled'" r_modifiedValue="$0&&!contains(target.immunities,immunityName)"/>
			</effect>
	 		<effect r_name="'immune'" r_template="'logImmune'"
	 						r_enabled="contains(target.immunities,immunityName)"/>
	 	</effect>
		<effect r_name="'weaponCloseCombatAttackWithEffectTemplate'" r_template="{'weaponCloseCombatAttackEffect','mainEffectAttackAdditionalInterface'}"/>
		<effect r_name="'weaponRangedAttackWithEffectTemplate'" r_template="{'weaponRangedAttackEffect','mainEffectAttackAdditionalInterface'}"/>
		<effect r_name="'physicalAttackWithEffectTemplate'" r_template="{'powerPhysicalAttackEffect','mainEffectAttackAdditionalInterface'}"/>
		<effect r_name="'mentalAttackWithEffectTemplate'" r_template="{'powerMentalAttackEffect','mainEffectAttackAdditionalInterface'}"/>
		<!-- status attacks -->
		<effect r_name="'physicalPoisonAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Poison'"
						onHitEffectTemplate="'poisonEffect'"/>
		<effect r_name="'physicalSlowAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Slow'"
						onHitEffectTemplate="'slowEffect'"/>
		<effect r_name="'physicalRootAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Root'"
						onHitEffectTemplate="'rootEffect'"/>
		<effect r_name="'weaponRangedRootAttack'" r_template="'weaponRangedAttackWithEffectTemplate'"
						immunityName="'Root'"
						onHitEffectTemplate="'rootEffect'"/>
		<effect r_name="'physicalCripplingAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Cripple'"
						onHitEffectTemplate="'cripplingEffect'"/>
		<effect r_name="'mentalStunAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Stun'"
						onHitEffectTemplate="'stunEffect'"/>
		<effect r_name="'physicalStunAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Stun'"
						onHitEffectTemplate="'stunEffect'"/>
		<effect r_name="'physicalBlindAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Blind'"
						onHitEffectTemplate="'blindEffect'"/>
		<effect r_name="'mentalBlindAttack'" r_template="'mentalAttackWithEffectTemplate'"
						immunityName="'Blind'"
						onHitEffectTemplate="'blindEffect'"/>
		<effect r_name="'physicalBurnAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Burn'"
						onHitEffectTemplate="'burnEffect'"/>
		<effect r_name="'physicalConfuseAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Confuse'"
						onHitEffectTemplate="'confuseEffect'"/>
		<effect r_name="'mentalConfuseAttack'" r_template="'mentalAttackWithEffectTemplate'"
						immunityName="'Confuse'"
						onHitEffectTemplate="'confuseEffect'"/>
		<effect r_name="'physicalMesmerizeAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Mesmerize'"
						onHitEffectTemplate="'mesmerizeEffect'"/>
		<effect r_name="'mentalMesmerizeAttack'" r_template="'mentalAttackWithEffectTemplate'"
						immunityName="'Mesmerize'"
						onHitEffectTemplate="'mesmerizeEffect'"/>
		<effect r_name="'physicalSilenceAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Silence'"
						onHitEffectTemplate="'silenceEffect'"/>
		<effect r_name="'mentalSilenceAttack'" r_template="'mentalAttackWithEffectTemplate'"
						immunityName="'Silence'"
						onHitEffectTemplate="'silenceEffect'"/>
		<effect r_name="'physicalShakenAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Shaken'"
						onHitEffectTemplate="'shakenEffect'"/>
		<effect r_name="'mentalShakenAttack'" r_template="'mentalAttackWithEffectTemplate'"
						immunityName="'Shaken'"
						onHitEffectTemplate="'shakenEffect'"/>
		<effect r_name="'mentalCharmAttack'" r_template="'mentalAttackWithEffectTemplate'"
						immunityName="'Charm'"
						onHitEffectTemplate="'charmEffect'"/>
		<effect r_name="'physicalFuryAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Fury'"
						onHitEffectTemplate="'furyEffect'"/>
		<effect r_name="'mentalFuryAttack'" r_template="'mentalAttackWithEffectTemplate'"
						immunityName="'Fury'"
						onHitEffectTemplate="'furyEffect'"/>
		<effect r_name="'physicalDiseaseAttack'" r_template="'physicalAttackWithEffectTemplate'"
						immunityName="'Disease'"
						onHitEffectTemplate="'diseaseEffect'"/>
		
		<!-- -->
		<!-- DAMAGE EFFECTS -->
		<!-- -->
		<effectTemplate r_name="'mainDamageTemplate'" r_template="{'mainTargetEffectTemplate','multiEffect'}"
										r_enabled="!target.isDead"
										offensiveDamageBonus="'ToBeReplaced'"
										damageMitigation="'ToBeReplaced'"
										damageAbsorption="'ToBeReplaced'"
										offensiveDamageRoll="0"
										resultingDamage="0"
										roll="2D6">
			<effect r_name="'evaluate'" r_template="{'mainTargetEffectTemplate','evaluationEffect'}"
							r_effect="all({offensiveDamageRoll=roll-roll,resultingDamage=round(max((offensiveDamageBonus+offensiveDamageRoll)*(20/(20+damageMitigation))-damageAbsorption, 0))})"/>
			<effect r_name="'log'" r_template="actionLogMethod"/>
			<effect r_name="'damage'" r_template="'basicDamageTarget'" damageAmount="resultingDamage"/>
		</effectTemplate>

		<effectTemplate r_name="'mainFatigueDamageTemplate'" r_template="{'mainTargetEffectTemplate','multiEffect'}"
										r_enabled="!target.isDead"
										offensiveDamageBonus="'ToBeReplaced'"
										damageMitigation="0"
										damageAbsorption="0"
										offensiveDamageRoll="0"
										resultingDamage="0"
										roll="2D6">
			<effect r_name="'evaluate'" r_template="{'mainTargetEffectTemplate','evaluationEffect'}"
							r_effect="all({offensiveDamageRoll=roll-roll,resultingDamage=round(max((offensiveDamageBonus+offensiveDamageRoll)*(20/(20+damageMitigation))-damageAbsorption, 0))})"/>
			<effect r_name="'log'" r_template="actionLogMethod"/>
			<effect r_name="'damage'" r_template="'basicFatigueDamageTarget'" damageAmount="resultingDamage"/>
		</effectTemplate>		
		
		<!-- power interface -->
		<effectTemplate r_name="'powerDamageEffectInterface'"
					 					offensiveDamageBonus="powerDamage"/>
		<effectTemplate r_name="'weaponDamageEffectInterface'"
					 					offensiveDamageBonus="weaponDamage"/>

		<!-- There are 3 standards ways to damage -->
		<!-- strike -->		
		<effectTemplate r_name="'mainStrikeDamageEffect'" r_template="'mainDamageTemplate'"
										attackIgnoreArmor="0"
										armorPiercing="0"
										damageMitigation="attackIgnoreArmor?0:max(0,target.Armor-armorPiercing)"
										damageAbsorption="attackIgnoreArmor?0:max(0,target.attackDamageAbsorption-armorPiercing)"/>
		<effectTemplate r_name="'powerStrikeDamageEffect'" r_template="{'mainStrikeDamageEffect','powerDamageEffectInterface'}"/>
		<effectTemplate r_name="'weaponStrikeDamageEffect'" r_template="{'mainStrikeDamageEffect','weaponDamageEffectInterface'}"/>
		<!-- physical -->		
		<effectTemplate r_name="'mainPhysicalDamageEffect'" r_template="'mainDamageTemplate'"
										damageMitigation="0"
										damageAbsorption="target.physicalDamageAbsorption"/>
		<effectTemplate r_name="'powerPhysicalDamageEffect'" r_template="{'mainPhysicalDamageEffect','powerDamageEffectInterface'}"/>
		<!-- mental -->		
		<effectTemplate r_name="'mainMentalDamageEffect'" r_template="'mainDamageTemplate'"
										damageMitigation="0"
										damageAbsorption="target.mentalDamageAbsorption"/>
		<effectTemplate r_name="'powerMentalDamageEffect'" r_template="{'mainMentalDamageEffect','powerDamageEffectInterface'}"/>

		<!-- single way to make fatigue damage -->
		<effectTemplate r_name="'powerFatigueDamageEffect'" r_template="{'mainFatigueDamageTemplate','powerDamageEffectInterface'}"/>
		
		<!-- miss -->		
		<effectTemplate r_name="'standardMissTemplate'" r_template="{'mainTargetEffectTemplate','multiEffect'}">
			<effect r_name="'log'" r_template="actionMissLogMethod"/>
			<effect r_name="'missText'" r_template="{'mainTargetEffectTemplate','floatingTextTemplate'}" r_enabled="target.square.w_isSeenByHeroes" r_text="'Miss'" r_color="16711680"/>
		</effectTemplate>
		
		<!-- -->
		<!-- RESTORATION EFFECTS -->
		<!-- -->
		<!-- heal -->		
		<effectTemplate r_name="'standardHealTemplate'" r_template="{'mainTargetEffectTemplate','multiEffect'}"
										healBonus="0"
										healRoll="0"
										resultingHeal="0"
										roll="2D6">
			<effect r_name="'evaluate'" r_template="'evaluationEffect'"
							r_effect="all({healRoll=roll-roll,resultingHeal=round(max(healBonus+healRoll, 0))})"/>
			<effect r_name="'log'" r_template="actionLogMethod"/>
			<effect r_name="'heal'" r_template="'basicHealTarget'" healAmount="resultingHeal"/>
		</effectTemplate>
		<!-- restore -->		
		<effectTemplate r_name="'standardRestoreTemplate'" r_template="{'mainTargetEffectTemplate','multiEffect'}"
										fatigueBonus="0"
										exhaustionBonus="0"
										fatigueRoll="0"
										exhaustionRoll="0"
										resultingRestore="0"
										resultingExhaustionRestore="0"
										rollForFatigue="2D6"
										rollForExhaustion="0">
			<effect r_name="'evaluate'" r_template="'evaluationEffect'"
							r_effect="all({fatigueRoll=rollForFatigue-rollForFatigue,exhaustionRoll=rollForExhaustion-rollForExhaustion,resultingRestore=round(max(fatigueBonus+fatigueRoll, 0)),resultingExhaustionRestore=round(max(exhaustionBonus+exhaustionRoll, 0))})"/>
			<effect r_name="'log'" r_template="actionLogMethod"/>
			<effect r_name="'fatigue'" r_template="'basicRestoreTarget'" fatigueAmount="resultingRestore" exhaustionAmount="resultingExhaustionRestore"/>
		</effectTemplate>

		<!-- -->
		<!-- GRAPHIC EFFECTS -->
		<!-- -->
		<effectTemplate r_name="'missileGraphicTemplate'" r_template="{'mainSquareEffectTemplate','controllerEffect'}"
										r_enabled="exists(missileGraphic)"
										r_className="'CctlEffectCreateGraphicObject'"
										r_simpleObject="missileGraphic"
										r_delay="exists(missileDelay)?missileDelay:0"
										r_duration="0"
										r_xStart="actor.w_xCoord"
										r_yStart="actor.w_yCoord"
										r_xEnd="targetSquare.w_xCoord"
										r_yEnd="targetSquare.w_yCoord"
										r_scaleX="1"
										r_scaleY="1"
										r_levelIndex="actor.w_levelIndex"
										r_speed="15"/>
		<effectTemplate r_name="'directSpellEffectGraphicTemplate'" r_template="{'mainSquareEffectTemplate','controllerEffect'}"
										r_enabled="exists(directSpellEffectGraphic)"
										r_className="'CctlEffectCreateGraphicObject'"
										r_simpleObject="directSpellEffectGraphic"
										r_delay="0"
										r_duration="6"
										r_xStart="targetSquare.w_xCoord"
										r_yStart="targetSquare.w_yCoord"
										r_xEnd="targetSquare.w_xCoord"
										r_yEnd="targetSquare.w_yCoord"
										r_scaleX="1"
										r_scaleY="1"
										r_levelIndex="actor.w_levelIndex"
										r_speed="0"/>
		<effectTemplate r_name="'zoneEffectGraphicTemplate'" r_template="{'mainSquareEffectTemplate','controllerEffect'}"
										r_enabled="exists(zoneEffectGraphic)"
										r_className="'CctlEffectCreateGraphicObject'"
										r_simpleObject="zoneEffectGraphic"
										r_delay="2*actor.square.distanceTo(targetSquare)"
										r_duration="6"
										r_xStart="targetSquare.w_xCoord"
										r_yStart="targetSquare.w_yCoord"
										r_xEnd="targetSquare.w_xCoord"
										r_yEnd="targetSquare.w_yCoord"
										r_scaleX="1"
										r_scaleY="1"
										r_levelIndex="actor.w_levelIndex"
										r_speed="0"/>
	</effects>
</data>