Changeset 319
- Timestamp:
- 07/10/07 12:12:46 (2 years ago)
- Files:
-
- trunk/lib/edit/object.txt (modified) (4 diffs)
- trunk/src/effects.c (modified) (3 diffs)
- trunk/src/effects.h (modified) (3 diffs)
- trunk/src/obj-info.c (modified) (3 diffs)
- trunk/src/use-obj.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/edit/object.txt
r318 r319 1244 1244 F:RES_FIRE | IGNORE_FIRE | 1245 1245 F:ACTIVATE 1246 E:RING_FLAMES 1246 1247 1247 1248 N:147:Acid … … 1253 1254 F:RES_ACID | IGNORE_ACID | 1254 1255 F:ACTIVATE 1256 E:RING_ACID 1255 1257 1256 1258 N:148:Ice … … 1262 1264 F:RES_COLD | IGNORE_COLD | 1263 1265 F:ACTIVATE 1266 E:RING_ICE 1264 1267 1265 1268 N:149:Woe … … 3806 3809 A:50/2 3807 3810 F:RES_ELEC | IGNORE_ELEC | ACTIVATE 3811 E:RING_LIGHTNING 3808 3812 3809 3813 ### Items 432-436 unused ### trunk/src/effects.c
r318 r319 19 19 #include "effects.h" 20 20 21 #if 022 21 23 22 /* … … 38 37 #undef MAKE_TABLE 39 38 40 #endif 39 40 /* 41 * Utility functions 42 */ 43 bool effect_aim(int effect) 44 { 45 if (effect < 1 || effect > EF_MAX) 46 return FALSE; 47 48 return effects[effect].aim; 49 } 50 51 const char *effect_desc(int effect) 52 { 53 if (effect < 1 || effect > EF_MAX) 54 return FALSE; 55 56 return effects[effect].desc; 57 } 58 41 59 42 60 … … 529 547 return TRUE; 530 548 } 549 550 case EF_RING_ACID: 551 { 552 fire_ball(GF_ACID, dir, 70, 2); 553 inc_timed(TMD_OPP_ACID, randint(20) + 20); 554 return TRUE; 555 } 556 557 case EF_RING_FLAMES: 558 { 559 fire_ball(GF_FIRE, dir, 80, 2); 560 inc_timed(TMD_OPP_FIRE, randint(20) + 20); 561 o_ptr->timeout = rand_int(50) + 50; 562 return TRUE; 563 } 564 565 case EF_RING_ICE: 566 { 567 fire_ball(GF_COLD, dir, 75, 2); 568 inc_timed(TMD_OPP_COLD, randint(20) + 20); 569 o_ptr->timeout = rand_int(50) + 50; 570 return TRUE; 571 } 572 573 case EF_RING_LIGHTNING: 574 { 575 fire_ball(GF_ELEC, dir, 85, 2); 576 inc_timed(TMD_OPP_ELEC, randint(20) + 20); 577 o_ptr->timeout = rand_int(50) + 50; 578 return TRUE; 579 } 531 580 } 532 581 trunk/src/effects.h
r318 r319 19 19 20 20 /* Function */ 21 extern bool do_effect(object_type *o_ptr, bool *ident, int dir); 21 bool do_effect(object_type *o_ptr, bool *ident, int dir); 22 bool effect_aim(int effect); 23 const char *effect_desc(int effect); 22 24 23 25 … … 27 29 */ 28 30 #if defined(LIST_STRINGS) 29 # define START const char *effect_list[] = {31 # define START static const char *effect_list[] = { 30 32 # define EFFECT(x, y, z) #x, 31 33 # define END }; 32 34 #elif defined(MAKE_TABLE) 33 # define START info_entry effects[] = {35 # define START static const info_entry effects[] = { 34 36 # define EFFECT(x, y, z) { EF_##x, y, z }, 35 37 # define END }; … … 108 110 EFFECT(FOOD_GOOD, FALSE, NULL) 109 111 EFFECT(FOOD_WAYBREAD, FALSE, "restores 4d8 hit points and neutralizes poison") 112 EFFECT(RING_ACID, TRUE, "grants acid resistance for d20+20 turns and creates an acid ball of damage 70") 113 EFFECT(RING_FLAMES, TRUE, "grants fire resistance for d20+20 turns and creates an fire ball of damage 80") 114 EFFECT(RING_ICE, TRUE, "grants cold resistance for d20+20 turns and creates an cold ball of damage 75") 115 EFFECT(RING_LIGHTNING, TRUE, "grants electricity resistance for d20+20 turns and creates an lightning ball of damage 85") 110 116 END 111 117 trunk/src/obj-info.c
r317 r319 17 17 */ 18 18 #include "angband.h" 19 #include "effects.h" 19 20 #include "cmds.h" 20 21 … … 453 454 static bool describe_activation(const object_type *o_ptr, u32b f3) 454 455 { 455 /* Check for the activation flag */ 456 if (f3 & TR3_ACTIVATE) 457 { 458 p_text_out("It activates for "); 459 describe_item_activation(o_ptr); 456 int effect = k_info[o_ptr->k_idx].effect; 457 char temp[] = "x"; 458 459 /* Make sure we have an effect */ 460 if (!k_info[o_ptr->k_idx].effect) 461 { 462 /* Check for the activation flag */ 463 if (f3 & TR3_ACTIVATE) 464 { 465 p_text_out("It activates for "); 466 describe_item_activation(o_ptr); 467 text_out(". "); 468 469 return (TRUE); 470 } 471 } 472 else 473 { 474 const char *desc = effect_desc(effect); 475 if (!desc) return FALSE; 476 477 text_out("When "); 478 479 if (f3 & TR3_ACTIVATE) 480 text_out("activated"); 481 else if (effect_aim(effect)) 482 text_out("aimed"); 483 else if (o_ptr->tval == TV_FOOD || o_ptr->tval == TV_POTION) 484 text_out("ingested"); 485 else if (o_ptr->tval == TV_SCROLL) 486 text_out("read"); 487 else 488 text_out("used"); 489 490 text_out(", it "); 491 492 /* Print a colourised description */ 493 do 494 { 495 temp[0] = *desc; 496 497 if (isdigit((unsigned char) *desc) || isdigit((unsigned char) *(desc + 1))) 498 text_out_c(TERM_L_GREEN, temp); 499 else 500 text_out(temp); 501 } while (*desc++); 502 460 503 text_out(". "); 461 462 return (TRUE);463 504 } 464 505 … … 488 529 p_text_out("It provides nourishment for about "); 489 530 text_out_c(TERM_L_GREEN, "%d", o_ptr->pval / 2); 490 text_out(" turns under normal conditions. ");531 text_out(" turns under normal conditions. "); 491 532 } 492 533 trunk/src/use-obj.c
r318 r319 1714 1714 case SV_DRAGON_MULTIHUED: 1715 1715 { 1716 chance = rand_int(5); 1717 sound( ((chance == 1) ? MSG_BR_ELEC : 1718 ((chance == 2) ? MSG_BR_FROST : 1719 ((chance == 3) ? MSG_BR_ACID : 1720 ((chance == 4) ? MSG_BR_GAS : MSG_BR_FIRE))))); 1721 msg_format("You breathe %s.", 1722 ((chance == 1) ? "lightning" : 1723 ((chance == 2) ? "frost" : 1724 ((chance == 3) ? "acid" : 1725 ((chance == 4) ? "poison gas" : "fire"))))); 1726 fire_ball(((chance == 1) ? GF_ELEC : 1727 ((chance == 2) ? GF_COLD : 1728 ((chance == 3) ? GF_ACID : 1729 ((chance == 4) ? GF_POIS : GF_FIRE)))), 1730 dir, 250, 2); 1716 static const struct 1717 { 1718 int sound; 1719 const char *msg; 1720 int typ; 1721 } mh[] = 1722 { 1723 { MSG_BR_ELEC, "lightning", GF_ELEC }, 1724 { MSG_BR_FROST, "frost", GF_COLD }, 1725 { MSG_BR_ACID, "acid", GF_ACID }, 1726 { MSG_BR_GAS, "poison gas", GF_POIS }, 1727 { MSG_BR_FIRE, "fire", GF_FIRE } 1728 }; 1729 1730 chance = randint(5); 1731 sound(mh[chance].sound); 1732 msg_format("You breathe %s.", mh[chance].msg); 1733 fire_ball(mh[chance].typ, dir, 250, 2); 1731 1734 o_ptr->timeout = rand_int(225) + 225; 1732 1735 break; … … 1818 1821 } 1819 1822 1820 /* Hack -- some Rings can be activated for double resist and element ball */1821 if (o_ptr->tval == TV_RING)1822 {1823 /* Get a direction for firing (or abort) */1824 if (!get_aim_dir(&dir)) return FALSE;1825 1826 /* Branch on the sub-type */1827 switch (o_ptr->sval)1828 {1829 case SV_RING_ACID:1830 {1831 fire_ball(GF_ACID, dir, 70, 2);1832 inc_timed(TMD_OPP_ACID, randint(20) + 20);1833 o_ptr->timeout = rand_int(50) + 50;1834 break;1835 }1836 1837 case SV_RING_FLAMES:1838 {1839 fire_ball(GF_FIRE, dir, 80, 2);1840 inc_timed(TMD_OPP_FIRE, randint(20) + 20);1841 o_ptr->timeout = rand_int(50) + 50;1842 break;1843 }1844 1845 case SV_RING_ICE:1846 {1847 fire_ball(GF_COLD, dir, 75, 2);1848 inc_timed(TMD_OPP_COLD, randint(20) + 20);1849 o_ptr->timeout = rand_int(50) + 50;1850 break;1851 }1852 1853 case SV_RING_LIGHTNING:1854 {1855 fire_ball(GF_ELEC, dir, 85, 2);1856 inc_timed(TMD_OPP_ELEC, randint(20) + 20);1857 o_ptr->timeout = rand_int(50) + 50;1858 break;1859 }1860 }1861 1862 /* Window stuff */1863 p_ptr->window |= (PW_EQUIP);1864 1865 /* Success */1866 return FALSE;1867 }1868 1869 1823 /* Mistake */ 1870 1824 msg_print("Oops. That object cannot be activated."); … … 1927 1881 default: 1928 1882 { 1929 used = activate_object(o_ptr, ident); 1883 if (artifact_p(o_ptr) || o_ptr->tval == TV_DRAG_ARMOR) 1884 used = activate_object(o_ptr, ident); 1885 else 1886 used = do_effect(o_ptr, ident, dir); 1887 1930 1888 break; 1931 1889 } … … 2030 1988 if (o_ptr->tval == TV_RING) 2031 1989 { 2032 /* Branch on the sub-type */ 2033 switch (o_ptr->sval) 2034 { 2035 case SV_RING_ACID: 2036 { 2037 text_out("acid resistance (20+d20 turns) and acid ball (70) every 50+d50 turns"); 2038 break; 2039 } 2040 case SV_RING_FLAMES: 2041 { 2042 text_out("fire resistance (20+d20 turns) and fire ball (80) every 50+d50 turns"); 2043 break; 2044 } 2045 case SV_RING_ICE: 2046 { 2047 text_out("cold resistance (20+d20 turns) and cold ball (75) every 50+d50 turns"); 2048 break; 2049 } 2050 2051 case SV_RING_LIGHTNING: 2052 { 2053 text_out("electricity resistance (20+d20 turns) and electricity ball (85) every 50+d50 turns"); 2054 break; 2055 } 2056 } 1990 text_out(" every 50+d50 turns"); 2057 1991 2058 1992 return;
