コード例 #1
0
    protected override int GetDamageRoll()
    {
        int        damage = 0;
        Equipment  eq     = GetComponentInParent <Equipment>();
        Equippable item   = eq.GetItem(EquipSlots.Primary);

        //use STR mod for unarmed hits
        if (item == null)
        {
            return(GetBaseDamageModifier());
        }

        //add weapon base damage roll
        WeaponBase weapon = item.gameObject.GetComponent <WeaponBase>();

        for (int i = 0; i < weapon.rolls; i++)
        {
            damage += Random.Range(1, weapon.d);
        }

        //add damage from additional item effects
        StatModifierFeature[] features = item.GetComponentsInChildren <StatModifierFeature>();

        for (int i = 0; i < features.Length; ++i)
        {
            if (features[i].type == StatTypes.STR)
            {
                damage += features[i].amount;
            }
        }

        return(damage);
    }
コード例 #2
0
    protected int PowerFromEquippedWeapon()
    {
        int        power = 0;
        Equipment  eq    = GetComponentInParent <Equipment>();
        Equippable item  = eq.GetItem(EquipSlots.Primary);

        if (item == null || !item.GetComponentInChildren <WeaponAbilityPower>().GetType().Equals(GetType()))
        {
            item = eq.GetItem(EquipSlots.Secondary);
        }
        if (item == null || !item.GetComponentInChildren <WeaponAbilityPower>().GetType().Equals(GetType()))
        {
            return(power);
        }
        if (item != null && item.GetComponentInChildren <WeaponAbilityPower>().GetType().Equals(GetType()))
        {
            StatModifierFeature[] features = item.GetComponentsInChildren <StatModifierFeature>();

            for (int i = 0; i < features.Length; ++i)
            {
                if (features[i].type == StatTypes.MEL)
                {
                    power += features[i].amount;
                }
            }
        }
        return(power);
    }
コード例 #3
0
    private void HangUpGear(Player player)
    {
        if (hookStatus == containerStatus.EMPTY)
        {
            //if the hook is empty, you just hang up what you have
            HangUpWithoutCombining(player);
        }
        else
        {
            Equippable halter             = null;
            Equippable lead               = null;
            Equippable combinedEquippable = null;

            switch (player.currentlyEquippedItem.id)
            {
            case equippableItemID.HALTER:
                halter = player.currentlyEquippedItem;
                lead   = content;
                break;

            case equippableItemID.LEAD:
                lead   = player.currentlyEquippedItem;
                halter = content;
                break;
            }

            //Find combined equippable in halter children
            Equippable[] equippablesInHalter = halter.GetComponentsInChildren <Equippable> ();

            for (int i = 0; i < equippablesInHalter.Length; ++i)
            {
                if (equippablesInHalter [i].id == equippableItemID.HALTER_WITH_LEAD)
                {
                    combinedEquippable = equippablesInHalter [i];
                }
            }

            //if something's already on the hook, and you hold a halter or a lead, you can combine the two
            player.UnequipEquippedItem();
            combinedEquippable.transform.SetParent(transform);
            halter.transform.SetParent(combinedEquippable.transform);
            lead.transform.SetParent(combinedEquippable.transform);
            combinedEquippable.transform.localPosition = Vector3.zero;
            halter.transform.localPosition             = Vector3.zero;
            lead.transform.localPosition             = Vector3.zero;
            combinedEquippable.transform.eulerAngles = Vector3.zero;
            halter.transform.eulerAngles             = Vector3.zero;
            lead.transform.eulerAngles = Vector3.zero;
            hookStatus = containerStatus.FULL;
            content    = combinedEquippable;
        }
    }
コード例 #4
0
    int PowerFromEquippedWeapon()
    {
        int        power = 0;
        Equipment  eq    = GetComponentInParent <Equipment>();
        Equippable item  = eq.GetItem(EquipSlots.Primary);

        StatModifierFeature[] features = item.GetComponentsInChildren <StatModifierFeature>();
        for (int i = 0; i < features.Length; ++i)
        {
            if (features[i].type == StatTypes.ATK)
            {
                power += features[i].amount;
            }
        }

        return(power);
    }