Elyvilon can now…
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3749 c06c8d41-db1a-0410-9941-cceddc491573
EOJPYR3QD5GGS7GB2P7SBLMOP7YC57YMIVR7VKCOMWNCKNBPESBQC AZSA7IMTRJG2X76NDDU3AP53VS4RQYIDVGJZR7SPWZ75G7ZJYRUAC SWOYPTHJAWFEDBMB3ROT33VQZIXGZD5UOXEV456DDUENW2HGA66QC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC WHY6LRRJ5T2NSBE3IUCR4X3TOAH7TTK5NPUPUIFT7TPNJ6J4HBDAC NLQNXH3SVJ52CWXEV35FSSZP32VHC4QFGN3HINF4KO5GZHZMOBKQC R22TTMI6WXWULC7ODKFF3QCB7MOTETQQ6IR4BUCUPOCQKQNCTT5AC QDTVLBRGHDTRUVT7I3O72K6TMOYAUSAJBZUHGOEFU2RKJNUPWZSQC E77ASJLF52YJ4DQIZ4GLNN3PB3AOUPWS5UVETBEHANA3U7OG3OJAC static void ely_destroy_inventory_weapon(){int count = 0;int item = ENDOFPACK;for (int i = 0; i < ENDOFPACK; i++){if (!is_valid_item( you.inv[i] ))continue;if (you.inv[i].base_type == OBJ_WEAPONS|| you.inv[i].base_type == OBJ_MISSILES){if (is_artefact(you.inv[i]))continue;// item is valid for destroying, so give it a chancecount++;if (one_chance_in( count ))item = i;}}// any item to destroy?if (item == ENDOFPACK)return;
int value = 1;bool wielded = false;// increase value wielded weapons or large stacks of ammoif (you.inv[item].base_type == OBJ_WEAPONS&& you.inv[item].link == you.equip[EQ_WEAPON]){wielded = true;value += 2;}else if (you.inv[item].quantity > random2(you.penance[GOD_ELYVILON]))value += 1 + random2(2);std::ostream& strm = msg::streams(MSGCH_GOD);strm << you.inv[item].name(DESC_CAP_YOUR);if (value == 1)strm << " barely";if ( you.inv[item].quantity == 1 )strm << " shimmers and breaks into pieces." << std::endl;elsestrm << " shimmer and break into pieces." << std::endl;if (wielded){unwield_item(true);you.wield_change = true;}// just in caseyou.quiver_change = true;destroy_item(you.inv[item]);burden_change();dec_penance(GOD_ELYVILON, value);}// comparatively lenientstatic bool elyvilon_retribution(){const god_type god = GOD_ELYVILON;simple_god_message("'s displeasure finds you.", god);// healing theme and interfering with fightingswitch (random2(5)){case 0:case 1:confuse_player( 3 + random2(10), false );break;case 2: // mostly flavour messagesmiscast_effect(SPTYP_POISON, 0, 0, one_chance_in(3),"the will of Elyvilon");break;case 3:case 4: // destroy weapons in your inventoryely_destroy_inventory_weapon();break;}return true;}
static bool ely_heals_monster(monsters *monster, killer_type killer, int i){god_type god = GOD_ELYVILON;ASSERT(you.religion != god);const int ely_penance = you.penance[god];ASSERT(ely_penance > 0);if (mons_holiness(monster) != MH_NATURAL|| mons_friendly(monster)|| !one_chance_in(10)){return (false);}if (MON_KILL(killer)){monsters *mon = &menv[i];if (!mons_friendly(mon) || !one_chance_in(3))return (false);if (!mons_near(monster))return (false);}else if (!YOU_KILL(killer))return (false);
#ifdef DEBUG_DIAGNOSTICSmprf(MSGCH_DIAGNOSTICS, "monster hp: %d, max hp: %d",monster->hit_points, monster->max_hit_points);#endifmonster->hit_points = std::min(1 + random2(ely_penance/3),monster->max_hit_points);#ifdef DEBUG_DIAGNOSTICSmprf(MSGCH_DIAGNOSTICS, "new hp: %d, ely penance: %d",monster->hit_points, ely_penance);#endifsnprintf(info, INFO_SIZE, "%s heals %s%s",god_name(god, false).c_str(),monster->name(DESC_NOCAP_THE).c_str(),monster->hit_points * 2 <= monster->max_hit_points ? "." : "!");god_speaks(god, info);dec_penance(god, 1 + random2(monster->hit_points/2));return (true);}
if (to_hit >= def->ev || one_chance_in(30))
bool ely_block = false;if (you.religion != GOD_ELYVILON && you.penance[GOD_ELYVILON]&& to_hit >= def->ev && one_chance_in(20)){simple_god_message(" blocks your attack.", GOD_ELYVILON);ely_block = true;}if (!ely_block && (to_hit >= def->ev || one_chance_in(30)))