From: <ha...@us...> - 2007-11-29 15:49:49
|
Revision: 2933 http://crawl-ref.svn.sourceforge.net/crawl-ref/?rev=2933&view=rev Author: haranp Date: 2007-11-29 07:49:47 -0800 (Thu, 29 Nov 2007) Log Message: ----------- Added Spark card. Added more pain effects. Breaks Nemelexite saves. Modified Paths: -------------- trunk/crawl-ref/source/decks.cc trunk/crawl-ref/source/decks.h trunk/crawl-ref/source/spells4.cc Modified: trunk/crawl-ref/source/decks.cc =================================================================== --- trunk/crawl-ref/source/decks.cc 2007-11-29 08:51:26 UTC (rev 2932) +++ trunk/crawl-ref/source/decks.cc 2007-11-29 15:49:47 UTC (rev 2933) @@ -80,7 +80,7 @@ static card_type a_deck_of_destruction[] = { CARD_VITRIOL, CARD_FLAME, CARD_FROST, CARD_VENOM, CARD_HAMMER, - CARD_PAIN, CARD_TORMENT + CARD_SPARK, CARD_PAIN, CARD_TORMENT }; DEFVEC(deck_of_destruction); @@ -251,6 +251,7 @@ case CARD_FLAME: return "Flame"; case CARD_FROST: return "Frost"; case CARD_VENOM: return "Venom"; + case CARD_SPARK: return "the Spark"; case CARD_HAMMER: return "the Hammer"; case CARD_PAIN: return "Pain"; case CARD_TORMENT: return "Torment"; @@ -1463,6 +1464,52 @@ } } +static int drain_monsters(int x, int y, int pow, int garbage) +{ + UNUSED( garbage ); + if ( coord_def(x,y) == you.pos() ) + drain_exp(); + else + { + const int mnstr = mgrd[x][y]; + if (mnstr == NON_MONSTER) + return 0; + + monsters& mon = menv[mnstr]; + + if (mons_res_negative_energy(&mon) > 0) + simple_monster_message(&mon, " is unaffected."); + else + { + simple_monster_message(&mon, " is drained."); + + if (random2(20) < pow/60) + { + mon.hit_dice--; + mon.experience = 0; + } + + mon.max_hit_points -= 2 + random2(pow/50); + mon.hit_points -= 2 + random2(50); + + if (mon.hit_points >= mon.max_hit_points) + mon.hit_points = mon.max_hit_points; + + if (mon.hit_dice < 1) + mon.hit_points = 0; + + if ( mon.hit_points <= 0 ) + monster_die( &mon, KILL_YOU, 0 ); + } + } + return 1; +} + +static void mass_drain(int pow) +{ + apply_area_visible(drain_monsters, pow); +} + // Return true if it was a "genuine" draw, i.e., there was a monster // to target. This is still exploitable by finding popcorn monsters. static bool damaging_card(card_type card, int power, deck_rarity_type rarity) @@ -1479,6 +1526,9 @@ ZAP_CRYSTAL_SPEAR }; const zap_type venomzaps[3] = { ZAP_STING, ZAP_VENOM_BOLT, ZAP_POISON_ARROW }; + const zap_type sparkzaps[3] = { ZAP_ELECTRICITY, ZAP_LIGHTNING, + ZAP_ORB_OF_ELECTRICITY }; + const zap_type painzaps[2] = { ZAP_AGONY, ZAP_NEGATIVE_ENERGY }; switch ( card ) { @@ -1502,8 +1552,18 @@ ztype = venomzaps[power_level]; break; + case CARD_SPARK: + ztype = sparkzaps[power_level]; + break; + case CARD_PAIN: - ztype = ZAP_AGONY; + if ( power_level == 2 ) + { + mass_drain(power); + return true; + } + else + ztype = painzaps[power_level]; break; default: @@ -2237,7 +2297,7 @@ break; case CARD_VITRIOL: case CARD_FLAME: case CARD_FROST: case CARD_HAMMER: - case CARD_PAIN: + case CARD_SPARK: case CARD_PAIN: rc = damaging_card(which_card, power, rarity); break; Modified: trunk/crawl-ref/source/decks.h =================================================================== --- trunk/crawl-ref/source/decks.h 2007-11-29 08:51:26 UTC (rev 2932) +++ trunk/crawl-ref/source/decks.h 2007-11-29 15:49:47 UTC (rev 2933) @@ -74,6 +74,7 @@ CARD_FROST, // cold damage CARD_VENOM, // poison damage CARD_HAMMER, // pure damage + CARD_SPARK, // lightning damage CARD_PAIN, // single target, like spell of agony CARD_TORMENT, // Symbol of Torment Modified: trunk/crawl-ref/source/spells4.cc =================================================================== --- trunk/crawl-ref/source/spells4.cc 2007-11-29 08:51:26 UTC (rev 2932) +++ trunk/crawl-ref/source/spells4.cc 2007-11-29 15:49:47 UTC (rev 2933) @@ -693,25 +693,30 @@ static int sleep_monsters(int x, int y, int pow, int garbage) { UNUSED( garbage ); - int mnstr = mgrd[x][y]; + const int mnstr = mgrd[x][y]; - if (mnstr == NON_MONSTER) return 0; - if (mons_holiness(&menv[mnstr]) != MH_NATURAL) return 0; - if (check_mons_resist_magic( &menv[mnstr], pow )) return 0; + if (mnstr == NON_MONSTER) + return 0; - // Why shouldn't we be able to sleep friendly monsters? -- bwr - // if (mons_friendly( &menv[mnstr] )) return 0; + monsters& mon = menv[mnstr]; + if (mons_holiness(&mon) != MH_NATURAL) + return 0; + if (check_mons_resist_magic( &mon, pow )) + return 0; + + // works on friendlies too, so no check for that + //jmf: now that sleep == hibernation: - if (mons_res_cold( &menv[mnstr] ) > 0 && coinflip()) + if (mons_res_cold( &mon ) > 0 && coinflip()) return 0; - if (menv[mnstr].has_ench(ENCH_SLEEP_WARY)) + if (mon.has_ench(ENCH_SLEEP_WARY)) return 0; - menv[mnstr].put_to_sleep(); + mon.put_to_sleep(); - if (mons_class_flag( menv[mnstr].type, M_COLD_BLOOD ) && coinflip()) - menv[mnstr].add_ench(ENCH_SLOW); + if (mons_class_flag( mon.type, M_COLD_BLOOD ) && coinflip()) + mon.add_ench(ENCH_SLOW); return 1; } // end sleep_monsters() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |