- [+] remove enchantment school

- [+] remove gravity school (move to "air")
- [+] mud should eventually dry out (but take 50 turns or so)
- [+] bug: " [@=stats Effects Items gic ?=describe ESC=quit]"
- [+] allow '?' from askgod() prompt.
- [+] when hecta changes you to a vampire:
    - [+] don't change your hp!
    - [+] don't chance your stats ?
- [+] add ?j for job descriptions
- [+] wrapprint: when caling line length, use modified strlen to ignore
      ^c or ^num
- [+] extra info in makedesc_job:
    - [+] Attrib mods:
        - [+] Strength: very high
        - [+] IQ: Low
    - [+] Alignment:  Neutral  OR Good/Evil etc, or ANY
    - [+] starting skills: x, x, x, x, x, x
- [+] changes to paladin
    - [+] cannot cast spells if using cursed weapon/armour
- [+] get rid of skillcheck to learn a new spell.
- [+] cyclonic shield should also damage attackers.
- [+] ^F#_#^? releases a cloud of red spores
- [+] ragefungus bug
    - [+] "you are too tired to do that right now"
    - [+] move this check out into useability.
    - [+] test that minotaur still uses charge. (which costs stamina)
- [+] force sphere not working! fiexd, needed to limit "radius" to 1
      minimum. also added animation.
- [+] reduce max jolt power to 5.
- [+] change initial sky wizard spell to jolt
This commit is contained in:
Rob Pearce 2012-02-27 08:27:55 +00:00
parent ff13f25bb9
commit afb0d30b23
13 changed files with 837 additions and 501 deletions

205
data.c
View File

