00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00022
00023 #include "crogue.h"
00024
00025
00026 char boltchar(sint dx, sint dy)
00027 {
00028 if(dy==0)
00029 return 11;
00030 else if(dx==0)
00031 return 12;
00032 else if(dx==dy)
00033 return 13;
00034 else
00035 return 14;
00036 }
00037
00038
00039 ushort attack_tile(uint x, uint y, const char *str, const char *death_message, uint damage)
00040 {
00041 int monst = monstbytile(x, y);
00042 if(monst >= 0)
00043 {
00044 message(str, retprintf(gettext("the %s"), monstname(monst)));
00045 monst_anger(monst);
00046 monst_takedamage(monst, damage, 0);
00047 return 1;
00048 } else if(x == w->plr.x && y == w->plr.y)
00049 {
00050 message(str, gettext("you"));
00051 plr_takedamage(damage, death_message);
00052 return 1;
00053 } else
00054 {
00055 return 0;
00056 }
00057 }
00058
00059
00060 ushort identify(void)
00061 {
00062 int which;
00063
00064 if(filter_matches(filter_unidentified)==0)
00065 {
00066 message(gettext("You have nothing to identify."));
00067 return 0;
00068 }
00069
00070 message(gettext("Identify what?"));
00071 which = pick_item(filter_unidentified);
00072
00073 if(which<0)
00074 {
00075 message(gettext("You waste the spell."));
00076 return 0;
00077 }
00078
00079 identify_type( INVENTORY(which).type );
00080 INVENTORY(which).flags |= ITEMFLAG_IDENTIFIED;
00081
00082 message("%s.", itemname(&INVENTORY(which)));
00083 return 1;
00084 }
00085
00086
00087
00088 static const stat_timer_desc entangle_timer = {
00089 TIMER_STAT,
00090 {STATMOD_OR, STAT_FLAGS, STAT_FLAG_ENTANGLED},
00091 gettext("You break free of the webs.")
00092 };
00093
00094
00095 void entangle(uint duration)
00096 {
00097 add_timer((timer_desc*)&entangle_timer, duration);
00098 }
00099
00100
00101 static const stat_timer_desc confuse_timer = {
00102 TIMER_STAT,
00103 {STATMOD_OR, STAT_FLAGS, STAT_FLAG_CONFUSED},
00104 gettext("You are no longer confused.")
00105 };
00106
00107
00108 void confuse(uint duration)
00109 {
00110 add_timer((timer_desc*)&confuse_timer, duration);
00111 }
00112
00113
00114 static const stat_timer_desc hallucinate_timer = {
00115 TIMER_STAT,
00116 {STATMOD_OR, STAT_FLAGS, STAT_FLAG_HALLUCINATING},
00117 gettext("You stop hallucinating.")
00118 };
00119
00120
00121 void hallucinate(uint duration)
00122 {
00123 add_timer((timer_desc*)&hallucinate_timer, duration);
00124 }
00125
00126
00127 static const stat_timer_desc paralyzation_timer = {
00128 TIMER_STAT,
00129 {STATMOD_OR, STAT_FLAGS, STAT_FLAG_PARALYZED},
00130 gettext("You can move again.")
00131 };
00132
00133
00134 void paralyze(uint duration)
00135 {
00136 add_timer((timer_desc*)¶lyzation_timer, duration);
00137 }
00138
00139
00140 static const stat_timer_desc darkness_timer = {
00141 TIMER_STAT,
00142 {STATMOD_ADD, STAT_LIGHTRADIUS, -4},
00143 gettext("The area around you is bright again.")
00144 };
00145
00146
00147 void engulf_in_darkness(sint duration)
00148 {
00149 add_timer((timer_desc*)&darkness_timer, duration);
00150 }
00151
00152
00153 static void potion_numbness_effect(void);
00154 static void potion_numbness_expire(void);
00155
00156 static const func_timer_desc numbness_timer = {
00157 TIMER_FUNC,
00158 &potion_numbness_effect,
00159 &potion_numbness_expire
00160 };
00161
00162
00163 void numb(uint duration)
00164 {
00165 add_timer((timer_desc*)&numbness_timer, duration);
00166 }
00167
00168
00169 static void potion_numbness_effect(void)
00170 {
00171 const stat_mod_desc numbness_effect = {STATMOD_OR, STAT_FLAGS, STAT_FLAG_NUMB};
00172 const stat_mod_desc dexterity_effect = {STATMOD_ADD, STAT_DEXTERITY, -5};
00173 apply_stat_mod_desc(NULL, &numbness_effect, 0);
00174 apply_stat_mod_desc(NULL, &dexterity_effect, 0);
00175 }
00176
00177
00178 static void potion_numbness_expire(void)
00179 {
00180 sint hp_deficit;
00181 uint stat_drain;
00182
00183 if(w->plr.hps <= 0)
00184 {
00185 message(gettext(
00186 "You feel excrutiating pain as the feeling returns to your body."
00187 "You have seriously abused your system."));
00188 for(hp_deficit = -w->plr.hps; hp_deficit>0; hp_deficit -= 12)
00189 {
00190 if(RANGE(1, 0))
00191 stat_drain = STAT_STRENGTH;
00192 else
00193 stat_drain = STAT_TOUGHNESS;
00194
00195 w->plr.intrinsic[stat_drain] --;
00196 if(w->plr.intrinsic[stat_drain] <= 0)
00197 die(gettext("Died of system shock."));
00198 }
00199 w->plr.hps = 1;
00200 update_player();
00201 }
00202 else if(w->plr.hps * 4 < w->plr.hps_max)
00203 message(gettext("You feel a sharp pain as the feeling returns to your body."));
00204 else
00205 message(gettext("Feeling returns to your body."));
00206 }
00207
00208
00209
00210 static const stat_timer_desc detect_invis_timer = {
00211 TIMER_STAT,
00212 {STATMOD_OR, STAT_FLAGS, STAT_FLAG_SEEINVIS},
00213 gettext("Your vision darkens.")
00214 };
00215
00216
00217 void detect_invisible(uint duration)
00218 {
00219 add_timer((timer_desc*)&detect_invis_timer, duration);
00220 }
00221
00222
00223
00224 void removecurses(void)
00225 {
00226 int which;
00227
00228 if(filter_matches(filter_cursed)==0)
00229 {
00230 message(gettext("You have nothing to uncurse."));
00231 return;
00232 }
00233 message(gettext("Uncurse which item?"));
00234 which = pick_item(filter_cursed);
00235
00236 if(which<0)
00237 {
00238 message(gettext("You waste the scroll."));
00239 return;
00240 }
00241
00242 if(INVENTORY(which).flags & ITEMFLAG_CURSED)
00243 {
00244 message(gettext("It glows for a moment."));
00245 INVENTORY(which).flags &= ~ITEMFLAG_CURSED;
00246 } else {
00247 message(gettext("Nothing happens."));
00248 }
00249 }
00250
00251
00252 int enchant_item(void)
00253 {
00254 int which;
00255 if(filter_matches(filter_enchantable)==0)
00256 {
00257 message(gettext("You have nothing to enchant."));
00258 return 0;
00259 }
00260 message(gettext("Enchant what?"));
00261 which = pick_item(filter_enchantable);
00262
00263 if(which<0)
00264 {
00265 message(gettext("You waste the scroll."));
00266 return 0;
00267 }
00268
00269 if(ITEMDESC(INVENTORY(which)).flags & ITEMFLAG_CHARGED)
00270 {
00271 message(gettext("The %s glows in white light."), itemname(&INVENTORY(which)));
00272 INVENTORY(which).stacksize += 15;
00273 }
00274 else if(ITEMDESC(INVENTORY(which)).flags & ITEMFLAG_PLUS)
00275 {
00276 if(INVENTORY(which).plus < 2)
00277 INVENTORY(which).plus += RANGE(2,1);
00278 else if(INVENTORY(which).plus < 4)
00279 INVENTORY(which).plus ++;
00280 else if(INVENTORY(which).plus < 6) {
00281 if( RANGE(2,1) == 1 )
00282 INVENTORY(which).plus ++;
00283 else
00284 goto failed_enchant;
00285 } else
00286 goto failed_enchant;
00287 message(gettext("The %s glows in blue light."), itemname(&INVENTORY(which)));
00288 } else {
00289 failed_enchant:
00290 message(gettext("Nothing happens."));
00291 }
00292 update_player();
00293 return 1;
00294 }
00295
00296