Changeset 402

Show
Ignore:
Timestamp:
07/28/07 17:56:48 (1 year ago)
Author:
takkaria
Message:

On object inspection screen: (#214)

  • Show breakage chance for arrows
  • Write "you are too weak to use this weapon effectively!" when it is so
  • Fix damage calculations
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/attack.c

    r400 r402  
    2424 * Note that artifacts never break, see the "drop_near()" function. 
    2525 */ 
    26 static int breakage_chance(const object_type *o_ptr) 
     26int breakage_chance(const object_type *o_ptr) 
    2727{ 
    2828        /* Examine the item type */ 
  • trunk/src/externs.h

    r400 r402  
    262262 
    263263/* attack.c */ 
     264extern int breakage_chance(const object_type *o_ptr); 
    264265extern void py_attack(int y, int x); 
    265266extern void do_cmd_fire(void); 
  • trunk/src/obj-info.c

    r399 r402  
    189189        cptr desc[15]; 
    190190        int mult[15]; 
    191         int cnt, dam
     191        int cnt, dam, xtra_dam
    192192        object_type *j_ptr = &inventory[INVEN_BOW]; 
    193193 
     
    199199        if (!weapon && !ammo) return FALSE; 
    200200 
     201 
     202 
    201203        if (weapon) 
    202204        { 
     
    204206 
    205207                dam = (o_ptr->ds * o_ptr->dd * 5); 
    206                 if (object_known_p(o_ptr)) dam += (o_ptr->to_d * 10); 
    207                 dam += (p_ptr->to_d * 10); 
    208  
     208 
     209                xtra_dam = (p_ptr->to_d * 10); 
     210                if (object_known_p(o_ptr)) 
     211                        xtra_dam += (o_ptr->to_d * 10); 
     212 
     213                /* Warn about heavy weapons */ 
     214                if (adj_str_hold[p_ptr->stat_ind[A_STR]] < o_ptr->weight / 10) 
     215                { 
     216                        if (new_paragraph) { text_out("\n\n"); new_paragraph = FALSE; } 
     217                        text_out_c(TERM_L_RED, "You are too weak to use this weapon effectively!  "); 
     218                        blows = 1; 
     219                } 
     220         
    209221            p_text_out("Using this weapon, in your current condition, you are able to score "); 
    210222            text_out_c(TERM_L_GREEN, format("%d ", blows)); 
     
    219231 
    220232                /* Calculate damage */ 
     233                xtra_dam = 0; 
    221234                dam = (o_ptr->ds * o_ptr->dd * 5); 
    222235                if (object_known_p(o_ptr)) dam += (o_ptr->to_d * 10); 
     
    237250                for (i = 0; i < cnt; i++) 
    238251                { 
    239                         text_out_c(TERM_L_GREEN, "%d", (dam * mult[i]) / 10); 
     252                        text_out_c(TERM_L_GREEN, "%d", ((dam * mult[i]) + xtra_dam) / 10); 
    240253                        text_out(" against %s, ", desc[i]); 
    241254                } 
     
    250263 
    251264        text_out(" against normal creatures.  "); 
     265 
     266        /* Add breakage chance */ 
     267        if (ammo) 
     268        { 
     269                text_out("It has a "); 
     270                text_out_c(TERM_L_GREEN, "%d%%", breakage_chance(o_ptr)); 
     271                text_out(" chance of breaking upon contact."); 
     272        } 
    252273 
    253274        /* You always have something to say... */ 
  • trunk/src/xtra1.c

    r399 r402  
    23772377        { 
    23782378                /* Calculate number of blows */ 
    2379                 p_ptr->num_blow = calc_blows(o_ptr) + extra_blows;; 
     2379                p_ptr->num_blow = calc_blows(o_ptr) + extra_blows; 
    23802380 
    23812381                /* Boost digging skill by weapon weight */