Changeset 682

Show
Ignore:
Timestamp:
02/01/08 05:59:24 (7 months ago)
Author:
takkaria
Message:

Clean up a bit of the armour/weapon bonus code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/obj-make.c

    r681 r682  
    498498        int todam1 = randint(5) + m_bonus(5, level); 
    499499 
    500         int tohit2 = m_bonus(10, level); 
    501         int todam2 = m_bonus(10, level); 
    502  
    503  
    504         /* Good */ 
    505         if (power > 0) 
    506         { 
    507                 /* Enchant */ 
     500        int tohit2 = tohit1 + m_bonus(10, level); 
     501        int todam2 = todam2 + m_bonus(10, level); 
     502 
     503 
     504        if (power == -2) 
     505        { 
     506                o_ptr->to_h -= tohit2; 
     507                o_ptr->to_d -= todam2; 
     508        } 
     509        else if (power == -1) 
     510        { 
     511                o_ptr->to_h -= tohit1; 
     512                o_ptr->to_d -= todam1; 
     513        } 
     514        else if (power == 1) 
     515        { 
    508516                o_ptr->to_h += tohit1; 
    509517                o_ptr->to_d += todam1; 
    510  
    511                 /* Very good */ 
    512                 if (power > 1) 
    513                 { 
    514                         /* Enchant again */ 
    515                         o_ptr->to_h += tohit2; 
    516                         o_ptr->to_d += todam2; 
    517                 } 
    518         } 
    519  
    520         /* Cursed */ 
    521         else if (power < 0) 
    522         { 
    523                 /* Penalize */ 
    524                 o_ptr->to_h -= tohit1; 
    525                 o_ptr->to_d -= todam1; 
    526  
    527                 /* Very cursed */ 
    528                 if (power < -1) 
    529                 { 
    530                         /* Penalize again */ 
    531                         o_ptr->to_h -= tohit2; 
    532                         o_ptr->to_d -= todam2; 
    533                 } 
     518        } 
     519        else if (power == 2) 
     520        { 
     521                o_ptr->to_h += tohit2; 
     522                o_ptr->to_d += todam2; 
    534523        } 
    535524 
     
    605594 
    606595/* 
    607  * Apply magic to an item known to be "armor" 
    608  * 
    609  * Hack -- note special processing for crown/helm 
    610  * Hack -- note special processing for robe of permanence 
     596 * Apply magic to armour 
    611597 */ 
    612598static void a_m_aux_2(object_type *o_ptr, int level, int power) 
    613599{ 
    614600        int toac1 = randint(5) + m_bonus(5, level); 
    615  
    616601        int toac2 = m_bonus(10, level); 
    617602 
    618603 
    619         /* Good */ 
    620         if (power > 0) 
    621         { 
    622                 /* Enchant */ 
     604        if (power == -2) 
     605                o_ptr->to_a -= toac1 + toac2; 
     606        else if (power == -1) 
     607                o_ptr->to_a -= toac1; 
     608        else if (power == 1) 
    623609                o_ptr->to_a += toac1; 
    624  
    625                 /* Very good */ 
    626                 if (power > 1) 
    627                 { 
    628                         /* Enchant again */ 
    629                         o_ptr->to_a += toac2; 
    630                 } 
    631         } 
    632  
    633         /* Cursed */ 
    634         else if (power < 0) 
    635         { 
    636                 /* Penalize */ 
    637                 o_ptr->to_a -= toac1; 
    638  
    639                 /* Very cursed */ 
    640                 if (power < -1) 
    641                 { 
    642                         /* Penalize again */ 
    643                         o_ptr->to_a -= toac2; 
    644                 } 
    645         } 
     610        else if (power == 2) 
     611                o_ptr->to_a += toac1 + toac2; 
    646612 
    647613