Пример #1
0
 public void UnlockAttackEnhancement(Attack enhancement)
 {
     AttackEnhancements.Remove(enhancement);
     enhancement.unlocked = true;
     UnlockedEnhancements.Add(enhancement);
     //Si attaque basique -> remplace attaque de base quand débloquée
     //Sinon -> ajoutée à la liste d'attaques sup débloquées
     if (enhancement.basic)
     {
         Weapon.EnhanceBaseAttack(enhancement);
     }
     else
     {
         Weapon.AddAttack(enhancement);
     }
 }
    void NewWeapon(string theName, Weapon.Type theType,
                   int dmgMod, int spdMod, int defMod,
                   int weaponLevel, Roll weaponRoll,
                   params Attack[] attacks)
    {
        Weapon weapon;

        // Don't create a weapon that doesn't have any attacks
        if (null == attacks || 0 == attacks.Length)
        {
            return;
        }

        weapon = new Weapon(theName, theType, dmgMod, spdMod, defMod, weaponLevel, weaponRoll);

        // Add the attacks to the weapon
        foreach (Attack attack in attacks)
        {
            attack.roll = weaponRoll;
            weapon.AddAttack(attack);
        }

        // Ensure the weapons Dict is allocated
        if (null == weapons)
        {
            weapons = new Dictionary <int, Dictionary <string, Weapon> >();
        }

        // Ensure the specified level in 'weapons' is allocated
        if (false == weapons.ContainsKey(weaponLevel))
        {
            weapons[weaponLevel] = new Dictionary <string, Weapon>();
        }

        // Add the weapon
        weapons[weaponLevel].Add(weapon.name, weapon);
    }
    void NewWeapon(string theName, Weapon.Type theType,
	               int dmgMod, int spdMod, int defMod,
	               int weaponLevel, Roll weaponRoll,
	               params Attack[] attacks)
    {
        Weapon weapon;

        // Don't create a weapon that doesn't have any attacks
        if(null == attacks || 0 == attacks.Length)
            return;

        weapon = new Weapon(theName, theType, dmgMod, spdMod, defMod, weaponLevel, weaponRoll);

        // Add the attacks to the weapon
        foreach(Attack attack in attacks)
        {
            attack.roll = weaponRoll;
            weapon.AddAttack(attack);
        }

        // Ensure the weapons Dict is allocated
        if(null == weapons)
            weapons = new Dictionary<int, Dictionary<string, Weapon>>();

        // Ensure the specified level in 'weapons' is allocated
        if(false == weapons.ContainsKey(weaponLevel))
            weapons[weaponLevel] = new Dictionary<string, Weapon>();

        // Add the weapon
        weapons[weaponLevel].Add(weapon.name, weapon);
    }