Пример #1
0
 public DamageData(int Damage, DAMAGE_TYPE type, CIGameObject Damager, RESPONSE ExpectResponce)
 {
     this.Damage         = Damage;
     this.DamageType     = type;
     this.Damager        = Damager;
     this.ExpectResponce = ExpectResponce;
 }
Пример #2
0
    /// <summary>
    /// Calculates the hit chance for the player
    /// </summary>
    public float calculateHitChance(ARMOR_TYPE armor, DAMAGE_TYPE damage)
    {
        Debug.Log(" CRIT CHANCE : " + damageData [damage] [armor].critChance + " DAMAGE AMOUNT : " + damageData [damage] [armor].damage + " HIT CHANCE : " + damageData [damage] [armor].hitChance);


        return(damageData [damage] [armor].hitChance);
    }
Пример #3
0
 public void FHandleDamExternal(float amt, DAMAGE_TYPE _TYPE)
 {
     if (_invinsible)
     {
         return;
     }
     cHpShlds.FTakeDamage(amt, _TYPE);
 }
Пример #4
0
 public void FHandleMeleeHit(float _dam, DAMAGE_TYPE _TYPE)
 {
     cHpShlds.FTakeDamage(_dam, _TYPE);
     // At the end of getting potentially hit by things, check if we're dead.
     if (cHpShlds.mHealth.mAmt <= 0f)
     {
         Debug.Log("Dead");
         KillOurselves();
     }
 }
Пример #5
0
    // This is going to eventually have a shitload of side effects. Prepare thine anus.
    public void FTakeDamage(float amt, DAMAGE_TYPE type)
    {
        if (type == DAMAGE_TYPE.NO_DAMAGE)
        {
            Debug.Log("Something hit us which does no damage");
            return;
        }
        float healthDam = 0f;

        if (_hasShieldsEver && mShields.mStrength > 0f)
        {
            float leftoverDamage = 0f;

            // No matter what, the shields reset the recharge. Man, "Broken" was a terrible name for this effect.
            mShields.mState       = Shields.STATE.BROKEN;
            mShields.mBrokeTmStmp = Time.time;
            // do damage to shields first.
            float modifier = 1f;
            if (type == DAMAGE_TYPE.PLASMA)
            {
                modifier = 2.0f;
            }
            if (type == DAMAGE_TYPE.BULLET)
            {
                modifier = 0.5f;
            }

            mShields.mStrength -= amt * modifier;
            if (mShields.mStrength < 0f)
            {
                Debug.Log("Damage spilled over");
                leftoverDamage     = Mathf.Abs(mShields.mStrength);
                leftoverDamage    /= modifier;      // to get pure damage.
                healthDam          = leftoverDamage;
                healthDam         /= modifier;      // for now always assume plasma/bullet.
                mShields.mStrength = 0f;
            }
        }
        else
        {
            healthDam = amt;
            if (type == DAMAGE_TYPE.PLASMA)
            {
                healthDam *= 0.5f;
            }
            else if (type == DAMAGE_TYPE.BULLET)
            {
                healthDam *= 2.0f;
            }
        }

        mHealth.mAmt -= healthDam;
        // Debug.Log("Health Dam: " + healthDam);
    }