@ -752,7 +752,6 @@ void initjobs(void) {
addflag(lastjob->flags, F_CANLEARN, SK_TWOWEAPON, PR_EXPERT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_UNARMED, PR_EXPERT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SS_DIVINATION, PR_ADEPT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SS_GRAVITY, PR_BEGINNER, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SS_MODIFICATION, PR_BEGINNER, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SS_MENTAL, PR_BEGINNER, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SS_TRANSLOCATION, PR_ADEPT, NA, NULL);
@ -848,10 +847,8 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTSKILL, SK_SS_AIR, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_DEATH, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_DIVINATION, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_ENCHANTMENT, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_FIRE, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_COLD, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_GRAVITY, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_MODIFICATION, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_SUMMONING, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_TRANSLOCATION, PR_NOVICE, NA, NULL);
@ -2713,7 +2710,6 @@ void initobjects(void) {
// l2
addot(OT_S_BLINDNESS, "blindness", "Temporarily blinds the target.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines resistability and duration.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
@ -2728,7 +2724,6 @@ void initobjects(void) {
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addot(OT_S_FEAR, "cause fear", "Causes intense fear in the target.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines resistability and duration.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_MENTAL, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
@ -2774,7 +2769,6 @@ void initobjects(void) {
addflag(lastot->flags, F_PLEASESGOD, R_GODDEATH, 3, NA, NULL);
addot(OT_S_PAIN, "pain", "Causes extreme pain in the target whenever they move.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines the duration of the pain effect.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
@ -2784,7 +2778,6 @@ void initobjects(void) {
// l4
addot(OT_S_CURSE, "curse", "Bestow a curse upon the target's equipment, applying a -1 penalty and making them impossible to remove.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines how many objects will be cursed.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
@ -2798,7 +2791,6 @@ void initobjects(void) {
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addot(OT_S_WEAKEN, "weaken", "Temporarily lowers the target's muscle strength by ^bpower^n points.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines the duration of the weakness effect.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
@ -2806,7 +2798,6 @@ void initobjects(void) {
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addflag(lastot->flags, F_PLEASESGOD, R_GODDEATH, 4, NA, NULL);
addot(OT_S_PARALYZE, "paralyze", "Disables the target's muscles, leaving them unable to move for ^bpower*2^n turns.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
@ -2815,7 +2806,6 @@ void initobjects(void) {
addflag(lastot->flags, F_PLEASESGOD, R_GODDEATH, 4, NA, NULL);
addot(OT_S_FEEBLEMIND, "brain freeze", "Temporarily lowers the target's intelligence to that of an animal.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines duration.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_MENTAL, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
@ -2926,20 +2916,17 @@ void initobjects(void) {
addflag(lastot->flags, F_SPELLSCHOOL, SS_DIVINATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 6, NA, NA, NULL);
///////////////////
// enchantment
///////////////////
// l7
addot(OT_S_ENCHANT, "enhancement", "Magically enhances a weapon or piece of armour.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 6, NA, NA, NULL);
// TODO: hardcode how ai casts this spell
///////////////////
// elemental - air
///////////////////
// l1
addot(OT_S_TRUESTRIKE, "weapon attraction", "Wind currents gives the target unerring accuracy, making their attacks always hit and negating strength penalties.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines the amount of strikes before it expires.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 1, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
addot(OT_S_MIST, "pea soup", "Envelops the area directly ahead of the caster with a thick cloud of mist.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines how long the mist will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
@ -2957,13 +2944,19 @@ void initobjects(void) {
addot(OT_S_JOLT, "jolt", "Jolts an adjacent enemy with a short pulse of electricity, dealing 1-^bpower^n damage.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 1, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 10, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 5, NA, NA, NULL);
addflag(lastot->flags, F_RANGE, 1, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_FALSE, LOF_NEED, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_ADJVICTIM, NA, NA, NULL);
// l2
addot(OT_S_GRAVLOWER, "lessen gravity", "Lessens the weight of the caster's items. Also causes the caster to fall very slowly.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Each power level will reduce caster's load by 15kg.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addot(OT_S_GUSTOFWIND, "gust of wind", "Causes a gust of wind to blow up to ^bpower^n of the target's objects away.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, 1, NA, NA, "The chance of each object blowing away is determined by the spell's power.");
addflag(lastot->flags, F_EXTRADESC, 2, NA, NA, "This spell's power is boosted when cast outside.");
@ -2977,7 +2970,6 @@ void initobjects(void) {
addot(OT_S_SHATTER, "shatter", "Instantly shatters all glass in the target location.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_COLD, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_OBJECT, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
@ -2990,6 +2982,11 @@ void initobjects(void) {
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addot(OT_S_WHATGOESUP, "what goes up", "...must come down. Thrown or fired missiles will return to the caster's hands if not destroyed.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
// l3
addot(OT_S_AIRBLAST, "airblast", "Knocks enemies back with a powerful blast of air.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "This spell's power determines how far objects or enemies will be knocked back.");
@ -2998,7 +2995,7 @@ void initobjects(void) {
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_VICTIM, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_NEED, NA, NULL);
addot(OT_S_WINDSHIELD, "cyclonic shield", "Surrounds the caster with a whirling cyclone to repel missiles.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addot(OT_S_WINDSHIELD, "cyclonic shield", "Surrounds the caster with a whirling cyclone, dealing 1-^Wpower^n damage to attackers and repelling missiles.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines the speed of missile which can be repelled.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
@ -3006,6 +3003,18 @@ void initobjects(void) {
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_SELF, NA, NA, NULL);
addot(OT_S_SLOW, "slowness", "Causes the air around the target to thicken to a water-like consistency, greatly decreasing their speed.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines how long the slowness will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_VICTIM, NA, NA, NULL);
addot(OT_S_FORCESPHERE, "force sphere", "Radiates a shock wave out from the caster, knocking opponents away.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines the radius of the blast (1 - 3 cells).");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_ADJSELF, NA, NA, NULL);
// l4
addot(OT_S_CLOUDKILL, "cloudkill", "Creates a cloud of poisonous gas. The cloud's size is 1-3 cells, depending on the spell power.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
@ -3013,6 +3022,31 @@ void initobjects(void) {
addflag(lastot->flags, F_LOSLOF, B_FALSE, LOF_NEED, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addot(OT_S_EQANDOP, "equal and opposite", "Causes the caster to emit strong currents of air in all directions, repelling all missiles in a direct path back to their source.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addot(OT_S_GRAVBOOST, "boost gravity", "Greatly increases gravity around the target, preventing them from moving.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines how long its effects will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addot(OT_S_LEVITATION, "levitation", "Causes the caster hover a metre above the ground.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
// l5
addot(OT_S_CHAINLIGHTNING, "chain lightning", "Electricity arcs up to 5 times between all nearby enemies. The initial arc deals 3d6 damage, the next deals 3d5 damage, etc.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's range is based on its power.");
@ -3021,6 +3055,20 @@ void initobjects(void) {
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_NEED, NA, NULL);
addot(OT_S_HASTE, "haste", "Increases the speed of the target.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines how long its effects will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 5, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_ALLY, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
// l6
addot(OT_S_FLIGHT, "fly", "Allows the caster to fly.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 6, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
///////////////////
// elemental - fire magic
///////////////////
@ -3055,7 +3103,6 @@ void initobjects(void) {
addot(OT_S_BLADEBURN, "bladeburn", "Ignites the caster's weapon, causing it to temporarily deal fire damage. The spell's power determines how long it will last.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines its duration.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_FIRE, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
@ -3166,7 +3213,6 @@ void initobjects(void) {
addflag(lastot->flags, F_NORANDOM, B_TRUE, NA, NA, NULL);
addot(OT_S_ICECRUST, "ice crust", "Encrusts your weapon with a layer of sharp ice.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines how long the enchantment will remain.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_COLD, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_ALLY, NA, NA, NULL);
@ -3279,7 +3325,6 @@ void initobjects(void) {
addflag(lastot->flags, F_TARGETTEDSPELL, TT_OBJECT, 3, 3, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 1, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 3, NA, NA, NULL);
addflag(lastot->flags, F_PLEASESGOD, R_GODNATURE, 1, NA, NULL);
@ -3291,7 +3336,6 @@ void initobjects(void) {
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
// l2
addot(OT_S_BARKSKIN, "barkskin", "Covers the caster with a skin of bark, reducing damage but making them vulnerable to fire.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
@ -3364,7 +3408,6 @@ void initobjects(void) {
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_WALLSTOP, NA, NULL);
addot(OT_S_ENDUREELEMENTS, "endure elements", "Provides resistance to fire and cold.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
@ -3482,78 +3525,6 @@ void initobjects(void) {
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addflag(lastot->flags, F_PLEASESGOD, R_GODNATURE, 5, NA, NULL);
///////////////////
// gravity
///////////////////
// l1
addot(OT_S_TRUESTRIKE, "weapon attraction", "Gives the target unerring accuracy, making their attacks always hit and negating strength penalties.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines the amount of strikes before it expires.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 1, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
// l2
addot(OT_S_GRAVLOWER, "lessen gravity", "Lessens the weight of the caster's items. Also causes the caster to fall very slowly.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Each power level will reduce caster's load by 15kg.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addot(OT_S_WHATGOESUP, "what goes up", "...must come down. Thrown or fired missiles will return to the caster's hands if not destroyed.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
// l3
addot(OT_S_SLOW, "slowness", "Decreases the speed of the target.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines how long the slowness will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_VICTIM, NA, NA, NULL);
addot(OT_S_FORCESPHERE, "force sphere", "Radiates a shock wave out from the caster, knocking opponents away.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines the radius of the blast (1 - 3 cells).");
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_ADJSELF, NA, NA, NULL);
// l4
addot(OT_S_GRAVBOOST, "boost gravity", "Greatly increases gravity around the target, preventing them from moving.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines how long its effects will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addot(OT_S_LEVITATION, "levitation", "Causes the caster hover a metre above the ground.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addot(OT_S_EQANDOP, "equal and opposite", "Surrounds the caster with a negative gravity field, repelling all missiles in a direct path back to their source.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
// l5
// l6
addot(OT_S_FLIGHT, "fly", "Allows the caster to fly.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 6, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
addot(OT_S_HASTE, "haste", "Increases the speed of the target.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines how long its effects will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 6, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_ALLY, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
///////////////////
// life spells / cleric spells
///////////////////
// l1
@ -3712,7 +3683,6 @@ void initobjects(void) {
addot(OT_S_SLEEP, "sleep", "Puts the target creature to sleep.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines how long the sleep effect will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_MENTAL, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
@ -3727,7 +3697,6 @@ void initobjects(void) {
// l4
addot(OT_S_PACIFY, "pacify", "Induces calmness in another, preventing them from attacking.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines resistability.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_MENTAL, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
@ -3740,7 +3709,6 @@ void initobjects(void) {
// l5
addot(OT_S_CHARM, "charm", "Causes another lifeform to temporary become friendly.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines resistability and duration.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_MENTAL, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 5, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
@ -3757,7 +3725,6 @@ void initobjects(void) {
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addot(OT_S_HOLDPORTAL, "seal entrance", "Magically closes and jams a door, preventing it from opening.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_MODIFICATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_DOOR, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 1, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
@ -3806,7 +3773,6 @@ void initobjects(void) {
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_ANYWHERE, NA, NA, NULL);
addot(OT_S_MENDING, "mending", "Repairs minor damage to objects (1d6 + ^bpower^n).", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_MODIFICATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
@ -3822,7 +3788,6 @@ void initobjects(void) {
addot(OT_S_INVISIBILITY, "invisibility", "Temporarily renders the target invisible.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines how long the invisibility will last.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_MODIFICATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_SELF, NA, NA, NULL);
@ -3868,6 +3833,11 @@ void initobjects(void) {
addflag(lastot->flags, F_SPELLLEVEL, 5, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_ANYWHERE, NA, NA, NULL);
// l6
addot(OT_S_ENCHANT, "enhancement", "Magically enhances a weapon or piece of armour.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_MODIFICATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 6, NA, NA, NULL);
// TODO: hardcode how ai casts this spell
addot(OT_S_PETRIFY, "petrify", "Causes a living creature to turn into stone.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines resistability.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_MODIFICATION, NA, NA, NULL);
@ -5105,6 +5075,10 @@ void initobjects(void) {
addflag(lastot->flags, F_RARITY, H_CAVE, 75, NA, NULL);
addflag(lastot->flags, F_RARITY, H_FOREST, 90, NA, NULL);
addflag(lastot->flags, F_RARITY, H_SWAMP, 90, RR_COMMON, NULL);
addflag(lastot->flags, F_OBDIETEXT, NA, NA, NA, "dries up");
addflag(lastot->flags, F_OBHP, 50, 50, NA, NULL);
addflag(lastot->flags, F_OBHPDRAIN, 1, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_DTIMMUNE, DT_WATER, NA, NA, NULL);
addflag(lastot->flags, F_REDUCEMOVEMENT, 2, NA, NA, NULL);
@ -7591,10 +7565,8 @@ void initrace(void) {
addflag(lastrace->flags, F_NOSKILL, SK_SS_AIR, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_DEATH, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_DIVINATION, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_ENCHANTMENT, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_FIRE, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_COLD, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_GRAVITY, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_LIFE, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_MODIFICATION, NA, NA, NULL);
addflag(lastrace->flags, F_NOSKILL, SK_SS_SUMMONING, NA, NA, NULL);
@ -12751,6 +12723,7 @@ void initraceclasses(void) {
void initskills(void) {
skill_t *sk;
// note: any skill names >13 characters should have a shortened version.
addskill(SK_ARMOUR, "Armour", "Reduces evasion and stealth penalties from wearing armour.", 100);
addskilldesc(SK_ARMOUR, PR_INEPT, "- Reduces the noise you make when wearing metal armour.", B_FALSE);
addskilldesc(SK_ARMOUR, PR_NOVICE, "^gReduces armour penalties by 10%.^n", B_FALSE);
@ -12856,6 +12829,7 @@ void initskills(void) {
addskilldesc(SK_RANGED, PR_EXPERT, "^gYour ranged accuracy decreases by 8% per cell.^n", B_FALSE);
addskilldesc(SK_RANGED, PR_MASTER, "^gYour ranged attacks now deal 50% more damage.^n", B_TRUE);
addskilldesc(SK_RANGED, PR_MASTER, "^gYour ranged accuracy decreases by 6% per cell.^n", B_FALSE);
free(lastskill->shortname); lastskill->shortname = strdup("Ranged Wpns");
addskill(SK_SEWING, "Sewing", "Lets you repair cloth or leather objects.", 25);
addskilldesc(SK_SEWING, PR_NOVICE, "^gYou can repair cloth items with condition >= 80%.^n", B_FALSE);
addskilldesc(SK_SEWING, PR_BEGINNER, "^gYou can repair cloth items with condition >= 65%.^n", B_FALSE);
@ -12933,6 +12907,7 @@ void initskills(void) {
addskilldesc(SK_LORE_ARCANA, PR_NOVICE, "^gYou can attempt to identify objects with the 'inspect' ability.^n", B_FALSE);
addskilldesc(SK_LORE_ARCANA, PR_ADEPT, "^gYou gain the 'study scrolls' ability.", B_FALSE);
addskill(SK_LORE_DEMONS, "Lore:Demonology", "Determines your knowledge about demons.", 5);
free(lastskill->shortname); lastskill->shortname = strdup("Lore:Demons");
addskill(SK_LORE_HUMANOID, "Lore:Humanoid", "Determines your knowledge about humanoid (bipedal) creatures.", 5);
addskill(SK_LORE_NATURE, "Lore:Nature", "Determines your knowledge of plants, animals and insects.", 5);
addskill(SK_LORE_UNDEAD, "Lore:Undead", "Determines your knowledge of the undead.", 5);
@ -12942,11 +12917,13 @@ void initskills(void) {
addskill(SK_AXES, "Axes", "Helps you use chopping weapons like axes.", 50);
addskill(SK_CLUBS, "Clubs", "Helps you use bashing weapons like maces or clubs.", 50);
addskill(SK_EXOTICWEPS, "Exotic Weapons", "Helps you use nunchaku, sais, etc.", 50);
free(lastskill->shortname); lastskill->shortname = strdup("Exotic Wpns");
addskill(SK_LONGBLADES, "Long Blades", "Helps you use long swords, scimitars, etc.", 50);
addskill(SK_POLEARMS, "Polearms", "Helps you use long bladed weapons like halberds.", 50);
addskill(SK_SHORTBLADES, "Short Blades", "Helps you use daggers, gladius', etc.", 50);
addskill(SK_STAVES, "Staves", "Helps you use quarterstaffs, staffs, etc.", 50);
addskill(SK_UNARMED, "Unarmed Combat", "Helps you fight using your bare hands.", 50);
free(lastskill->shortname); lastskill->shortname = strdup("Unarmed");
addskilldesc(SK_UNARMED, PR_ADEPT, "^gYour unarmed attacks can now smash wooden objects.^n", B_TRUE);
addskilldesc(SK_UNARMED, PR_SKILLED, "^gYou can now make melee attacks with your off-hand.^n", B_TRUE);
addskilldesc(SK_UNARMED, PR_EXPERT, "^gYou gain the 'flip' ability.^n", B_FALSE);
@ -12996,13 +12973,6 @@ void initskills(void) {
addskilldesc(SK_SS_DIVINATION, PR_SKILLED, "Allows you to cast Divination spells up to level 4.", B_FALSE);
addskilldesc(SK_SS_DIVINATION, PR_EXPERT, "Allows you to cast Divination spells up to level 5.", B_FALSE);
addskilldesc(SK_SS_DIVINATION, PR_MASTER, "Allows you to cast Divination spells up to level 6.", B_FALSE);
addskill(SK_SS_ENCHANTMENT, "Sorcery:Enchantment", "Boosts casting of spells from this school.", 50);
addskilldesc(SK_SS_ENCHANTMENT, PR_NOVICE, "Allows you to cast Enchantment spells up to level 1.", B_FALSE);
addskilldesc(SK_SS_ENCHANTMENT, PR_BEGINNER, "Allows you to cast Enchantment spells up to level 2.", B_FALSE);
addskilldesc(SK_SS_ENCHANTMENT, PR_ADEPT, "Allows you to cast Enchantment spells up to level 3.", B_FALSE);
addskilldesc(SK_SS_ENCHANTMENT, PR_SKILLED, "Allows you to cast Enchantment spells up to level 4.", B_FALSE);
addskilldesc(SK_SS_ENCHANTMENT, PR_EXPERT, "Allows you to cast Enchantment spells up to level 5.", B_FALSE);
addskilldesc(SK_SS_ENCHANTMENT, PR_MASTER, "Allows you to cast Enchantment spells up to level 6.", B_FALSE);
addskill(SK_SS_FIRE, "Sorcery:Fire Magic", "Boosts casting of spells from this school.", 50);
addskilldesc(SK_SS_FIRE, PR_NOVICE, "Allows you to cast Fire Magic spells up to level 1.", B_FALSE);
addskilldesc(SK_SS_FIRE, PR_BEGINNER, "Allows you to cast Fire Magic spells up to level 2.", B_FALSE);
@ -13017,13 +12987,6 @@ void initskills(void) {
addskilldesc(SK_SS_COLD, PR_SKILLED, "Allows you to cast Cold Magic spells up to level 4.", B_FALSE);
addskilldesc(SK_SS_COLD, PR_EXPERT, "Allows you to cast Cold Magic spells up to level 5.", B_FALSE);
addskilldesc(SK_SS_COLD, PR_MASTER, "Allows you to cast Cold Magic spells up to level 6.", B_FALSE);
addskill(SK_SS_GRAVITY, "Sorcery:Gravitation", "Boosts casting of spells from this school.", 50);
addskilldesc(SK_SS_GRAVITY, PR_NOVICE, "Allows you to cast Gravitation spells up to level 1.", B_FALSE);
addskilldesc(SK_SS_GRAVITY, PR_BEGINNER, "Allows you to cast Gravitation spells up to level 2.", B_FALSE);
addskilldesc(SK_SS_GRAVITY, PR_ADEPT, "Allows you to cast Gravitation spells up to level 3.", B_FALSE);
addskilldesc(SK_SS_GRAVITY, PR_SKILLED, "Allows you to cast Gravitation spells up to level 4.", B_FALSE);
addskilldesc(SK_SS_GRAVITY, PR_EXPERT, "Allows you to cast Gravitation spells up to level 5.", B_FALSE);
addskilldesc(SK_SS_GRAVITY, PR_MASTER, "Allows you to cast Gravitation spells up to level 6.", B_FALSE);
addskill(SK_SS_LIFE, "Sorcery:Life Magic", "Boosts casting of spells from this school.", 50);
addskilldesc(SK_SS_LIFE, PR_NOVICE, "Allows you to cast Life Magic spells up to level 1.", B_FALSE);
addskilldesc(SK_SS_LIFE, PR_BEGINNER, "Allows you to cast Life Magic spells up to level 2.", B_FALSE);

Binary file not shown.

10
defs.h
View File

@ -340,7 +340,7 @@ enum SHOPACTION {
#define BUFLENSMALL 64
#define BUFLEN 256
#define BIGBUFLEN 512
#define HUGEBUFLEN 1024
#define HUGEBUFLEN 2048
#define MAXPNAMELEN 12 // max player name length
// file i/o
#define DATADIR "data"
@ -607,17 +607,15 @@ enum SKILL {
SK_SS_AIR,
SK_SS_DEATH,
SK_SS_DIVINATION,
SK_SS_ENCHANTMENT,
SK_SS_FIRE,
SK_SS_COLD,
SK_SS_GRAVITY,
SK_SS_LIFE,
SK_SS_MODIFICATION,
SK_SS_SUMMONING,
SK_SS_TRANSLOCATION,
SK_SS_WILD,
};
#define MAXSKILLS 54
#define MAXSKILLS 52
// proficiency levels
enum SKILLLEVEL {
@ -786,10 +784,8 @@ enum SPELLSCHOOL {
SS_AIR,
SS_DEATH,
SS_DIVINATION,
SS_ENCHANTMENT,
SS_FIRE,
SS_COLD,
SS_GRAVITY,
SS_LIFE,
SS_MODIFICATION,
SS_MENTAL,
@ -3433,6 +3429,7 @@ enum ERROR {
E_NOLOF,
E_IMPOSSIBLE,
E_PALADIN,
E_PALADIN2,
E_NOTARGET,
E_NOAMMO,
E_GRAVBOOSTED,
@ -4021,6 +4018,7 @@ typedef struct material_s {
typedef struct skill_s {
enum SKILL id;
char *name;
char *shortname;
char *desc;
enum SKILLLEVEL skilldesclev[MAXSKILLLEVEL*2];
char *skilldesctext[MAXSKILLLEVEL*2];

27
god.c
View File

@ -972,9 +972,28 @@ int godgiftmaybe(enum RACE rid, int fromtemple) {
if (player->race->id == R_VAMPIRE) {
rollagain = B_TRUE;
} else {
int orighp;
int origatt[MAXATTS];
enum ATTRIB a;
msg("\"Go forth and kill in my name!\"");
msg("You transform into a vampire!");
// special polymorph - we won't change some stats.
orighp = player->maxhp;
for (a = 0; a < MAXATTS; a++) {
origatt[a] = player->att[a];
}
// change the race.
setrace(player, R_VAMPIRE, B_FALSE); // ie. don't set origrace!
// restore stats
player->maxhp = orighp;
player->hp = orighp;
for (a = 0; a < MAXATTS; a++) {
player->att[a] = origatt[a];
}
statdirty = B_TRUE;
drawscreen();
}
break;
case 6: // necromancy spells
@ -2042,8 +2061,12 @@ int prayto(lifeform_t *lf, lifeform_t *god) {
if (!donesomething && (plev >= PL_PLEASED)) {
object_t *o;
for (o = player->pack->first ; o ; o = o->next) {
if ((o->type->id == OT_POT_WATER) && !isblessed(o)) {
blessob(o);
if (o->type->id == OT_POT_WATER) {
if (!isblessed(o)) {
blessob(o);
} else if (!o->blessknown) {
dospelleffects(god, OT_S_IDENTIFY, 10, NULL, o, NULL, B_UNCURSED, NULL, B_FALSE);
}
}
}
}

331
io.c
View File

@ -74,6 +74,7 @@ extern command_t *firstcommand;
extern option_t *firstoption,*lastoption;
extern vault_t *firstvault;
extern skill_t *firstskill;
extern job_t *firstjob;
extern enum GAMEMODE gamemode;
extern long curtime;
@ -1859,9 +1860,9 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
break;
case F_WINDSHIELD:
if (isplayer(lf)) {
msg("^gYou are surrounded by a whirling cyclone!");
msg("^gYou are surrounded by a whirling cyclone of debris!");
} else if (cansee(player, lf)) {
msg("%s is surrounded by a whirling cyclone!",lfname);
msg("%s is surrounded by a whirling cyclone of debris!",lfname);
}
break;
case F_VISRANGEMOD:
@ -2690,6 +2691,8 @@ lifeform_t *askgod(char *prompttext, int onlyprayed) {
initprompt(&prompt, prompttext);
prompt.maycancel = B_TRUE;
addpromptq(&prompt, "Describe which god?");
for (i = 0 ; i < ngodlfs; i++) {
flag_t *f;
char godof[BUFLEN],buf[BUFLEN];
@ -2717,8 +2720,16 @@ lifeform_t *askgod(char *prompttext, int onlyprayed) {
} else if (prompt.nchoices == 1) {
lf = (lifeform_t *)prompt.choice[0].data;
} else {
getchoice(&prompt);
lf = (lifeform_t *)prompt.result;
int done = B_FALSE;
while (!done) {
getchoice(&prompt);
lf = (lifeform_t *)prompt.result;
if (prompt.whichq == 0) {
break;
} else {
describegod(lf);
}
}
}
return lf;
}
@ -3648,6 +3659,34 @@ void describegod(lifeform_t *god) {
restoregamewindows();
}
void describejob(enum JOB jid) {
char *buf2;
char buf[BUFLEN];
job_t *j;
j = findjob(jid);
cls();
// title
snprintf(buf, BUFLEN, "%s",j->name);
capitalise(buf);
mvwprintw(mainwin, 0, 0, buf);
wmove(mainwin, 2, 0);
buf2 = malloc(HUGEBUFLEN * sizeof(char));
makedesc_job(j, buf2);
textwithcol(mainwin, buf2);
free(buf2);
wrefresh(mainwin);
// wait for key
getch();
real_clearmsg(B_TRUE);
restoregamewindows();
}
void describeob(object_t *o) {
char buf[BIGBUFLEN];
char *buf2;
@ -5147,29 +5186,159 @@ char *makedesc_job(job_t *j, char *retbuf) {
char thisline[BUFLEN];
flag_t *retflag[MAXCANDIDATES];
int nretflags,i;
skill_t *sk;
char buf[BUFLEN];
enum ATTRIB a;
int count = 0;
flag_t *f;
// start with job description
strcpy(retbuf, j->desc);
strcat(retbuf, "\n\n");
strcat(retbuf, "STARTING ATTRIBUTES\n");
f = hasflag(j->flags, F_ALIGNMENT);
if (f) {
if (f->val[0] == AL_NONE) {
int count = 0;
char *p;
char choices[BUFLEN];
strcpy(choices, "");
for ( p = f->text; *p; p++) {
if (strlen(choices)) strcat(choices, "/");
switch (*p) {
case 'g': strcat(choices, "Good"); count++; break;
case 'n': strcat(choices, "Neutral"); count++; break;
case 'e': strcat(choices, "Evil"); count++; break;
}
}
if (count == 3) {
sprintf(thisline, "Alignment:Any");
} else {
sprintf(thisline, "Alignment:%s", choices);
}
} else {
char *p;
p = strdup(getalignmentname(f->val[0]));
capitalise(p);
sprintf(thisline, "Alignment:%s",p);
free(p);
}
} else {
sprintf(thisline, "Alignment:Any");
}
strcat(thisline, " ");
if (hasflag(j->flags, F_JOBATTRMOD)) {
for (a = 0; a < MAXATTS; a++) {
char buf[BUFLEN];
f = hasflagval(j->flags, F_JOBATTRMOD, a, NA, NA, NULL);
if (f && (f->val[1] != 0)) {
char buf2[BUFLEN];
if (f->val[1] > 0) {
sprintf(buf, "^%d+%d^n", C_GREEN, f->val[1]);
} else if (f->val[1] < 0) {
sprintf(buf, "^%d%d^n", C_RED, f->val[1]);
}
sprintf(buf2, "%s:%s ", getattrabbrev(a), buf);
strcat(thisline, buf2);
}
}
}
strncat(retbuf, thisline, HUGEBUFLEN);
strncat(retbuf, "\n\n", HUGEBUFLEN);
// skills
// max skillname length: 21 (sorcery:translocation)
// use blocks of 26
// NAME:Nvc NAME:Beg NAME:Adp
// NAME:Beg
// NAME:Adp
// NAME:Skl
// NAME:Exp
// NAME:Mas
// -21-
// == 3 per line
// == need 17 lines
strcat(retbuf, "STARTING SKILLS\n");
count = 0;
strcpy(thisline, "");
for (sk = firstskill ; sk ; sk = sk->next) {
char lev[BUFLEN];
enum SKILLLEVEL slev = PR_INEPT;
strcpy(lev, "");
f = hasflagval(j->flags, F_STARTSKILL, sk->id, NA, NA, NULL);
if (f) {
slev = f->val[1];
switch (slev) {
case PR_INEPT: strcpy(lev, "---"); break;
case PR_NOVICE: strcpy(lev, "Nov"); break;
case PR_BEGINNER: strcpy(lev, "Beg"); break;
case PR_ADEPT: strcpy(lev, "Adp"); break;
case PR_SKILLED: strcpy(lev, "Skl"); break;
case PR_EXPERT: strcpy(lev, "Exp"); break;
case PR_MASTER: strcpy(lev, "Mst"); break;
}
/*
} else {
f = hasflagval(j->flags, F_CANLEARN, sk->id, NA, NA, NULL);
if (f) {
slev = PR_INEPT;
strcpy(lev, "---");
}
*/
}
if (strlen(lev)) {
char *p;
//char bufpad[BUFLEN];
count++;
sprintf(buf, "%13s:^%d%s^n ",sk->shortname, getskilllevelcolour(slev), lev);
//sprintf(buf, "%19s:^%d%3s^n ",sk->name, getskilllevelcolour(slev), lev);
//sprintf(bufpad, "%18s",buf);
// strip trailing spaces
p = buf + strlen(buf) - 2; // ie. last char
while (*p == ' ') {
*p = '\0';
p--;
}
strcat(thisline, buf);
if (count == 4) {
count = 0;
assert(strlen_without_colours(thisline) < 78);
// print it.
strcat(thisline, "\n");
strcat(retbuf, thisline);
strcpy(thisline, "");
}
} // end if strlen(lev)
} // end foreach skill
// specialisations
getflags(j->flags, retflag, &nretflags, F_CANHAVESUBJOB, F_NONE);
strcpy(thisline, "");
if (nretflags > 0) {
int first = B_TRUE;
strcat(retbuf, "SPECIALISATIONS\n");
for (i = 0; i < nretflags; i++) {
subjob_t *sj;
sj = findsubjob(retflag[i]->val[0]);
if (sj) {
char buf[BUFLEN];
if (first) {
sprintf(thisline, "%ss can have the following specialisations:\n",j->name);
strncat(retbuf, thisline, HUGEBUFLEN);
sprintf(buf, "- %s",sj->name);
first = B_FALSE;
} else {
sprintf(buf, ", %s",sj->name);
}
sprintf(thisline, "- %s\n",sj->name);
strncat(retbuf, thisline, HUGEBUFLEN);
strncat(thisline, buf, HUGEBUFLEN);
}
}
if (strlen(thisline)) {
strcat(thisline, "\n");
strncat(retbuf, thisline, HUGEBUFLEN);
}
}
return retbuf;
@ -6590,9 +6759,11 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
r = findrace(rid);
if (showextra) {
int a;
int a,n;
int curidx,donesomething;
char bonheading[BUFLEN],penheading[BUFLEN];
enum OBCLASS spellorabil[2];
sprintf(bonheading, "^%dStrengths^n:\n", C_WHITE);
sprintf(penheading, "^%dWeaknesses^n:\n", C_WHITE);
// stats
@ -6655,11 +6826,61 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
}
}
// abilities?
spellorabil[0] = OC_ABILITY;
spellorabil[1] = OC_SPELL;
getflags(r->flags, retflag, &nretflags, F_CANWILL, F_NONE);
for (n = 0; n <= 1; n++) {
strcpy(buf, "");
for (i = 0; i < nretflags; i++) {
objecttype_t *ot;
int power = 1;
f = retflag[i];
ot = findot(f->val[0]);
if (ot && (ot->obclass->id == spellorabil[n])) {
if (i == 0) {
sprintf(buf, "%s: %s", (spellorabil[n] == OC_ABILITY) ? "Ability" : "Spell",
ot->name);
} else {
sprintf(buf, ", %s", ot->name);
}
texttospellopts(f->text, "pw:", &power, NULL);
if (power) {
strcat(buf, " (power ");
strcat(buf, roman(power));
strcat(buf, ")");
}
}
}
if (strlen(buf)) {
strncat(retbuf, "@- ", HUGEBUFLEN);
strcat(buf, "\n");
strncat(retbuf, buf, HUGEBUFLEN);
}
}
// skills?
getflags(r->flags, retflag, &nretflags, F_STARTSKILL, F_NONE);
strcpy(buf, "");
for (i = 0; i < nretflags; i++) {
char nextbit[BUFLEN];
f = retflag[i];
if (i == 0) {
sprintf(nextbit, "%s %s", getskilllevelname(f->val[1]), getskillname(f->val[0]));
} else {
sprintf(nextbit, ", %s %s", getskilllevelname(f->val[1]), getskillname(f->val[0]));
}
strcat(buf, nextbit);
}
if (strlen(buf)) {
strncat(retbuf, "@- ", HUGEBUFLEN);
strcat(buf, "\n");
strncat(retbuf, buf, HUGEBUFLEN);
}
// auto bonuses from flags
for (f = r->flags->first ; f ; f = f->next) {
char *p;
objecttype_t *ot;
int power;
strcpy(buf, "");
switch (f->id) {
case F_AUTOCREATEOB:
@ -6670,17 +6891,6 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
case F_AQUATIC: strcpy(buf, "Moves normally through water"); break;
case F_AWARENESS: strcpy(buf, "Can see in all directions."); break;
case F_CANEATRAW: strcpy(buf, "Can safely digest raw meat."); break;
case F_CANWILL:
ot = findot(f->val[0]);
sprintf(buf, "%s: %s", (ot->obclass->id == OC_ABILITY) ? "Ability" : "Spell",
ot->name);
texttospellopts(f->text, "pw:", &power, NULL);
if (power) {
strcat(buf, " (power ");
strcat(buf, roman(power));
strcat(buf, ")");
}
break;
case F_DODGES: strcpy(buf, "Can dodge fatal attacks into adjacent locations"); break;
case F_DTIMMUNE:
if (!hasflag(doneflags, F_DTIMMUNE)) {
@ -6756,7 +6966,6 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
case F_SILENTMOVE: sprintf(buf, "Moves silently"); break;
case F_SPIDERCLIMB: sprintf(buf, "Adheres to walls"); break;
case F_STABILITY: sprintf(buf, "Will not fall on slippery ground."); break;
case F_STARTSKILL: sprintf(buf, "%s %s", getskilllevelname(f->val[1]), getskillname(f->val[0])); break;
case F_STENCH: sprintf(buf, "Emits a foul odour which affects others"); break;
case F_TREMORSENSE: sprintf(buf, "Can sense vibrations (range %d)", f->val[0]); break;
case F_VISRANGEMOD: if (f->val[0] > 0) sprintf(buf, "Enhanced vision range (+%d)", f->val[0]); break;
@ -7674,10 +7883,11 @@ void dohelp(char helpmode) {
cls();
if (helpmode == '?') {
initprompt(&prompt, "What would you like help with (ESC when done)?");
addchoice(&prompt, 'g', "God Descriptions", NULL, NULL, NULL);
addchoice(&prompt, 'j', "Job Descriptions", NULL, NULL, NULL);
addchoice(&prompt, 'k', "Keyboard Commands", NULL, NULL, NULL);
addchoice(&prompt, 'r', "Race Descriptions", NULL, NULL, NULL);
addchoice(&prompt, 's', "Skill Descriptions", NULL, NULL, NULL);
addchoice(&prompt, 'g', "God Descriptions", NULL, NULL, NULL);
addchoice(&prompt, '-', "(done)", NULL, NULL, NULL);
prompt.maycancel = B_TRUE;
ch = getchoice(&prompt);
@ -7690,6 +7900,24 @@ void dohelp(char helpmode) {
helpmode = ch;
break;
}
} else if (helpmode == 'j') {
job_t *j;
centre(mainwin,C_WHITE, 0, "JOB REFERENCE");
y = 2;
initprompt(&prompt, "Describe which job (ESC when done)?");
for (j = firstjob ; j ; j = j->next) {
addchoice(&prompt, 'a', j->name, NULL, j, j->desc);
}
addchoice(&prompt, '\0', "(done)", NULL, NULL, NULL);
prompt.maycancel = B_TRUE;
ch = getchoicestr(&prompt, B_FALSE, B_TRUE);
if (!ch) {
done = B_TRUE;
} else {
j = (job_t *)prompt.result;
if (j) describejob(j->id);
}
} else if (helpmode == 'k') {
centre(mainwin,C_WHITE, 0, "KEYBOARD COMMAND REFERENCE");
y = 2;
@ -8581,6 +8809,46 @@ int drop(object_t *o, int count) {
return B_FALSE;
}
void dumpskills(void) {
skill_t *sk;
char buf[BUFLEN],thisline[BUFLEN];
int count = 0;
// max skillname length: 21 (sorcery:translocation)
// use blocks of 26
// NAME:Nvc NAME:Beg NAME:Adp
// NAME:Beg
// NAME:Adp
// NAME:Skl
// NAME:Exp
// NAME:Mas
// -21-
// == 3 per line
// == need 17 lines
strcpy(thisline, "");
for (sk = firstskill ; sk ; sk = sk->next) {
char lev[BUFLEN];
count++;
switch (rnd(0,6)) {
case 0: strcpy(lev, "---"); break;
case 1: strcpy(lev, "Nov"); break;
case 2: strcpy(lev, "Beg"); break;
case 3: strcpy(lev, "Adp"); break;
case 4: strcpy(lev, "Skl"); break;
case 5: strcpy(lev, "Exp"); break;
case 6: strcpy(lev, "Mst"); break;
}
sprintf(buf, "%21s:%3s ",sk->name, lev);
strcat(thisline, buf);
if (count == 3) {
count = 0;
// print it.
dblog("%s", thisline);
strcpy(thisline, "");
}
}
}
void dumpbuildingusage(void) {
int i;
objecttype_t *ot;
@ -8759,6 +9027,9 @@ char getchoice(prompt_t *prompt) {
prompt->result = NULL;
sel = -1;
break;
} else if ((ch == '!') || (ch == '?')) { // toggle prompts
prompt->whichq++;
if (prompt->whichq >= prompt->nqs) prompt->whichq = 0;
} else if ((ch == '\\') && (gamemode == GM_GAMESTARTED)) {
doknowledgelist();
} else if (ch == ' ') {
@ -10631,7 +10902,7 @@ void showlfstats(lifeform_t *lf, int showall) {
strcat(cmdchars, "i");
}
if ((lorelev >= PR_ADEPT) || (getskill(player, SK_LORE_ARCANA) >= PR_ADEPT)) {
snprintf(buf, BUFLEN, "^M^agic ");
snprintf(buf, BUFLEN, "^WM^nagic ");
strcat(promptstr, buf);
strcat(cmdchars, "m");
}
@ -13250,6 +13521,14 @@ char wrapprint(WINDOW *win, int *y, int *x, int newlineindent, char *format, ...
if (strlen(word) == 0) {
repword = strdup(" ");
} else {
// handle newline chars
while (word[0] == '\n') {
(*y)++;
*x = newlineindent;
memmove(word, word + 1, strlen(word));
}
repword = strdup(word);
while (rv) {
repword = strrep(repword, "@", " ", &rv);
@ -13257,7 +13536,7 @@ char wrapprint(WINDOW *win, int *y, int *x, int newlineindent, char *format, ...
}
// if this word won't fit, put it on the next line.
if (*x != 0) {
if (*x + strlen(repword) >= (w-1)) {
if (*x + strlen_without_colours(repword) >= (w-1)) {
(*y)++;
*x = newlineindent;
}

2
io.h
View File

@ -37,6 +37,7 @@ void clearretobs(void);
void cls(void);
int contains(enum OBCLASS *array, int nargs, enum OBCLASS want);
void describegod(lifeform_t *god);
void describejob(enum JOB jid);
void describeob(object_t *o);
void describerace(enum RACE rid);
void describeskill(enum SKILL skid, enum SKILLLEVEL levhilite);
@ -88,6 +89,7 @@ void drawstatus(void);
int drop(object_t *o, int count);
void dumpbuildingusage(void);
void dumpoc(void);
void dumpskills(void);
void dumpspells(void);
void dumpweps(void);
void forceredraw(void);

214
lf.c
View File

@ -565,6 +565,22 @@ int cancast(lifeform_t *lf, enum OBTYPE oid, int *mpcost) {
return B_FALSE;
}
if (hassubjob(lf, SJ_PALADIN)) {
object_t *o;
// using cursed weapons/armour? no spells.
for (o = lf->pack->first ; o ; o = o->next) {
if (isequipped(o) && iscursed(o)) {
if (isweapon(o)) {
reason = E_PALADIN;
return B_FALSE;
} else if (isarmour(o)) {
reason = E_PALADIN2;
return B_FALSE;
}
}
}
}
reason = E_OK;
ot = findot(oid);
@ -1583,6 +1599,12 @@ int castspell(lifeform_t *lf, enum OBTYPE sid, lifeform_t *targlf, object_t *tar
case E_NOSPELLS:
msg("You can't cast spells.");
break;
case E_PALADIN:
msg("Your cursed weapon is nullifying your holy magic.");
break;
case E_PALADIN2:
msg("Your cursed armour is nullifying your holy magic.");
break;
case E_PRONE:
msg("You can't cast spells while prone.");
break;
@ -8620,181 +8642,34 @@ float getstatmod(lifeform_t *lf, enum ATTRIB att) {
return mod;
}
enum ATTRBRACKET getattrbracket(int attrval, enum ATTRIB whichatt, char *buf) {
if (attrval <= 12) {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "hideous"); break;
case A_CON:
strcpy(buf, "frail"); break;
case A_AGI:
strcpy(buf, "uncoordinated"); break;
case A_IQ:
strcpy(buf, "vegetable"); break;
case A_STR:
strcpy(buf, "helpless"); break;
case A_WIS:
strcpy(buf, "witless"); break;
default:
strcpy(buf, "?extralow?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_EXLOW));
return AT_EXLOW;
} else if (attrval <= 23) {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "repulsive"); break;
case A_CON:
strcpy(buf, "sickly"); break;
case A_AGI:
strcpy(buf, "oafish"); break;
case A_IQ:
strcpy(buf, "animal"); break;
case A_STR:
strcpy(buf, "feeble"); break;
case A_WIS:
strcpy(buf, "reckless"); break;
default:
strcpy(buf, "?verylow?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_VLOW));
return AT_VLOW;
} else if (attrval <= 34) {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "ugly"); break;
case A_CON:
strcpy(buf, "unhealthy"); break;
case A_AGI:
strcpy(buf, "clumsy"); break;
case A_IQ:
strcpy(buf, "dim-witted"); break;
case A_STR:
strcpy(buf, "very weak"); break;
case A_WIS:
strcpy(buf, "foolish"); break;
default:
strcpy(buf, "?low?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_LOW));
return AT_LOW;
} else if (attrval <= 45) {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "unattractive"); break;
case A_CON:
strcpy(buf, "unfit"); break;
case A_AGI:
strcpy(buf, "awkward"); break;
case A_IQ:
strcpy(buf, "dopey"); break;
case A_STR:
strcpy(buf, "weak"); break;
case A_WIS:
strcpy(buf, "naive"); break;
default:
strcpy(buf, "?lt_average?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_LTAVERAGE));
return AT_LTAVERAGE;
} else if (attrval <= 56) {
if (buf) {
switch (whichatt) {
case A_CHA:
case A_CON:
case A_AGI:
case A_STR:
case A_IQ:
case A_WIS:
strcpy(buf, "average"); break;
default:
strcpy(buf, "?average?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_AVERAGE));
return AT_AVERAGE;
} else if (attrval <= 67) {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "attractive"); break;
case A_CON:
strcpy(buf, "healthy"); break;
case A_AGI:
strcpy(buf, "dextrous"); break;
case A_IQ:
strcpy(buf, "smart"); break;
case A_STR:
strcpy(buf, "strong"); break;
case A_WIS:
strcpy(buf, "prudent"); break;
default:
strcpy(buf, "?gt_average?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_GTAVERAGE));
return AT_GTAVERAGE;
} else if (attrval <= 78) {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "alluring"); break;
case A_CON:
strcpy(buf, "very fit"); break;
case A_AGI:
strcpy(buf, "nimble"); break;
case A_IQ:
strcpy(buf, "enlightened"); break;
case A_STR:
strcpy(buf, "mighty"); break;
case A_WIS:
strcpy(buf, "astute"); break;
default:
strcpy(buf, "?high?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_HIGH));
return AT_HIGH;
} else if (attrval <= 89) {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "beautiful"); break;
case A_CON:
strcpy(buf, "hardy"); break;
case A_AGI:
strcpy(buf, "agile"); break;
case A_IQ:
strcpy(buf, "genius"); break;
case A_STR:
strcpy(buf, "powerful"); break;
case A_WIS:
strcpy(buf, "wise"); break;
default:
strcpy(buf, "?veryhigh?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_VHIGH));
return AT_VHIGH;
} else {
if (buf) {
switch (whichatt) {
case A_CHA:
strcpy(buf, "stunning"); break;
case A_CON:
strcpy(buf, "very hardy"); break;
case A_AGI:
strcpy(buf, "very agile"); break;
case A_IQ:
strcpy(buf, "supergenius"); break;
case A_STR:
strcpy(buf, "titanic"); break;
case A_WIS:
strcpy(buf, "sagely"); break;
default:
strcpy(buf, "?exhigh?"); break;
}
}
if (buf) strcpy(buf, getattrbracketname(whichatt, AT_EXHIGH));
return AT_EXHIGH;
}
@ -9348,7 +9223,6 @@ void givejob(lifeform_t *lf, enum JOB jobid) {
// wizards now get a secondary school
initprompt(&prompt, "Select your secondary spell school:");
addchoice(&prompt, 'd', getskillname(SK_SS_DIVINATION), NULL, findskill(SK_SS_DIVINATION), NULL);
addchoice(&prompt, 'g', getskillname(SK_SS_GRAVITY), NULL, findskill(SK_SS_GRAVITY), NULL);
addchoice(&prompt, 'm', getskillname(SK_SS_MODIFICATION), NULL, findskill(SK_SS_MODIFICATION), NULL);
addchoice(&prompt, 's', getskillname(SK_SS_SUMMONING), NULL, findskill(SK_SS_SUMMONING), NULL);
addchoice(&prompt, 't', getskillname(SK_SS_TRANSLOCATION), NULL, findskill(SK_SS_TRANSLOCATION), NULL);
@ -9358,9 +9232,6 @@ void givejob(lifeform_t *lf, enum JOB jobid) {
case SK_SS_DIVINATION:
sb2 = addob(lf->pack, "spellbook of divination magic");
break;
case SK_SS_GRAVITY:
sb2 = addob(lf->pack, "spellbook of gravitation magic");
break;
case SK_SS_MODIFICATION:
sb2 = addob(lf->pack, "spellbook of modification magic");
break;
@ -9434,7 +9305,6 @@ void givesubjob(lifeform_t *lf, enum SUBJOB sj) {
addtempflag(lf->flags, F_CANLEARN, SK_SS_FIRE, PR_ADEPT, NA, NULL, FROMJOB);
addtempflag(lf->flags, F_CANLEARN, SK_SS_COLD, PR_ADEPT, NA, NULL, FROMJOB);
addtempflag(lf->flags, F_CANLEARN, SK_SS_AIR, PR_ADEPT, NA, NULL, FROMJOB);
addtempflag(lf->flags, F_CANLEARN, SK_SS_GRAVITY, PR_ADEPT, NA, NULL, FROMJOB);
addtempflag(lf->flags, F_CANLEARN, SK_SS_MODIFICATION, PR_ADEPT, NA, NULL, FROMJOB);
addtempflag(lf->flags, F_CANLEARN, SK_SS_TRANSLOCATION, PR_ADEPT, NA, NULL, FROMJOB);
addtempflag(lf->flags, F_CANLEARN, SK_SS_WILD, PR_ADEPT, NA, NULL, FROMJOB);
@ -11834,10 +11704,8 @@ int isspellskill(enum SKILL skid) {
case SK_SS_AIR:
case SK_SS_DEATH:
case SK_SS_DIVINATION:
case SK_SS_ENCHANTMENT:
case SK_SS_FIRE:
case SK_SS_COLD:
case SK_SS_GRAVITY:
case SK_SS_LIFE:
case SK_SS_MODIFICATION:
case SK_SS_SUMMONING:
@ -12324,6 +12192,9 @@ skill_t *addskill(enum SKILL id, char *name, char *desc, int traintime) {
// props
a->id = id;
a->name = strdup(name);
a->shortname = strdup(name);
//
strrep(a->shortname, "Sorcery:", "", NULL);
a->desc = strdup(desc);
a->traintime = traintime;
a->nskilldesc = 0;
@ -13790,6 +13661,7 @@ void losehpeffects(lifeform_t *lf, int dam, enum DAMTYPE damtype, lifeform_t *fr
flag_t *retflag[MAXCANDIDATES],*f;
int nretflags;
char buf[BUFLEN],lfname[BUFLEN];
getlfname(lf, lfname);
if (lf->hp > 0) {
// effects based on damage type
if (damtype == DT_COLD) {
@ -13826,8 +13698,6 @@ void losehpeffects(lifeform_t *lf, int dam, enum DAMTYPE damtype, lifeform_t *fr
if (isplayer(lf)) {
msg("You are engulfed in flames!");
} else if (cansee(player, lf)) {
char lfname[BUFLEN];
getlfname(lf, lfname);
msg("%s is engulfed in flames!", lfname);
}
addobfast(lf->cell->obpile, OT_FIRESMALL);
@ -19516,6 +19386,7 @@ int unweild(lifeform_t *lf, object_t *o) {
int useability(lifeform_t *lf, enum OBTYPE aid, lifeform_t *who, cell_t *where) {
int rv;
flag_t *cwflag;
float stamcost = 0;
if (!cancast(lf, aid, NULL)) {
if (isplayer(lf)) {
// announce
@ -19543,6 +19414,17 @@ int useability(lifeform_t *lf, enum OBTYPE aid, lifeform_t *who, cell_t *where)
return B_TRUE;
}
stamcost = getstamcost(lf, aid);
if (stamcost) {
if (getstamina(lf) < stamcost) {
if (isplayer(lf)) {
msg("You are too tired to do that right now.");
}
return B_TRUE;
}
}
// taketime() will happen during abiltiyeffects()
// use the ability

4
move.c
View File

@ -2862,8 +2862,8 @@ int trymove(lifeform_t *lf, int dir, int onpurpose, int strafe) {
break;
case RD_FORWARDS:
if (hasactivespell(lf, OT_S_TAILWIND)) {
// faster
howlong = pctof(75, howlong);
// 50% faster
howlong = pctof(50, howlong);
}
break;
default:

146
objects.c
View File

@ -3389,26 +3389,6 @@ objecttype_t *findotn(char *name) {
}
// ie. "the apple is xxx"
// ie. "the apples are xxx"
char *getfillingname(int nutrition) {
if (nutrition > 100) {
return "extremely substantial";
} else if (nutrition >= 90) {
return "very filling";
} else if (nutrition >= 70) {
return "ample for a meal";
} else if (nutrition >= 50) {
return "enough for a light meal";
} else if (nutrition >= 25) {
return "snack-sized";
} else if (nutrition > 0) {
return "barely worth eating";
}
// ie. < 0
return "of zero nutritional substance";
}
int getfirearmrange(object_t *o) {
flag_t *f;
f = hasflag(o->flags, F_RANGE);
@ -4177,77 +4157,6 @@ enum OBTYPE getrandomtrapforob(void) {
return poss[rnd(0,nposs-1)];
}
char *getdamname(enum DAMTYPE damtype) {
switch (damtype) {
case DT_ALL: return "all damage";
case DT_ACID: return "acid";
case DT_BASH: return "bludgeoning";
case DT_BITE: return "biting";
case DT_CHOP: return "chopping";
case DT_COLD: return "cold";
case DT_CRUSH: return "crushing";
case DT_DIRECT: return "direct";
case DT_DECAY: return "decay";
case DT_ELECTRIC: return "electricity";
case DT_EXPLOSIVE: return "explosive";
case DT_FALL: return "falling";
case DT_FIRE: return "fire";
case DT_HEAT: return "heat";
case DT_HOLY: return "holy damage";
case DT_LIGHT: return "light";
case DT_MAGIC: return "magical";
case DT_MELT: return "melting";
case DT_NECROTIC: return "lifedrain";
case DT_PETRIFY: return "petrification";
case DT_PIERCE: return "piercing";
case DT_POISON: return "poison";
case DT_POISONGAS: return "gas";
case DT_PROJECTILE: return "projectile";
case DT_SLASH: return "slashing";
case DT_SONIC: return "sonic";
case DT_TOUCH: return "touch";
case DT_UNARMED: return "unarmed";
case DT_WATER: return "water";
default: return "unknown";
}
return "unknown";
}
char *getdamnamenoun(enum DAMTYPE damtype) {
switch (damtype) {
case DT_ALL: return "all damage";
case DT_ACID: return "acid";
case DT_MELT: return "melting";
case DT_PETRIFY: return "petrification";
case DT_PIERCE: return "piercing damage";
case DT_POISONGAS: return "gas";
case DT_POISON: return "poison";
case DT_SLASH: return "slashing damage";
case DT_ELECTRIC: return "electricity";
case DT_EXPLOSIVE: return "explosives";
case DT_FIRE: return "fire";
case DT_HEAT: return "heat";
case DT_BITE: return "bite";
case DT_BASH: return "bludgeoning";
case DT_CHOP: return "chopping";
case DT_COLD: return "cold";
case DT_PROJECTILE: return "projectiles";
case DT_HOLY: return "holy damage";
case DT_DIRECT: return "direct damage";
case DT_DECAY: return "decay damage";
case DT_WATER: return "water";
case DT_MAGIC: return "magical damage";
case DT_NECROTIC: return "lifedrain damage";
case DT_TOUCH: return "touch effects";
case DT_UNARMED: return "unarmed damage";
case DT_LIGHT: return "light damage";
case DT_CRUSH: return "crushing damage";
case DT_SONIC: return "sonic damage";
case DT_FALL: return "damage from falling";
default: return "unknown";
}
return "unkmown";
}
char *gethiddenname(object_t *o) {
knowledge_t *k;
@ -6198,57 +6107,6 @@ enum SPELLSCHOOL getschool(enum OBTYPE sid) {
return SS_NONE;
}
char *getschoolname(enum SPELLSCHOOL sch) {
switch (sch) {
case SS_ABILITY: return "Abilities";
case SS_ALLOMANCY: return "Allomancy";
case SS_DIVINE: return "Divine Powers";
case SS_ENCHANTMENT: return "Enchantments";
case SS_WILD: return "Wild Magic";
case SS_MENTAL: return "Psionic Powers";
case SS_AIR: return "Air Magic";
case SS_FIRE: return "Fire Magic";
case SS_COLD: return "Cold Magic";
case SS_MODIFICATION: return "Modification Magic";
case SS_DEATH: return "Necromancy";
case SS_NATURE: return "Enviromancy";
case SS_LIFE: return "Life Magic";
case SS_DIVINATION: return "Divination Magic";
case SS_TRANSLOCATION: return "Translocation Magic";
case SS_SUMMONING: return "Summoning Magic";
case SS_GRAVITY: return "Gravitation Magic";
default:
break;
}
return "badschool";
}
char *getschoolnameshort(enum SPELLSCHOOL sch) {
switch (sch) {
case SS_ABILITY: return "Abilities";
case SS_ALLOMANCY: return "Allomancy";
case SS_DIVINE: return "Divine Powers";
case SS_WILD: return "Wild Magic";
case SS_AIR: return "Air Magic";
case SS_FIRE: return "Fire Magic";
case SS_COLD: return "Cold Magic";
case SS_DEATH: return "Necromancy";
case SS_ENCHANTMENT: return "Enchantment";
case SS_LIFE: return "Life Magic";
case SS_MENTAL: return "Psionic Powers";
case SS_MODIFICATION: return "Modification";
case SS_NATURE: return "Nature";
case SS_DIVINATION: return "Divination";
case SS_TRANSLOCATION: return "Translocation";
case SS_SUMMONING: return "Summoning";
case SS_GRAVITY: return "Gravitation";
case SS_LAST: return "!invalid school!";
default:
break;
}
return "unknown school";
}
void setwaterdepth(cell_t *c, int depth) {
object_t *o;
if (depth > 0) {
@ -11121,6 +10979,7 @@ int readsomething(lifeform_t *lf, object_t *o) {
// too hard?
if (getspellpower(lf, linkspell->id) > 0) {
/*
// try to learn it
int difficulty, mod;
difficulty = 15 + (getspelllevel(linkspell->id)*3);
@ -11131,6 +10990,9 @@ int readsomething(lifeform_t *lf, object_t *o) {
} else {
msg("^bYou fail to learn %s.",linkspell->name);
}
*/
// learn it
addflag(lf->flags, F_CANCAST, linkspell->id, NA, NA, NULL);
} else {
if (isplayer(lf)) msg("This spell is too hard for you to learn right now.");
}

View File

@ -101,9 +101,6 @@ objecttype_t *getrandomammofor(object_t *o);
brand_t *getrandombrandfor(objecttype_t *ot);
objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity, lifeform_t *forlf);
enum OBTYPE getrandomtrapforob(void);
char *getdamname(enum DAMTYPE damtype);
char *getdamnamenoun(enum DAMTYPE damtype);
char *getfillingname(int nutrition);
int getfirearmrange(object_t *o);
int getfirearmspeed(object_t *o);
glyph_t *getglyph(object_t *o);
@ -147,8 +144,6 @@ char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf, int depthmod
enum OBCLASS getrandomobclass(enum HABITAT hab);
int getobrarity(object_t *o, enum RARITY *rr);
enum SPELLSCHOOL getschool(enum OBTYPE sid);
char *getschoolname(enum SPELLSCHOOL sch);
char *getschoolnameshort(enum SPELLSCHOOL sch);
int getshatterdam(object_t *o);
float getshopprice(object_t *o, lifeform_t *buyer, object_t *shop);
int getstairdirection(object_t *o);

47
spell.c
View File

@ -58,7 +58,6 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
char buf[BUFLEN];
int power = 0,needgrab = B_FALSE, range = 0;
char damstr[BUFLEN],racestr[BUFLEN];
float stamcost = 0;
objecttype_t *ot;
flag_t *f;
@ -97,19 +96,6 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
getlfname(target, targetname);
}
stamcost = getstamcost(user, abilid);
if (stamcost) {
if (getstamina(user) < stamcost) {
if (isplayer(user)) {
msg("You are too tired to do that right now.");
}
return B_TRUE;
}
}
if (abilid == OT_A_CHARGE) {
cell_t *adjcell = NULL,*origcell;
char targetname[BUFLEN];
@ -2535,20 +2521,20 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
// this call will also remove this ability...
setrace(user, f->val[0], B_TRUE);
} else if (abilid == OT_A_PRAY) {
lifeform_t *lf;
lifeform_t *god;
if (!isplayer(user)) return B_FALSE;
// ask for which god
initprompt(&prompt, "To whom will you pray?");
prompt.maycancel = B_TRUE;
lf = askgod("To whom will you pray?", B_FALSE);
if (!lf) {
god = askgod("To whom will you pray?", B_FALSE);
if (!god) {
msg("Cancelled.");
return B_TRUE;
}
prayto(user, lf);
prayto(user, god);
} else if (abilid == OT_A_LEARN) {
skill_t *sk;
char ch = 'a';
@ -5862,18 +5848,22 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
}
} else if (spellid == OT_S_FORCESPHERE) {
cell_t *retcell[MAXRETCELLS];
char buf[BUFLEN];
int radius,nretcells,n,i;
if (!target) target = caster;
targcell = target->cell;
radius = power/3;
limit(&radius, 1, NA);
if (isplayer(target)) {
msg("You unleash a mighty shockwave!");
sprintf(buf, "You unleash a mighty shockwave!");
if (seenbyplayer) *seenbyplayer = B_TRUE;
animradial(caster->cell, radius, '}', C_RED, DT_COMPASS, buf, buf);
} else if (cansee(player, target)) {
char tname[BUFLEN];
getlfname(target, tname);
msg("%s unleashes a mighty shockwave!", tname);
sprintf(buf, "%s unleashes a mighty shockwave!", tname);
if (seenbyplayer) *seenbyplayer = B_TRUE;
animradial(caster->cell, radius, '}', C_RED, DT_COMPASS, buf, buf);
}
// start at outside.
for (n = radius; n >= 1; n--) {
@ -11084,6 +11074,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
f = addtempflag(caster->flags, F_WINDSHIELD, power, NA, NA, NULL, FROMSPELL);
f->obfrom = spellid;
f = addtempflag(target->flags, F_RETALIATE, 1, power, DT_BASH, "whirling debris", FROMSPELL);
f->obfrom = spellid;
} else if (spellid == OT_S_WISHLIMITED) {
object_t *o = NULL;
char obname[BUFLEN];
@ -11401,12 +11393,11 @@ void fizzle(lifeform_t *caster) {
enum OBTYPE getfirstwizspell(enum SPELLSCHOOL school) {
enum OBTYPE firstspell = OT_S_MANASPIKE;
switch (school) {
case SS_AIR: firstspell = OT_S_MIST; break;
case SS_AIR: firstspell = OT_S_JOLT; break;
case SS_COLD: firstspell = OT_S_CHILL; break;
case SS_FIRE: firstspell = OT_S_SPARK; break;
case SS_DEATH: firstspell = OT_S_STENCH; break;
case SS_DIVINATION: firstspell = OT_S_SIXTHSENSE; break;
case SS_GRAVITY: firstspell = OT_S_TRUESTRIKE; break;
//case SS_MODIFICATION: firstspell = OT_S_HOLDPORTAL; break;
case SS_MODIFICATION: firstspell = OT_S_OBJECTGROWTH; break;
case SS_TRANSLOCATION: firstspell = OT_S_APPORTATION; break;
@ -11557,6 +11548,7 @@ enum SPELLSCHOOL getrandomspellschool(lifeform_t *wantknowntolf, int wantknown)
return poss[rnd(0,nposs-1)];
}
enum SKILL getschoolskill(enum SPELLSCHOOL ss) {
switch (ss) {
case SS_ALLOMANCY:
@ -11567,16 +11559,12 @@ enum SKILL getschoolskill(enum SPELLSCHOOL ss) {
return SK_SS_DEATH;
case SS_DIVINATION:
return SK_SS_DIVINATION;
case SS_ENCHANTMENT:
return SK_SS_ENCHANTMENT;
case SS_NATURE:
return SK_SS_NATURE;
case SS_FIRE:
return SK_SS_FIRE;
case SS_COLD:
return SK_SS_COLD;
case SS_GRAVITY:
return SK_SS_GRAVITY;
case SS_LIFE:
return SK_SS_LIFE;
case SS_MODIFICATION:
@ -11606,16 +11594,12 @@ enum SPELLSCHOOL getskillschool(enum SKILL skid) {
return SS_DEATH;
case SK_SS_DIVINATION:
return SS_DIVINATION;
case SK_SS_ENCHANTMENT:
return SS_ENCHANTMENT;
case SK_SS_NATURE:
return SS_NATURE;
case SK_SS_FIRE:
return SS_FIRE;
case SK_SS_COLD:
return SS_COLD;
case SK_SS_GRAVITY:
return SS_GRAVITY;
case SK_SS_LIFE:
return SS_LIFE;
case SK_SS_MODIFICATION:
@ -12159,7 +12143,8 @@ char *getspelldesc(enum OBTYPE spellid, int power, char *buf) {
snprintf(buf, BUFLEN, "missiles return to source");
break;
case OT_S_WINDSHIELD:
snprintf(buf, BUFLEN, "Protection from missiles <= %d km/h",speedtokph(power));
snprintf(buf, BUFLEN, "Protection from missiles <= %d km/h, 1-%d dmg to attackers",speedtokph(power),
power);
break;
default:
break;

340
text.c
View File

@ -599,6 +599,171 @@ char *getattrabbrev(enum ATTRIB att) {
return "??";
}
char *getattrbracketname(enum ATTRIB whichatt, enum ATTRBRACKET brack) {
switch (brack) {
case AT_EXLOW:
switch (whichatt) {
case A_CHA:
return "hideous";
case A_CON:
return "frail";
case A_AGI:
return "uncoordinated";
case A_IQ:
return "vegetable";
case A_STR:
return "helpless";
case A_WIS:
return "witless";
default:
return "?extralow?";
}
break;
case AT_VLOW:
switch (whichatt) {
case A_CHA:
return "repulsive";
case A_CON:
return "sickly";
case A_AGI:
return "oafish";
case A_IQ:
return "animal";
case A_STR:
return "feeble";
case A_WIS:
return "reckless";
default:
return "?verylow?";
}
break;
case AT_LOW:
switch (whichatt) {
case A_CHA:
return "ugly";
case A_CON:
return "unhealthy";
case A_AGI:
return "clumsy";
case A_IQ:
return "dim-witted";
case A_STR:
return "very weak";
case A_WIS:
return "foolish";
default:
return "?low?";
}
break;
case AT_LTAVERAGE:
switch (whichatt) {
case A_CHA:
return "unattractive";
case A_CON:
return "unfit";
case A_AGI:
return "awkward";
case A_IQ:
return "dopey";
case A_STR:
return "weak";
case A_WIS:
return "naive";
default:
return "?lt_average?";
}
break;
case AT_AVERAGE:
switch (whichatt) {
case A_CHA:
case A_CON:
case A_AGI:
case A_STR:
case A_IQ:
case A_WIS:
return "average";
default:
return "?average?";
}
break;
case AT_GTAVERAGE:
switch (whichatt) {
case A_CHA:
return "attractive";
case A_CON:
return "healthy";
case A_AGI:
return "dextrous";
case A_IQ:
return "smart";
case A_STR:
return "strong";
case A_WIS:
return "prudent";
default:
return "?gt_average?";
}
break;
case AT_HIGH:
switch (whichatt) {
case A_CHA:
return "alluring";
case A_CON:
return "very fit";
case A_AGI:
return "nimble";
case A_IQ:
return "enlightened";
case A_STR:
return "mighty";
case A_WIS:
return "astute";
default:
return "?high?";
}
break;
case AT_VHIGH:
switch (whichatt) {
case A_CHA:
return "beautiful";
case A_CON:
return "hardy";
case A_AGI:
return "agile";
case A_IQ:
return "genius";
case A_STR:
return "powerful";
case A_WIS:
return "wise";
default:
return "?veryhigh?";
}
break;
case AT_EXHIGH:
switch (whichatt) {
case A_CHA:
return "stunning";
case A_CON:
return "very hardy";
case A_AGI:
return "very agile";
case A_IQ:
return "supergenius";
case A_STR:
return "titanic";
case A_WIS:
return "sagely";
default:
return "?exhigh?";
}
break;
case AT_RANDOM:
return "random";
}
return "?unknown?";
}
char *getattrname(enum ATTRIB att) {
switch (att) {
case A_NONE:
@ -619,6 +784,79 @@ char *getattrname(enum ATTRIB att) {
return "?badattrib?";
}
char *getdamname(enum DAMTYPE damtype) {
switch (damtype) {
case DT_ALL: return "all damage";
case DT_ACID: return "acid";
case DT_BASH: return "bludgeoning";
case DT_BITE: return "biting";
case DT_CHOP: return "chopping";
case DT_COLD: return "cold";
case DT_CRUSH: return "crushing";
case DT_DIRECT: return "direct";
case DT_DECAY: return "decay";
case DT_ELECTRIC: return "electricity";
case DT_EXPLOSIVE: return "explosive";
case DT_FALL: return "falling";
case DT_FIRE: return "fire";
case DT_HEAT: return "heat";
case DT_HOLY: return "holy damage";
case DT_LIGHT: return "light";
case DT_MAGIC: return "magical";
case DT_MELT: return "melting";
case DT_NECROTIC: return "lifedrain";
case DT_PETRIFY: return "petrification";
case DT_PIERCE: return "piercing";
case DT_POISON: return "poison";
case DT_POISONGAS: return "gas";
case DT_PROJECTILE: return "projectile";
case DT_SLASH: return "slashing";
case DT_SONIC: return "sonic";
case DT_TOUCH: return "touch";
case DT_UNARMED: return "unarmed";
case DT_WATER: return "water";
default: return "unknown";
}
return "unknown";
}
char *getdamnamenoun(enum DAMTYPE damtype) {
switch (damtype) {
case DT_ALL: return "all damage";
case DT_ACID: return "acid";
case DT_MELT: return "melting";
case DT_PETRIFY: return "petrification";
case DT_PIERCE: return "piercing damage";
case DT_POISONGAS: return "gas";
case DT_POISON: return "poison";
case DT_SLASH: return "slashing damage";
case DT_ELECTRIC: return "electricity";
case DT_EXPLOSIVE: return "explosives";
case DT_FIRE: return "fire";
case DT_HEAT: return "heat";
case DT_BITE: return "bite";
case DT_BASH: return "bludgeoning";
case DT_CHOP: return "chopping";
case DT_COLD: return "cold";
case DT_PROJECTILE: return "projectiles";
case DT_HOLY: return "holy damage";
case DT_DIRECT: return "direct damage";
case DT_DECAY: return "decay damage";
case DT_WATER: return "water";
case DT_MAGIC: return "magical damage";
case DT_NECROTIC: return "lifedrain damage";
case DT_TOUCH: return "touch effects";
case DT_UNARMED: return "unarmed damage";
case DT_LIGHT: return "light damage";
case DT_CRUSH: return "crushing damage";
case DT_SONIC: return "sonic damage";
case DT_FALL: return "damage from falling";
default: return "unknown";
}
return "unkmown";
}
char *getdirname(int dir) {
switch (dir) {
case D_N:
@ -725,6 +963,28 @@ void getdisttext(cell_t *src, cell_t *dst,char *distbuf, char *distbufapprox, ch
}
// ie. "the apple is xxx"
// ie. "the apples are xxx"
char *getfillingname(int nutrition) {
if (nutrition > 100) {
return "extremely substantial";
} else if (nutrition >= 90) {
return "very filling";
} else if (nutrition >= 70) {
return "ample for a meal";
} else if (nutrition >= 50) {
return "enough for a light meal";
} else if (nutrition >= 25) {
return "snack-sized";
} else if (nutrition > 0) {
return "barely worth eating";
}
// ie. < 0
return "of zero nutritional substance";
}
char *getflagsourcetext(flag_t *f) {
switch (f->lifetime) {
case FROMSKILL: return " (skill perk)";
@ -1198,6 +1458,54 @@ char *getsizetext(enum LFSIZE sz) {
return "unknown-sized";
}
char *getschoolname(enum SPELLSCHOOL sch) {
switch (sch) {
case SS_ABILITY: return "Abilities";
case SS_ALLOMANCY: return "Allomancy";
case SS_DIVINE: return "Divine Powers";
case SS_WILD: return "Wild Magic";
case SS_MENTAL: return "Psionic Powers";
case SS_AIR: return "Air Magic";
case SS_FIRE: return "Fire Magic";
case SS_COLD: return "Cold Magic";
case SS_MODIFICATION: return "Modification Magic";
case SS_DEATH: return "Necromancy";
case SS_NATURE: return "Enviromancy";
case SS_LIFE: return "Life Magic";
case SS_DIVINATION: return "Divination Magic";
case SS_TRANSLOCATION: return "Translocation Magic";
case SS_SUMMONING: return "Summoning Magic";
default:
break;
}
return "badschool";
}
char *getschoolnameshort(enum SPELLSCHOOL sch) {
switch (sch) {
case SS_ABILITY: return "Abilities";
case SS_ALLOMANCY: return "Allomancy";
case SS_DIVINE: return "Divine Powers";
case SS_WILD: return "Wild Magic";
case SS_AIR: return "Air Magic";
case SS_FIRE: return "Fire Magic";
case SS_COLD: return "Cold Magic";
case SS_DEATH: return "Necromancy";
case SS_LIFE: return "Life Magic";
case SS_MENTAL: return "Psionic Powers";
case SS_MODIFICATION: return "Modification";
case SS_NATURE: return "Nature";
case SS_DIVINATION: return "Divination";
case SS_TRANSLOCATION: return "Translocation";
case SS_SUMMONING: return "Summoning";
case SS_LAST: return "!invalid school!";
default:
break;
}
return "unknown school";
}
char *gettimetext(char *retbuf) {
int hours,mins,secs;
splittime(&hours, &mins, &secs);
@ -1755,6 +2063,38 @@ char *strstarts(char *a, char *prefix) {
return NULL;
}
int strlen_without_colours(char *buf) {
char *p;
int len = 0;
enum {
S_NORM,
S_COLOURDEF,
S_COLOURDEFNUM,
} state = S_NORM;
for (p = buf ; *p; p++) {
if (state == S_NORM) {
if (*p == '^') {
state = S_COLOURDEF;
} else {
len++;
}
} else if (state == S_COLOURDEF) {
if (isdigit(*p)) {
state = S_COLOURDEFNUM;
} else {
state = S_NORM;
}
} else { // ie. colourdefnum
if (!isdigit(*p)) {
state = S_NORM;
len++;
}
}
}
return len;
}
int strpixmatch(char *haystack, char *needle) {
int matched = B_FALSE;
char *hword, *nword, *hcont,*ncont;

7
text.h
View File

@ -13,10 +13,14 @@ int getaccuracynum(int accpct);
char *getalignmentname(enum ALIGNMENT al);
char *getattackverb(lifeform_t *lf, object_t *wep, enum DAMTYPE damtype, int dam, int maxhp);
char *getattrabbrev(enum ATTRIB att);
char *getattrbracketname(enum ATTRIB whichatt, enum ATTRBRACKET brack);
char *getattrname(enum ATTRIB att);
char *getdamname(enum DAMTYPE damtype);
char *getdamnamenoun(enum DAMTYPE damtype);
char *getdirname(int dir);
char *getdirnameshort(int dir);
void getdisttext(cell_t *src, cell_t *dst,char *distbuf, char *distbufapprox, char *dirbuf);
char *getfillingname(int nutrition);
char *getflagsourcetext(flag_t *f);
int gethitconferlifetime(char *text, int *min, int *max);
char *getkillverb(lifeform_t *victim, object_t *wep, enum DAMTYPE damtype, int dam, int maxhp);
@ -33,6 +37,8 @@ char *getrarityname(enum RARITY rr);
char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how);
char *getreldirname(int reldir);
char *getsizetext(enum LFSIZE sz);
char *getschoolname(enum SPELLSCHOOL sch);
char *getschoolnameshort(enum SPELLSCHOOL sch);
char *gettimetext(char *retbuf);
char *gettimetextfuzzy(char *retbuf, int wantpm);
char *getwaterdepthname(enum DEPTH d);
@ -59,6 +65,7 @@ char *dostrrep(char* in, char** out, char* oldtok, char* newtok, int *rv);
int streq(char *a, char *b);
char *strends(char *a, char *suffix);
char *strstarts(char *a, char *prefix);
int strlen_without_colours(char *buf);
int strpixmatch(char *haystack, char *needle);
int texttodice(char *text, int *ndice, int *nsides, int *bonus);
int texttospellopts(char *text, ... );