Changeset 429

Show
Ignore:
Timestamp:
08/01/07 15:45:01 (1 year ago)
Author:
takkaria
Message:

#317:

  • make slays affect rolled damage, not total damage, like combat
  • transfer slays and brands from the shooter to ammunition. e.g. Cubragol is firebranded
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/edit/artifact.txt

    r428 r429  
    18991899W:50:25:110:50000 
    19001900P:0:0d0:10:14:0 
    1901 F:SPEED | HIDE_TYPE |  
     1901F:SPEED | HIDE_TYPE | BRAND_FIRE | 
    19021902F:RES_FIRE | ACTIVATE | SHOW_MODS 
    1903 A:FIREBRAND:999 
    19041903M:Cubragol glows a deep red... 
    19051904D:A crossbow that grants fiery speed to he who finds it, and from which  
  • trunk/src/attack.c

    r402 r429  
    9999 * Factor in item weight, total plusses, and player level. 
    100100 */ 
    101 int critical_shot(int weight, int plus, int dam) 
     101static int critical_shot(int weight, int plus, int dam) 
    102102{ 
    103103        int i, k; 
     
    138138 * Factor in weapon weight, total plusses, player level. 
    139139 */ 
    140 int critical_norm(int weight, int plus, int dam) 
     140static int critical_norm(int weight, int plus, int dam) 
    141141{ 
    142142        int i, k; 
     
    192192 
    193193/* 
    194  * Extract the "total damage" from a given object hitting a given monster. 
    195  * 
    196  * Note that "flasks of oil" do NOT do fire damage, although they 
    197  * certainly could be made to do so.  XXX XXX 
    198  * 
    199  * Note that most brands and slays are x3, except Slay Animal (x2), 
    200  * Slay Evil (x2), and Kill dragon (x5). 
     194 * Extract the "multiplier" from a given object hitting a given monster. 
     195 * 
     196 * Most brands and slays are x3, except Slay Animal (x2), Slay Evil (x2), 
     197 * and Kill dragon (x5). 
    201198 */ 
    202 int tot_dam_aux(const object_type *o_ptr, int tdam, const monster_type *m_ptr) 
     199static int tot_dam_aux(const object_type *o_ptr, const monster_type *m_ptr) 
    203200{ 
    204201        int mult = 1; 
     
    212209        object_flags(o_ptr, &f1, &f2, &f3); 
    213210 
    214         /* Some "weapons" and "ammo" do extra damage */ 
    215         switch (o_ptr->tval) 
    216         { 
    217                 case TV_SHOT: 
    218                 case TV_ARROW: 
    219                 case TV_BOLT: 
    220                 case TV_HAFTED: 
    221                 case TV_POLEARM: 
    222                 case TV_SWORD: 
    223                 case TV_DIGGING: 
    224                 { 
    225                         /* Slay Animal */ 
    226                         if ((f1 & (TR1_SLAY_ANIMAL)) && 
    227                             (r_ptr->flags3 & (RF3_ANIMAL))) 
    228                         { 
    229                                 if (m_ptr->ml) 
    230                                 { 
    231                                         l_ptr->flags3 |= (RF3_ANIMAL); 
    232                                 } 
    233  
    234                                 if (mult < 2) mult = 2; 
    235                         } 
    236  
    237                         /* Slay Evil */ 
    238                         if ((f1 & (TR1_SLAY_EVIL)) && 
    239                             (r_ptr->flags3 & (RF3_EVIL))) 
    240                         { 
    241                                 if (m_ptr->ml) 
    242                                 { 
    243                                         l_ptr->flags3 |= (RF3_EVIL); 
    244                                 } 
    245  
    246                                 if (mult < 2) mult = 2; 
    247                         } 
    248  
    249                         /* Slay Undead */ 
    250                         if ((f1 & (TR1_SLAY_UNDEAD)) && 
    251                             (r_ptr->flags3 & (RF3_UNDEAD))) 
    252                         { 
    253                                 if (m_ptr->ml) 
    254                                 { 
    255                                         l_ptr->flags3 |= (RF3_UNDEAD); 
    256                                 } 
    257  
    258                                 if (mult < 3) mult = 3; 
    259                         } 
    260  
    261                         /* Slay Demon */ 
    262                         if ((f1 & (TR1_SLAY_DEMON)) && 
    263                             (r_ptr->flags3 & (RF3_DEMON))) 
    264                         { 
    265                                 if (m_ptr->ml) 
    266                                 { 
    267                                         l_ptr->flags3 |= (RF3_DEMON); 
    268                                 } 
    269  
    270                                 if (mult < 3) mult = 3; 
    271                         } 
    272  
    273                         /* Slay Orc */ 
    274                         if ((f1 & (TR1_SLAY_ORC)) && 
    275                             (r_ptr->flags3 & (RF3_ORC))) 
    276                         { 
    277                                 if (m_ptr->ml) 
    278                                 { 
    279                                         l_ptr->flags3 |= (RF3_ORC); 
    280                                 } 
    281  
    282                                 if (mult < 3) mult = 3; 
    283                         } 
    284  
    285                         /* Slay Troll */ 
    286                         if ((f1 & (TR1_SLAY_TROLL)) && 
    287                             (r_ptr->flags3 & (RF3_TROLL))) 
    288                         { 
    289                                 if (m_ptr->ml) 
    290                                 { 
    291                                         l_ptr->flags3 |= (RF3_TROLL); 
    292                                 } 
    293  
    294                                 if (mult < 3) mult = 3; 
    295                         } 
    296  
    297                         /* Slay Giant */ 
    298                         if ((f1 & (TR1_SLAY_GIANT)) && 
    299                             (r_ptr->flags3 & (RF3_GIANT))) 
    300                         { 
    301                                 if (m_ptr->ml) 
    302                                 { 
    303                                         l_ptr->flags3 |= (RF3_GIANT); 
    304                                 } 
    305  
    306                                 if (mult < 3) mult = 3; 
    307                         } 
    308  
    309                         /* Slay Dragon */ 
    310                         if ((f1 & (TR1_SLAY_DRAGON)) && 
    311                             (r_ptr->flags3 & (RF3_DRAGON))) 
    312                         { 
    313                                 if (m_ptr->ml) 
    314                                 { 
    315                                         l_ptr->flags3 |= (RF3_DRAGON); 
    316                                 } 
    317  
    318                                 if (mult < 3) mult = 3; 
    319                         } 
    320  
    321                         /* Execute Dragon */ 
    322                         if ((f1 & (TR1_KILL_DRAGON)) && 
    323                             (r_ptr->flags3 & (RF3_DRAGON))) 
    324                         { 
    325                                 if (m_ptr->ml) 
    326                                 { 
    327                                         l_ptr->flags3 |= (RF3_DRAGON); 
    328                                 } 
    329  
    330                                 if (mult < 5) mult = 5; 
    331                         } 
    332  
    333                         /* Execute demon */ 
    334                         if ((f1 & (TR1_KILL_DEMON)) && 
    335                             (r_ptr->flags3 & (RF3_DEMON))) 
    336                         { 
    337                                 if (m_ptr->ml) 
    338                                 { 
    339                                         l_ptr->flags3 |= (RF3_DEMON); 
    340                                 } 
    341  
    342                                 if (mult < 5) mult = 5; 
    343                         } 
    344  
    345                         /* Execute undead */ 
    346                         if ((f1 & (TR1_KILL_UNDEAD)) && 
    347                             (r_ptr->flags3 & (RF3_UNDEAD))) 
    348                         { 
    349                                 if (m_ptr->ml) 
    350                                 { 
    351                                         l_ptr->flags3 |= (RF3_UNDEAD); 
    352                                 } 
    353  
    354                                 if (mult < 5) mult = 5; 
    355                         } 
    356  
    357                         /* Brand (Acid) */ 
    358                         if (f1 & (TR1_BRAND_ACID)) 
    359                         { 
    360                                 /* Notice immunity */ 
    361                                 if (r_ptr->flags3 & (RF3_IM_ACID)) 
    362                                 { 
    363                                         if (m_ptr->ml) 
    364                                         { 
    365                                                 l_ptr->flags3 |= (RF3_IM_ACID); 
    366                                         } 
    367                                 } 
    368  
    369                                 /* Otherwise, take the damage */ 
    370                                 else 
    371                                 { 
    372                                         if (mult < 3) mult = 3; 
    373                                 } 
    374                         } 
    375  
    376                         /* Brand (Elec) */ 
    377                         if (f1 & (TR1_BRAND_ELEC)) 
    378                         { 
    379                                 /* Notice immunity */ 
    380                                 if (r_ptr->flags3 & (RF3_IM_ELEC)) 
    381                                 { 
    382                                         if (m_ptr->ml) 
    383                                         { 
    384                                                 l_ptr->flags3 |= (RF3_IM_ELEC); 
    385                                         } 
    386                                 } 
    387  
    388                                 /* Otherwise, take the damage */ 
    389                                 else 
    390                                 { 
    391                                         if (mult < 3) mult = 3; 
    392                                 } 
    393                         } 
    394  
    395                         /* Brand (Fire) */ 
    396                         if (f1 & (TR1_BRAND_FIRE)) 
    397                         { 
    398                                 /* Notice immunity */ 
    399                                 if (r_ptr->flags3 & (RF3_IM_FIRE)) 
    400                                 { 
    401                                         if (m_ptr->ml) 
    402                                         { 
    403                                                 l_ptr->flags3 |= (RF3_IM_FIRE); 
    404                                         } 
    405                                 } 
    406  
    407                                 /* Otherwise, take the damage */ 
    408                                 else 
    409                                 { 
    410                                         if (mult < 3) mult = 3; 
    411                                 } 
    412                         } 
    413  
    414                         /* Brand (Cold) */ 
    415                         if (f1 & (TR1_BRAND_COLD)) 
    416                         { 
    417                                 /* Notice immunity */ 
    418                                 if (r_ptr->flags3 & (RF3_IM_COLD)) 
    419                                 { 
    420                                         if (m_ptr->ml) 
    421                                         { 
    422                                                 l_ptr->flags3 |= (RF3_IM_COLD); 
    423                                         } 
    424                                 } 
    425  
    426                                 /* Otherwise, take the damage */ 
    427                                 else 
    428                                 { 
    429                                         if (mult < 3) mult = 3; 
    430                                 } 
    431                         } 
    432  
    433                         /* Brand (Poison) */ 
    434                         if (f1 & (TR1_BRAND_POIS)) 
    435                         { 
    436                                 /* Notice immunity */ 
    437                                 if (r_ptr->flags3 & (RF3_IM_POIS)) 
    438                                 { 
    439                                         if (m_ptr->ml) 
    440                                         { 
    441                                                 l_ptr->flags3 |= (RF3_IM_POIS); 
    442                                         } 
    443                                 } 
    444  
    445                                 /* Otherwise, take the damage */ 
    446                                 else 
    447                                 { 
    448                                         if (mult < 3) mult = 3; 
    449                                 } 
    450                         } 
    451  
    452                         break; 
    453                 } 
    454         } 
    455  
    456  
    457         /* Return the total damage */ 
    458         return (tdam * mult); 
     211 
     212        /* Slay Animal */ 
     213        if ((f1 & TR1_SLAY_ANIMAL) && (r_ptr->flags3 & RF3_ANIMAL)) 
     214        { 
     215                if (m_ptr->ml) 
     216                        l_ptr->flags3 |= (RF3_ANIMAL); 
     217 
     218                if (mult < 2) mult = 2; 
     219        } 
     220 
     221        /* Slay Evil */ 
     222        if ((f1 & TR1_SLAY_EVIL) && (r_ptr->flags3 & RF3_EVIL)) 
     223        { 
     224                if (m_ptr->ml) 
     225                        l_ptr->flags3 |= (RF3_EVIL); 
     226 
     227                if (mult < 2) mult = 2; 
     228        } 
     229 
     230        /* Slay Undead */ 
     231        if ((f1 & TR1_SLAY_UNDEAD) && (r_ptr->flags3 & RF3_UNDEAD)) 
     232        { 
     233                if (m_ptr->ml) 
     234                        l_ptr->flags3 |= (RF3_UNDEAD); 
     235 
     236                if (mult < 3) mult = 3; 
     237        } 
     238 
     239        /* Slay Demon */ 
     240        if ((f1 & TR1_SLAY_DEMON) && (r_ptr->flags3 & RF3_DEMON)) 
     241        { 
     242                if (m_ptr->ml) 
     243                        l_ptr->flags3 |= (RF3_DEMON); 
     244 
     245                if (mult < 3) mult = 3; 
     246        } 
     247 
     248        /* Slay Orc */ 
     249        if ((f1 & TR1_SLAY_ORC) && (r_ptr->flags3 & RF3_ORC)) 
     250        { 
     251                if (m_ptr->ml) 
     252                        l_ptr->flags3 |= (RF3_ORC); 
     253 
     254                if (mult < 3) mult = 3; 
     255        } 
     256 
     257        /* Slay Troll */ 
     258        if ((f1 & TR1_SLAY_TROLL) && (r_ptr->flags3 & RF3_TROLL)) 
     259        { 
     260                if (m_ptr->ml) 
     261                        l_ptr->flags3 |= (RF3_TROLL); 
     262 
     263                if (mult < 3) mult = 3; 
     264        } 
     265 
     266        /* Slay Giant */ 
     267        if ((f1 & TR1_SLAY_GIANT) && (r_ptr->flags3 & RF3_GIANT)) 
     268        { 
     269                if (m_ptr->ml) 
     270                        l_ptr->flags3 |= (RF3_GIANT); 
     271 
     272                if (mult < 3) mult = 3; 
     273        } 
     274 
     275        /* Slay Dragon */ 
     276        if ((f1 & TR1_SLAY_DRAGON) && (r_ptr->flags3 & RF3_DRAGON)) 
     277        { 
     278                if (m_ptr->ml) 
     279                        l_ptr->flags3 |= (RF3_DRAGON); 
     280 
     281                if (mult < 3) mult = 3; 
     282        } 
     283 
     284        /* Execute Dragon */ 
     285        if ((f1 & TR1_KILL_DRAGON) && (r_ptr->flags3 & RF3_DRAGON)) 
     286        { 
     287                if (m_ptr->ml) 
     288                        l_ptr->flags3 |= (RF3_DRAGON); 
     289 
     290                if (mult < 5) mult = 5; 
     291        } 
     292 
     293        /* Execute demon */ 
     294        if ((f1 & TR1_KILL_DEMON) && (r_ptr->flags3 & RF3_DEMON)) 
     295        { 
     296                if (m_ptr->ml) 
     297                        l_ptr->flags3 |= (RF3_DEMON); 
     298 
     299                if (mult < 5) mult = 5; 
     300        } 
     301 
     302        /* Execute undead */ 
     303        if ((f1 & TR1_KILL_UNDEAD) && (r_ptr->flags3 & RF3_UNDEAD)) 
     304        { 
     305                if (m_ptr->ml) 
     306                        l_ptr->flags3 |= (RF3_UNDEAD); 
     307 
     308                if (mult < 5) mult = 5; 
     309        } 
     310 
     311        /* Brand (Acid) */ 
     312        if (f1 & (TR1_BRAND_ACID)) 
     313        { 
     314                /* Notice immunity */ 
     315                if (r_ptr->flags3 & (RF3_IM_ACID)) 
     316                { 
     317                        if (m_ptr->ml) 
     318                                l_ptr->flags3 |= (RF3_IM_ACID); 
     319                } 
     320 
     321                /* Otherwise, take the damage */ 
     322                else 
     323                { 
     324                        if (mult < 3) mult = 3; 
     325                } 
     326        } 
     327 
     328        /* Brand (Elec) */ 
     329        if (f1 & (TR1_BRAND_ELEC)) 
     330        { 
     331                /* Notice immunity */ 
     332                if (r_ptr->flags3 & (RF3_IM_ELEC)) 
     333                { 
     334                        if (m_ptr->ml) 
     335                                l_ptr->flags3 |= (RF3_IM_ELEC); 
     336                } 
     337 
     338                /* Otherwise, take the damage */ 
     339                else 
     340                { 
     341                        if (mult < 3) mult = 3; 
     342                } 
     343        } 
     344 
     345        /* Brand (Fire) */ 
     346        if (f1 & (TR1_BRAND_FIRE)) 
     347        { 
     348                /* Notice immunity */ 
     349                if (r_ptr->flags3 & (RF3_IM_FIRE)) 
     350                { 
     351                        if (m_ptr->ml) 
     352                                l_ptr->flags3 |= (RF3_IM_FIRE); 
     353                } 
     354 
     355                /* Otherwise, take the damage */ 
     356                else 
     357                { 
     358                        if (mult < 3) mult = 3; 
     359                } 
     360        } 
     361 
     362        /* Brand (Cold) */ 
     363        if (f1 & (TR1_BRAND_COLD)) 
     364        { 
     365                /* Notice immunity */ 
     366                if (r_ptr->flags3 & (RF3_IM_COLD)) 
     367                { 
     368                        if (m_ptr->ml) 
     369                                l_ptr->flags3 |= (RF3_IM_COLD); 
     370                } 
     371 
     372                /* Otherwise, take the damage */ 
     373                else 
     374                { 
     375                        if (mult < 3) mult = 3; 
     376                } 
     377        } 
     378 
     379        /* Brand (Poison) */ 
     380        if (f1 & (TR1_BRAND_POIS)) 
     381        { 
     382                /* Notice immunity */ 
     383                if (r_ptr->flags3 & (RF3_IM_POIS)) 
     384                { 
     385                        if (m_ptr->ml) 
     386                                l_ptr->flags3 |= (RF3_IM_POIS); 
     387                } 
     388 
     389                /* Otherwise, take the damage */ 
     390                else 
     391                { 
     392                        if (mult < 3) mult = 3; 
     393                } 
     394        } 
     395 
     396 
     397        /* Return the multiplier */ 
     398        return (mult); 
    459399} 
    460400 
     
    543483                        { 
    544484                                k = damroll(o_ptr->dd, o_ptr->ds); 
    545                                 k = tot_dam_aux(o_ptr, k, m_ptr); 
     485                                k *= tot_dam_aux(o_ptr, m_ptr); 
    546486                                if (p_ptr->impact && (k > 50)) do_quake = TRUE; 
    547487                                k = critical_norm(o_ptr->weight, o_ptr->to_h, k); 
     
    625565 * You may only fire items that "match" your missile launcher. 
    626566 * 
    627  * You must use slings + pebbles/shots, bows + arrows, xbows + bolts. 
    628  * 
    629567 * See "calc_bonuses()" for more calculations and such. 
    630568 * 
     
    636574 * 
    637575 * Rangers (with Bows) and Anyone (with "Extra Shots") get extra shots. 
    638  * 
    639576 * The "extra shot" code works by decreasing the amount of energy 
    640577 * required to make each shot, spreading the shots out over time. 
     
    645582 * Note that Bows of "Extra Might" get extra range and an extra bonus 
    646583 * for the damage multiplier. 
    647  * 
    648  * Note that Bows of "Extra Shots" give an extra shot. 
    649584 */ 
    650585void do_cmd_fire(void) 
     
    750685        thits = p_ptr->num_fire; 
    751686 
    752         /* Base damage from thrown object plus launcher bonus */ 
    753         tdam = damroll(i_ptr->dd, i_ptr->ds) + i_ptr->to_d + j_ptr->to_d; 
    754  
    755687        /* Actually "fire" the object */ 
    756688        bonus = (p_ptr->to_h + i_ptr->to_h + j_ptr->to_h); 
    757689        chance = (p_ptr->skills[SKILL_THB] + (bonus * BTH_PLUS_ADJ)); 
    758690 
     691        /* Base damage from thrown object plus launcher bonus */ 
     692        tdam = damroll(i_ptr->dd, i_ptr->ds); 
     693 
    759694        /* Assume a base multiplier */ 
    760695        tmul = p_ptr->ammo_mult; 
    761  
    762         /* Boost the damage */ 
    763         tdam *= tmul; 
    764696 
    765697        /* Base range XXX XXX */ 
     
    839771 
    840772                        int visible = m_ptr->ml; 
     773 
     774                        int ammo_mult = tot_dam_aux(i_ptr, m_ptr); 
     775                        int shoot_mult = tot_dam_aux(j_ptr, m_ptr); 
    841776 
    842777                        /* Note the collision */ 
     
    887822                                } 
    888823 
    889                                 /* Apply special damage XXX XXX XXX */ 
    890                                 tdam = tot_dam_aux(i_ptr, tdam, m_ptr); 
     824                                /* Apply damage: multiplier, slays, criticals, bonuses */ 
     825                                tdam *= MAX(ammo_mult, shoot_mult); 
     826                                tdam += i_ptr->to_d + j_ptr->to_d; 
     827                                tdam *= tmul; 
    891828                                tdam = critical_shot(i_ptr->weight, i_ptr->to_h, tdam); 
    892829 
     
    11741111 
    11751112                                /* Apply special damage XXX XXX XXX */ 
    1176                                 tdam = tot_dam_aux(i_ptr, tdam, m_ptr); 
     1113                                tdam *= tot_dam_aux(i_ptr, m_ptr); 
    11771114                                tdam = critical_shot(i_ptr->weight, i_ptr->to_h, tdam); 
    11781115 
  • trunk/src/externs.h

    r421 r429  
    261261/* attack.c */ 
    262262extern int breakage_chance(const object_type *o_ptr); 
     263extern bool test_hit(int chance, int ac, int vis); 
    263264extern void py_attack(int y, int x); 
    264265extern void do_cmd_fire(void); 
     
    303304 
    304305/* cmd1.c */ 
    305 extern bool test_hit(int chance, int ac, int vis); 
    306 extern int critical_shot(int weight, int plus, int dam); 
    307 extern int critical_norm(int weight, int plus, int dam); 
    308 extern int tot_dam_aux(const object_type *o_ptr, int tdam, const monster_type *m_ptr); 
    309306extern void search(void); 
    310307extern byte py_pickup(int pickup); 
  • trunk/src/obj-info.c

    r420 r429  
    233233                /* Calculate damage */ 
    234234                dam = (o_ptr->ds * o_ptr->dd * 5); 
    235                 if (object_known_p(o_ptr)) dam += (o_ptr->to_d * 10); 
    236                 if (object_known_p(j_ptr)) dam += (j_ptr->to_d * 10); 
    237                 dam *= p_ptr->ammo_mult; 
     235                if (object_known_p(o_ptr)) xtra_dam += (o_ptr->to_d * 10); 
     236                if (object_known_p(j_ptr)) xtra_dam += (j_ptr->to_d * 10); 
     237                xtra_dam *= p_ptr->ammo_mult; 
     238                xtra_dam += (dam * 2); 
    238239 
    239240                p_text_out("Fired from your current bow, this arrow will hit targets up to ");