Ejemplo n.º 1
0
        internal Weapon(SubClass weaponType, Point location)
        {
            Location = location;
            subClass = weaponType;
            switch (weaponType)
            {
            case SubClass.Stick:
                // http://www.dandwiki.com/wiki/Cane_(3.5e_Equipment)
                combatType      = CombatManager.CombatType.Melee;
                damageType      = CombatManager.DamageType.Bludgeoning;
                InventoryWeight = 3f;
                damageDice      = new KeyValuePair <CombatManager.DamageType, CombatManager.DieType>[]
                {
                    new KeyValuePair <CombatManager.DamageType, CombatManager.DieType>
                        (CombatManager.DamageType.Bludgeoning, CombatManager.DieType.D6)
                };
                inventoryTitle = "medium stick (1d6 bludgeoning)";
                break;

            case SubClass.Knife:
                // http://www.dandwiki.com/wiki/Knife_(5e_Equipment)
                combatType      = CombatManager.CombatType.Melee;
                damageType      = CombatManager.DamageType.Slashing;
                InventoryWeight = 0.25f;
                damageDice      = new KeyValuePair <CombatManager.DamageType, CombatManager.DieType>[]
                {
                    new KeyValuePair <CombatManager.DamageType, CombatManager.DieType>
                        (CombatManager.DamageType.Slashing, CombatManager.DieType.D3)
                };
                inventoryTitle = "small knife (1d3 slashing)";
                break;

            //case SubClass.Bow:
            //break;
            //case SubClass.Sling:
            //break;
            default:
                break;
            }

            // Chance weapon is broken
            if (Utility.Rand.Next(10) == 0)
            {
                Break();
            }
        }
Ejemplo n.º 2
0
    //Function called from AttackAction.cs to get the amount of bonus damage this perk awards
    public int GetDamageBoostAmount(Character perkOwner_, bool isCrit_, bool isDoTOrHot_, CombatManager.DamageType type_)
    {
        //The total amount of bonus damage returned
        int totalDamage = 0;

        //If the damage type doesn't match the type we're boosting, nothing happens
        if (this.damageTypeToBoost != type_)
        {
            return(totalDamage);
        }

        //If this perk only activates during a crit and the attack didn't crit, nothing happens
        if (this.onlyWorksOnCrit && !isCrit_)
        {
            return(totalDamage);
        }

        //If this perk only activates for Attack Actions and the current action isn't, nothing happens
        if (this.onlyWorksOnAttackAct && isDoTOrHot_)
        {
            return(totalDamage);
        }

        //If this perk only activates for DoTs and HoTs and the current action isn't, nothing happens
        if (this.onlyWorksOnDoTAndHoT && !isDoTOrHot_)
        {
            return(totalDamage);
        }

        //Adding the base damage amount
        totalDamage += this.baseAddedDamage;

        //Multiplier for the dice rolls to see if they're negative or positive
        int diePositiveNegative = 1;

        if (this.dieRollIsNegative)
        {
            diePositiveNegative = -1;
        }

        //Looping through and adding bonus damage for each damage die
        for (int d = 0; d < this.numberOfDamageDiceToRoll; ++d)
        {
            totalDamage += diePositiveNegative * Random.Range(1, this.damageDiceSideNumber + 1);
        }


        //If the attack was a crit, we multiply the total damage
        if (isCrit_)
        {
            totalDamage = Mathf.FloorToInt(totalDamage * this.critMultiplier);
        }

        //Returning the total damage
        return(totalDamage);
    }
Ejemplo n.º 3
0
    //Function called from the combat manager to set our damage text, color, and position
    public void SetDamageToDisplay(float timeDelay_, int damageDealt_, CombatManager.DamageType type_, Vector3 position_, bool isCrit_, bool isHeal_ = false)
    {
        //Adding this DamageText to the static list
        DamageText.allDamageTextObj.Add(this);

        //Moving this object to the given position with the starting offset
        this.spawnPosition      = position_;
        this.transform.position = this.spawnPosition + this.startingOffset;

        //Setting the amount of time before this text appears
        this.timeBeforeTextShows = timeDelay_;

        //Finding out if there are other damage texts on this position that requires us to stagger this time delay
        float staggerDelay = this.FindTimeDelay();

        if (staggerDelay >= timeDelay_)
        {
            staggerDelay -= timeDelay_;
            staggerDelay += this.staggerTime;
        }
        this.timeBeforeTextShows += staggerDelay;

        //Setting the text color to black
        this.ourText.color = Color.black;

        //Setting the text for the damage dealt
        this.ourText.text = "" + damageDealt_;

        //If this was a healing effect, we add a + sign
        if (isHeal_)
        {
            this.ourText.text = "+" + this.ourText.text;
        }

        //Setting the color of the text based on the damage type
        switch (type_)
        {
        case CombatManager.DamageType.Slashing:
            this.background.color = this.slashDamageColor;
            break;

        case CombatManager.DamageType.Stabbing:
            this.background.color = this.stabDamageColor;
            break;

        case CombatManager.DamageType.Crushing:
            this.background.color = this.crushDamageColor;
            break;

        case CombatManager.DamageType.Arcane:
            this.background.color = this.arcaneDamageColor;
            break;

        case CombatManager.DamageType.Holy:
            this.background.color = this.holyDamageColor;
            break;

        case CombatManager.DamageType.Dark:
            this.background.color = this.darkDamageColor;
            break;

        case CombatManager.DamageType.Fire:
            this.background.color = this.fireDamageColor;
            break;

        case CombatManager.DamageType.Water:
            this.background.color = this.waterDamageColor;
            break;

        case CombatManager.DamageType.Electric:
            this.background.color = this.electricDamageColor;
            break;

        case CombatManager.DamageType.Wind:
            this.background.color = this.windDamageColor;
            break;

        case CombatManager.DamageType.Pure:
            this.background.color = this.pureDamageColor;
            break;

        case CombatManager.DamageType.Nature:
            this.background.color = this.natureDamageColor;
            break;

        case CombatManager.DamageType.Bleed:
            this.background.color = this.bleedDamageColor;
            break;
        }

        //Setting the font size based on if the attack crit or not
        if (isCrit_)
        {
            this.ourText.fontSize = this.critDamageFontSize;
        }
        else
        {
            this.ourText.fontSize = this.normalDamageFontSize;
        }

        //Setting the text and background color to be transparent if our time before text shows is greater than 0
        if (this.timeBeforeTextShows > 0)
        {
            this.ourText.color    = new Color(this.ourText.color.r, this.ourText.color.g, this.ourText.color.b, 0);
            this.background.color = new Color(this.background.color.r, this.background.color.g, this.background.color.b, 0);
        }
    }