Пример #1
0
    public equipment(string name, equipSlots.equipmentType type, equipSlots.slots slot, int equipmentTier, int minlevel, int maxlevel, float health, float resource, float power, float defense, float mindmg, float maxdmg, float movespeed, float attackspeed, string flavortxt)
    {
        equipmentAttributes = new Attributes();
        equipmentName = name;
        equipmentType = type;
        flavorText = flavortxt;
        validSlot = slot;
        tier = equipmentTier;
        minlvl = minlevel;
        maxlvl = maxlevel;
        equipmentAttributes.Health = health;
        equipmentAttributes.Resource = resource;
        equipmentAttributes.Power = power;
        equipmentAttributes.Defense = defense;
        equipmentAttributes.MinDamage = mindmg;
        equipmentAttributes.MaxDamage = maxdmg;
        equipmentAttributes.AttackSpeed = attackspeed;
        equipmentAttributes.MovementSpeed = movespeed;

        slotList.Add("Head", equipSlots.slots.Head);
        slotList.Add("Legs", equipSlots.slots.Legs);
        slotList.Add("Feet", equipSlots.slots.Feet);
        slotList.Add("Chest", equipSlots.slots.Chest);
        slotList.Add("Main", equipSlots.slots.Main);
        slotList.Add("Off", equipSlots.slots.Off);

        twohand = false;
        ranged = false;
        onhit = "";

        prefixname = "";
        suffixname = "";

        modelname = "default";
    }
Пример #2
0
    public affix(string name, equipSlots.affixtype type, float health, float resource, float power, float defense, float mindmg, float maxdmg, float movespeed, float attackspeed, equipSlots.slots[] validslots)
    {
        affixAttributes = new Attributes();
        affixName = name;
        affixType = type;
        affixAttributes.Health = health;
        affixAttributes.Resource = resource;
        affixAttributes.Power = power;
        affixAttributes.Defense = defense;
        affixAttributes.MinDamage = mindmg;
        affixAttributes.MaxDamage = maxdmg;
        affixAttributes.AttackSpeed = attackspeed;
        affixAttributes.MovementSpeed = movespeed;

        foreach (equipSlots.slots slot in validslots)
        {
            affixSlots.Add(slot);
        }

        slotList.Add("Head", equipSlots.slots.Head);
        slotList.Add("Legs", equipSlots.slots.Legs);
        slotList.Add("Feet", equipSlots.slots.Feet);
        slotList.Add("Chest", equipSlots.slots.Chest);
        slotList.Add("Main", equipSlots.slots.Main);
        slotList.Add("Off", equipSlots.slots.Off);
    }
Пример #3
0
    /// <summary>
    /// Removing the attributes of an equipment item from the character.
    /// </summary>
    /// <param name="slot"></param>
    /// <returns></returns>
    public bool removeEquipment(equipSlots.slots slot)
    {
        if (equippedEquip.ContainsKey(slot))
        {
            equipment removed = equippedEquip[slot];
            GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>().EquipmentFactory.unsaveEquipment(((int)slot).ToString());

            equippedEquip.Remove(slot);
            equipAtt.Subtract(removed.equipmentAttributes);
            UpdateCurrentAttributes();

            if (slot == equipSlots.slots.Main)
            {
                abilityManager.RemoveAbility(6);

            }
            inventory.AddItem(removed);
            return true;
        }
        else
            return false;
    }
Пример #4
0
 /// <summary>
 /// Does the current entity have an item equipped in this slot
 /// </summary>
 /// <param name="slot">The slot to check</param>
 /// <returns>Returns false if entity does not have slot equipped; true if they do</returns>
 public bool HasEquipped(equipSlots.slots slot)
 {
     return equippedEquip.ContainsKey(slot);
 }
Пример #5
0
    /// <summary>
    /// Returns the equipped item of that slot
    /// </summary>
    /// <param name="slot">Slot to return item</param>
    /// <returns>Throws exception if the entity doesn't have anything equipped there, else returns the item equipped</returns>
    public equipment GetEquip(equipSlots.slots slot)
    {
        if (HasEquipped(slot) == false)
        {
            throw new KeyNotFoundException("Entity does not have this item equipped!");
        }

        else
        {
            return equippedEquip[slot];
        }
    }
