/*
 * fichier Weapon.h	
 * Weapon
 * 
 * Initalisation for all weapon type.
 * Public variable.
 * 
 * 29/01/2006
 * Copyright Piquier Production
 * 
 */



#include "Weapon.h"

#include "Config.h"

#include "MemoryManager/debugNew.h"


using namespace std;

const float Weapon::fatalDamage = 100;
const float Weapon::minAltitudeDifference = 10;
const float Weapon::proximityModifier = 1.5;

Weapon::Weapon(string weaponType)
{
	Config& config = Config::getInstance();
	damage = config.getVariable(weaponType,"damage");
	rangedDamage = config.getVariable(weaponType,"rangedDamage");
	damageVsMounted = config.getVariable(weaponType,"damageVsMounted");
	rangedDamageVsMounted = config.getVariable(weaponType,"rangedDamageVsMounted");
	criticalDamageMultiplier = config.getVariable(weaponType,"criticalDamageMultiplier");
	criticalDamageRangedMultiplier = config.getVariable(weaponType,"criticalDamageRangedMultiplier");

	weaponSpeed = config.getVariable(weaponType,"weaponSpeed");
	maxRange = config.getVariable(weaponType,"maxRange");
	minRange = config.getVariable(weaponType,"minRange");
	rangeCloseCombat = config.getVariable(weaponType,"rangeCloseCombat");

	// Ground units vs ground units
	criticalHit = config.getVariable(weaponType,"criticalHit");
	fatalHit = config.getVariable(weaponType,"fatalHit");

	// Ground units vs mounted units
	criticalVsMounted = config.getVariable(weaponType,"criticalVsMounted");
	fatalVsMounted = config.getVariable(weaponType,"fatalVsMounted");
	chanceToHitMountedUnit = config.getVariable(weaponType,"chanceToHitMountedUnit");

	// Mounted units vs ground units
	criticalMounted = config.getVariable(weaponType,"criticalMounted");
	fatalHitMounted = config.getVariable(weaponType,"fatalHitMounted");

	// Mounted units vs mounted units
	criticalMountedVsMounted = config.getVariable(weaponType,"criticalMountedVsMounted");
	fatalMountedVsMounted = config.getVariable(weaponType,"fatalMountedVsMounted");
	chanceToHitMountedUnitMounted = config.getVariable(weaponType,"chanceToHitMountedUnitMounted");

	// Static modifiers
	vsLightModifier = config.getVariable(weaponType,"vsLightModifier");
	vsMediumModifier = config.getVariable(weaponType,"vsMediumModifier");
	vsHeavyModifier = config.getVariable(weaponType,"vsHeavyModifier");

	// Dynamic modifiers
	altitudeModifier = config.getVariable(weaponType,"altitudeModifier");
	speedModifier = config.getVariable(weaponType,"speedModifier");
	movementModifier = config.getVariable(weaponType,"movementModifier");
	movingEnnemyModifier = config.getVariable(weaponType,"movingEnnemyModifier");
	// CHARGING units
	chargeModifier = config.getVariable(weaponType,"chargeModifier");
	combatPostureModifer = config.getVariable(weaponType,"combatPostureModifer");
	movementDamageModifier = config.getVariable(weaponType,"movementDamageModifier");
}

Weapon::~Weapon()
{
  // nothing to do
}