Пример #6
0
        public bool GetTriggerCondition(string triggerParam, params object[] param)
        {
            DAMAGE_TYPE damageType = (DAMAGE_TYPE)Enum.Parse(typeof(DAMAGE_TYPE), triggerParam);

            if (param.Length > 0)
            {
                DamageEffect effect = (DamageEffect)param[0];
                if (effect.EffectType == damageType || damageType == DAMAGE_TYPE.ANY)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #7
0
    void FTakeDamage(float amt, DAMAGE_TYPE type)
    {
        float realDamAmt = amt;

        if (type == DAMAGE_TYPE.PLASMA)
        {
            realDamAmt *= 0.5f;
        }
        else if (type == DAMAGE_TYPE.BULLET)
        {
            realDamAmt *= 2.0f;
        }
        else
        {
            Debug.Log("No damage type specified");
        }
        mHealth.mAmt -= realDamAmt;
        if (mHealth.mAmt <= 0f)
        {
            Debug.Log("Should die now");
        }
    }
Пример #8
0
    // For now, just say that plasma damage does 2x to shields, 1/2 to health, and vice versa for human weapon.
    public void FTakeDamage(float amt, DAMAGE_TYPE type)
    {
        // No matter what, the shields reset the recharge. Man, "Broken" was a terrible name for this effect.
        mShields.mState       = Shields.STATE.BROKEN;
        mShields.mBrokeTmStmp = Time.time;
        // do damage to shields first.
        float modifier = 1f;

        if (type == DAMAGE_TYPE.PLASMA)
        {
            modifier = 2.0f;
        }
        if (type == DAMAGE_TYPE.BULLET)
        {
            modifier = 0.5f;
        }
        // should be properly handling the spill over, but it's fine.
        float healthDam = (amt * modifier) - mShields.mStrength;

        mShields.mStrength -= amt * modifier;
        if (mShields.mStrength < 0f)
        {
            mShields.mStrength = 0f;
        }
        if (healthDam > 0f)      // shields could not fully contain the attack.
        {
            healthDam /= modifier * modifier;
            mHealth   -= healthDam;
        }
        // for now, just have the same modifier amounts, but in reverse.
        Debug.Log("Health Dam: " + healthDam);

        if (mHealth <= 0f)
        {
            Instantiate(PF_Particles, transform.position, transform.rotation);
            Destroy(gameObject);
        }
    }
Пример #9
0
    /// <summary>
    /// Calculates the damage dealt.
    /// </summary>
    /// <returns>The damage.</returns>
    /// <param name="armor">Armor.</param>
    /// <param name="damage">Damage.</param>
    /// <param name="baseDamage">Base damage.</param>
    public float calculateDamage(ARMOR_TYPE armor, DAMAGE_TYPE damage, int baseDamage)
    {
        int damageCalculation = Mathf.RoundToInt(baseDamage * damageData [damage] [armor].damage);

        return(damageCalculation);
    }
Пример #10
0
    }         // END DamageData constructor

    public DamageData(TextAsset file)
    {
        // open and read file in
        string[] lines = file.text.Split('\n');


        // for the population phase, we'll store a list of our header column
        // so that we can use that for our dictionary
        List <DAMAGE_TYPE> headerColumn = new List <DAMAGE_TYPE>();

        // instantiate our dictionary
        damageData = new Dictionary <DAMAGE_TYPE, Dictionary <ARMOR_TYPE, Damage> > ();


        int rowIndex = 0;

        foreach (var line in lines)
        {
            // split the line
            string[]   columns     = line.Split(',');
            int        columnIndex = 0;
            ARMOR_TYPE columnName  = new ARMOR_TYPE();


            if (columns.Length < 7)
            {
                continue;
            }

            // walk over columns
            foreach (var column in columns)
            {
                // split our column into its 3 values if that is appropriate (ie we are not in column 0 and we are not in row 0)
                if (columnIndex != 0 && rowIndex != 0)
                {
                    // get the damage type we are on from our header column (minus one, because our columns don't start at 0)
                    DAMAGE_TYPE tempDamageType = headerColumn[columnIndex - 1];

                    //Debug.Log ("ROW > 0, COLUMN > 0 : " + column);

                    string[] dataItems = column.Split('\t');
                    Damage   damageVal = new Damage();

                    // make a loop over the split details here
                    for (int i = 0; i < dataItems.Length; i++)
                    {
                        // let's trim and translate to float
                        float chanceItem = float.Parse(dataItems[i].Trim());

                        if (i == 0)
                        {
                            // add this item to our dictionary
                            damageVal.hitChance = chanceItem;
                        }
                        else if (i == 1)
                        {
                            damageVal.damage = chanceItem;
                        }
                        else
                        {
                            damageVal.critChance = chanceItem;
                        }

                        damageData [tempDamageType] [columnName] = damageVal;
                    }
                }
                // if we are in here, we are in our first row, but we can ignore our first column
                else if (columnIndex != 0 && rowIndex == 0)
                {
                    //Debug.Log ("ROW == 0, COLUMN > 0 : " + column);
                    DAMAGE_TYPE tempDamageType = (DAMAGE_TYPE)Enum.Parse(typeof(DAMAGE_TYPE), column);

                    // add to our list of columns
                    headerColumn.Add(tempDamageType);

                    // create a new dictionary for each item
                    damageData.Add(tempDamageType, new Dictionary <ARMOR_TYPE, Damage> ());
                }
                // otherwise, if we are not in row 0, and we have a column index of 0... get our column name
                else if (columnIndex == 0 && rowIndex != 0)
                {
                    //Debug.Log ("ROW > 0, COLUMN == 0 : " + column);
                    columnName = (ARMOR_TYPE)Enum.Parse(typeof(ARMOR_TYPE), column);

                    // foreach of our header columns, add new dictionary for this armor type
                    foreach (var columnItem in headerColumn)
                    {
                        damageData [columnItem].Add(columnName, new Damage());
                    }
                }


                // update our column number
                columnIndex++;
            }

            // update our line number
            rowIndex++;
        }
    }
Пример #11
0
 public Damage(int val, DAMAGE_TYPE ty)
 {
     value  = new CardAttribute(val);
     emType = ty;
 }