Пример #6
0
 private affix getrandaffix(equipSlots.slots slot, equipSlots.affixtype atype)
 {
     ArrayList templist = new ArrayList();
     foreach (affix e in affixeslist)
     {
         if (e.affixSlots.Contains(slot) == true && e.affixType == atype)
         {
             templist.Add(e);
         }
     }
     return (affix)templist[UnityEngine.Random.Range(0, templist.Count)];
 }
Пример #7
0
    /// <summary>
    /// function to generate a random equipment
    /// </summary>
    /// <param name="tier">the tier of the desired equipment</param>
    /// <param name="level">the level of the desired equipment</param>
    /// <param name="slot">the slot of the desired equipment</param>
    /// <returns></returns>
    public equipment randomEquipment(int tier, int level, equipSlots.slots slot)
    {
        equipment randEquipment = new equipment();
        equipment tempEquipment;

        //NO! BAD USER! LEVEL CAP IS A THING!
        if (level > 20)
        {
            level = 20;
        }

        //grab a random equipment out of the list appropriate for the tier
        if (tier >= 3)
        {

            ArrayList templist = new ArrayList();
            foreach(equipment e in uniqueslist)
            {
                if (e.validSlot == slot && e.minlvl <= level && e.maxlvl >= level)
                {
                    templist.Add(e);
                }
            }
            tempEquipment = (equipment)templist[UnityEngine.Random.Range(0, templist.Count)];

        }
        else
        {
            ArrayList templist = new ArrayList();
            foreach(equipment e in basesList)
            {
                if (e.validSlot == slot && e.minlvl <= level && e.maxlvl >= level)
                {

                    templist.Add(e);
                }
            }
            tempEquipment = (equipment)templist[UnityEngine.Random.Range(0, templist.Count-1)];

        }

        randEquipment.equipmentName = tempEquipment.equipmentName;
        randEquipment.equipmentType = tempEquipment.equipmentType;
        randEquipment.validSlot = tempEquipment.validSlot;
        randEquipment.maxlvl = tempEquipment.maxlvl;
        randEquipment.minlvl = tempEquipment.minlvl;
        randEquipment.flavorText = tempEquipment.flavorText;
        randEquipment.tier = tempEquipment.tier;
        randEquipment.ranged = tempEquipment.ranged;
        randEquipment.twohand = tempEquipment.twohand;
        randEquipment.onhit = tempEquipment.onhit;
        randEquipment.modelname = tempEquipment.modelname;

        randEquipment.equipmentAttributes.Add(tempEquipment.equipmentAttributes);

        doaffixes(randEquipment, tier);

        return randEquipment;
    }
Пример #8
0
    public void PlayerAttack(Ability ability, equipSlots.equipmentType weaponType)
    {
        AttackType attackType = ability.AttackType;

        string name;

        if (ability.ID == "whirlwind")
        {
            name = "attack 4";
            animation[name].speed = animation[name].clip.length / (GameManager.GLOBAL_COOLDOWN / _entity.currentAtt.AttackSpeed);
            _movementFSM.LockMovement(MovementFSM.LockType.MovementLock, GameManager.GLOBAL_COOLDOWN / _entity.currentAtt.AttackSpeed);
        }

        else if ((AttackType)attackType == AttackType.MELEE)
        {
            List<string> attackAnimations = new List<string>();

            if ((equipSlots.equipmentType)weaponType == equipSlots.equipmentType.Dagger)
            {
                attackAnimations.Add("attack 1");
                attackAnimations.Add("attack 3");
                attackAnimations.Add("attack 5");
            }

            else if ((equipSlots.equipmentType)weaponType == equipSlots.equipmentType.Axe)
            {
                attackAnimations.Add("attack 2");
                attackAnimations.Add("attack 1");
            }

            else
            {
                attackAnimations.Add("attack 1");
                attackAnimations.Add("attack 3");
                attackAnimations.Add("attack 4");
            }

            name = attackAnimations[UnityEngine.Random.Range((int)0, (int)attackAnimations.Count)];
            animation[name].speed = animation[name].clip.length / (GameManager.GLOBAL_COOLDOWN / _entity.currentAtt.AttackSpeed);
            _movementFSM.LockMovement(MovementFSM.LockType.MovementLock, GameManager.GLOBAL_COOLDOWN / _entity.currentAtt.AttackSpeed);

            //Debug.Log(animation[name].clip.length);
            //Debug.Log(animation[name].length);
        }

        else
        {
            name = "cast spell";
            _movementFSM.LockMovement(MovementFSM.LockType.MovementLock, animation[name].length / 3f);
        }

        Attack(name);
    }