diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-01 04:00:00 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-01 04:00:00 +0000 |
commit | 04f5058cac8e12d3b85834bda4589239932f371a (patch) | |
tree | 20863dfb1b0a87c9643f0ca98ce2cb43cf195416 /crawl-ref/source/mon-util.cc | |
parent | 6e3985b473d0b26c028820b3d0a3808d3f3dd7ee (diff) | |
download | crawl-ref-04f5058cac8e12d3b85834bda4589239932f371a.tar.gz crawl-ref-04f5058cac8e12d3b85834bda4589239932f371a.zip |
Add some chaos attacks/weapons. Missiles and launchers of chaos fire a bolt of
a random type (including enchantments, which isn't so good since they don't
have a visible beam). Might want to add BEAM_CHAOS and make it a beam of that.
Weapons of chaos either does a random brand effect (fire, poison, etc) or a
random chaos effect (which includes cloning the attack victim).
The AF_CHAOS monster attack flavour either does a random monster flavour or
chaos effect (same chaos effects as for weapons).
The relative frequency of all the different effects/brands/flavours no doubt
needs adjustment.
All of this is currently only available via Xom. 10% of all common-type demons
sent in by Xom will be chaos spawn (the only kind that use AF_CHAOS, and never
randomly generated otherwise). All item gifts from Xom which are generated
with a brand will have their brand switched to chaos (this should probably be
made to happen less than 100% of the time). And finally one of Xom's bad acts
is to upgrade a non-branded weapon of a nearby hostile monster to a chaos brand
(this might need to be made less (or more) common).
Oh, and if a randart has a brand which would be identified if it were merely an
ego weapon, it now identifies the RAP_BRAND property of the randart.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7704 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 90 |
1 files changed, 68 insertions, 22 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 841ba05762..2e73ae5c9f 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -575,7 +575,8 @@ bool mons_is_chaotic(const monsters *mon) return (true); const int attk_flavour = mons_attack_spec(mon, 0).flavour; - return (attk_flavour == AF_MUTATE || attk_flavour == AF_ROT); + return (attk_flavour == AF_MUTATE || attk_flavour == AF_ROT + || attk_flavour == AF_CHAOS); } bool mons_is_poisoner(const monsters *mon) @@ -738,14 +739,19 @@ int get_shout_noise_level(const shout_type shout) } } -// Only the beast uses S_RANDOM for noise type. +// Only beasts and chaos spawns uses S_RANDOM for noise type. // Pandemonium lords can also get here but this mostly used for the // "says" verb used for insults. static bool _shout_fits_monster(int type, int shout) { - if (shout == NUM_SHOUTS || shout >= NUM_LOUDNESS) + if (shout == NUM_SHOUTS || shout >= NUM_LOUDNESS || shout == S_SILENT) return (false); + // Chaos spawns can do anything but demon taunts, since they're + // not coherenet enough to actually say words. + if (type == MONS_CHAOS_SPAWN) + return (shout != S_DEMON_TAUNT); + // For demon lords almost everything is fair game. // It's only used for the shouting verb ("say", "bellow", "roar", ...) // anyway. @@ -760,8 +766,6 @@ static bool _shout_fits_monster(int type, int shout) case S_WHINE: // The beast cannot speak. case S_DEMON_TAUNT: - // Silent is boring. - case S_SILENT: return (false); default: return (true); @@ -1018,17 +1022,16 @@ mon_attack_def mons_attack_spec(const monsters *mon, int attk_number) ASSERT(smc); mon_attack_def attk = smc->attack[attk_number]; + if (attk.type == AT_RANDOM) + attk.type = static_cast<mon_attack_type>(random_range(AT_HIT, + AT_BUTT)); + if (attk.flavour == AF_KLOWN) { - switch (random2(6)) - { - case 0: attk.flavour = AF_POISON_NASTY; break; - case 1: attk.flavour = AF_ROT; break; - case 2: attk.flavour = AF_DRAIN_XP; break; - case 3: attk.flavour = AF_FIRE; break; - case 4: attk.flavour = AF_COLD; break; - case 5: attk.flavour = AF_BLINK; break; - } + mon_attack_flavour flavours[] = + {AF_POISON_NASTY, AF_ROT, AF_DRAIN_XP, AF_FIRE, AF_COLD, AF_BLINK}; + + attk.flavour = RANDOM_ELEMENT(flavours); } return (zombified ? downscale_zombie_attack(mon, attk) : attk); @@ -3637,6 +3640,10 @@ void monsters::equip_weapon(item_def &item, int near, bool msg) case SPWPN_DISTORTION: mpr("Its appearance distorts for a moment."); break; + case SPWPN_CHAOS: + mpr("It is briefly surrounded by a scintillating arua of " + "random colours."); + break; default: // A ranged weapon without special message is known to be unbranded. @@ -3645,7 +3652,12 @@ void monsters::equip_weapon(item_def &item, int near, bool msg) } if (message_given) - set_ident_flags(item, ISFLAG_KNOW_TYPE); + { + if (is_random_artefact(item)) + randart_wpn_learn_prop(item, RAP_BRAND); + else + set_ident_flags(item, ISFLAG_KNOW_TYPE); + } } } @@ -3739,7 +3751,12 @@ void monsters::unequip_weapon(item_def &item, int near, bool msg) message_given = false; } if (message_given) - set_ident_flags(item, ISFLAG_KNOW_TYPE); + { + if (is_random_artefact(item)) + randart_wpn_learn_prop(item, RAP_BRAND); + else + set_ident_flags(item, ISFLAG_KNOW_TYPE); + } } } @@ -4687,6 +4704,8 @@ std::string monsters::hand_name(bool plural, bool *can_plural) const std::string str; char ch = mons_char(type); + const bool rand = (type == MONS_CHAOS_SPAWN); + switch(get_mon_shape(this)) { case MON_SHAPE_CENTAUR: @@ -4705,7 +4724,7 @@ std::string monsters::hand_name(bool plural, bool *can_plural) const case MON_SHAPE_QUADRUPED_TAILLESS: case MON_SHAPE_QUADRUPED_WINGED: case MON_SHAPE_ARACHNID: - if (type == MONS_SCORPION) + if (type == MONS_SCORPION || rand && one_chance_in(4)) str = "pincer"; else { @@ -4738,7 +4757,7 @@ std::string monsters::hand_name(bool plural, bool *can_plural) const break; case MON_SHAPE_MISC: - if (ch == 'x' || ch == 'X') + if (ch == 'x' || ch == 'X' || rand) { str = "tentacle"; break; @@ -4768,14 +4787,25 @@ std::string monsters::hand_name(bool plural, bool *can_plural) const case MONS_GIANT_ORANGE_BRAIN: default: - str = "body"; - can_plural = false; + if (rand) + str = "rhizome"; + else + { + str = "body"; + can_plural = false; + } break; } } if (str.empty()) + { + // Reduce the chance of a random-shaped monster having hands. + if (rand && coinflip()) + return (hand_name(plural, can_plural)); + str = "hand"; + } if (plural && *can_plural) str = pluralise(str); @@ -4793,6 +4823,8 @@ std::string monsters::foot_name(bool plural, bool *can_plural) const std::string str; char ch = mons_char(type); + const bool rand = (type == MONS_CHAOS_SPAWN); + switch(get_mon_shape(this)) { case MON_SHAPE_INSECT: @@ -4823,7 +4855,12 @@ std::string monsters::foot_name(bool plural, bool *can_plural) const case MON_SHAPE_QUADRUPED: case MON_SHAPE_QUADRUPED_TAILLESS: case MON_SHAPE_QUADRUPED_WINGED: - if (ch == 'h') + if (rand) + { + const char* feet[] = {"paw", "talon", "hoof"}; + str = RANDOM_ELEMENT(feet); + } + else if (ch == 'h') str = "paw"; else if (ch == 'l' || ch == 'D') str = "talon"; @@ -4862,7 +4899,7 @@ std::string monsters::foot_name(bool plural, bool *can_plural) const break; case MON_SHAPE_MISC: - if (ch == 'x' || ch == 'X') + if (ch == 'x' || ch == 'X' || rand) { str = "tentacle"; break; @@ -4877,7 +4914,13 @@ std::string monsters::foot_name(bool plural, bool *can_plural) const } if (str.empty()) + { + // Reduce the chance of a random-shaped monster having feet. + if (rand && coinflip()) + return (foot_name(plural, can_plural)); + return (plural ? "feet" : "foot"); + } if (plural && *can_plural) str = pluralise(str); @@ -7679,6 +7722,9 @@ mon_body_shape get_mon_shape(const monsters *mon) mon_body_shape get_mon_shape(const int type) { + if (type == MONS_CHAOS_SPAWN) + return static_cast<mon_body_shape>(random2(MON_SHAPE_MISC + 1)); + switch(mons_char(type)) { case 'a': // ants and cockroaches |