コード例 #1
0
ファイル: Creature.cs プロジェクト: brewsterl/berserker
        /// <summary>
        /// Gets how much damage to be done to this creature based on
        /// the attacking creature's stats.
        /// </summary>
        /// <param name="attacker">The creature attacking.</param>
        /// <returns>The damage amount if > 0 or PUFF/SPARK constants 
        /// otherwise.</returns>
        public int GetDamageAmt(Creature attacker)
        {
            int atkValue = attacker.GetAtkValue();
            int shieldValue = this.GetShieldValue();
            int netValue = atkValue - shieldValue;

            if (netValue > 0) {
                return netValue;
            } else if (netValue == 0) {
                return Constants.SPARK;
            } else {
                return Constants.PUFF;
            }
        }