Пример #1
0
    public void Attack(Creature creatureToAttack)
    {
        string stringToWriteToDiscription = "";
        int    attackRoll = GlobalVar.Roll(20) + GetModifier(STATS.STR);//This last part should change depending on what kind of weapon

        stringToWriteToDiscription += "\nYou rolled a " + attackRoll + " vs an armor class of " + creatureToAttack.GetModifier(STATS.ARMOR);
        bool didWeHit = creatureToAttack.GetAttacked(attackRoll);

        //If it succeeds, call our weapons successful attack script which will return damage dealt,
        if (didWeHit)
        {
            int damageDealt = EquippedWeapon.DealDamage();
            creatureToAttack.TakeDamage(damageDealt);
            stringToWriteToDiscription += "\n" + creatureToAttack.name + " took " + damageDealt + " damage.";
        }
        else
        {
            stringToWriteToDiscription += "\nYou missed";
        }
        GlobalVar.FormatText(stringToWriteToDiscription, true);
    }