Exemple #1
0
    public virtual void ReceiveAttack(int hitRoll, int damage, int damageType = 0)
    {
        if (!IsDead)
        {
            int result = hitRoll - Stats.Defense;

            if (result > 50)
            {
                //Hit!
                Stats.CurrentHP -= damage;
                Animator.OnHit();
                CombatLog.Hit(CharacterName, damage);
            }
            else
            {
                CombatLog.Miss();
            }

            if (Stats.CurrentHP <= 0)
            {
                Die();
            }
        }
    }