Fixed monsters getting bad experience values.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2586 c06c8d41-db1a-0410-9941-cceddc491573
NLQNXH3SVJ52CWXEV35FSSZP32VHC4QFGN3HINF4KO5GZHZMOBKQC UKSYWIOMOVYPUG6FXRWC7FCAWKHRNSHZKUU5GDP5XPEUJVEJE5IAC NRHBB2THNHO6AHMOUWR7BZ3WZTW37R2WGEQ3RXKBVAMCWNZTVA5QC PIGVTTBAQGNHOCX6IXJLGVVURBAT77SD6FQUVTTI5SFTV563GMZQC WNDCC2WZEUQ2SHRQZUAAK3A4QF5JGLDJ5D3WLKLNXYSCK4TZ7KZAC 3CMMAOYW3XCVFBCT2RT6YH5BLVAWQT62QXXWWCMWIZKDFZBY4M2QC 5UC5TI7B6NWGIGN74QRBZKDBYUMHLM2ZO5ATXEZ6TZOGOLF3JX5QC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC PFEJ4LMDNEKLMGRCMWQ7EIRVU4JMYGICI4G7X4WVWOROVXQCBZ7QC GUXTGUEMZYBRGV5QUAQSJHG3AOIQDWWCDIMOX4LASFJAZVGL2WQAC XMX2Y7QSEXGV2SPDOFDNM2BQJH3S3WTMYLJYUREYV72NWTURHMSQC V4DWL5WBO2JCODVS5QQNWXDH4DAYZN3D5V3UDCHM2KKOMADOTEDQC KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC WZNB427K3EUNV3FMVXLQTM4UIHER4FIKQXWLUUXRNQC3OQ33VQYAC NVD2HSEW2ONWNYDDCTOMZZOUP6NG4DCXI4LNYYIY4BQEBDMJQK5AC VBG2GGMVC66LQM4OSI67VKXGAQK4GVOEHX3OL6V3IFOO52MQL72QC CQ24AVAI6SW3AHTIDMLPSTRRBEU6FHRF5I5FD6G5QIYE6PO4BQMQC BUSA7O6EFBZVAG2RL5T7MD2WTWKOEKKIAAZ2VS4Y3L6ECT4HQR6QC M6J5C74JDM5ZYIDPN7QXUCP6L44S2Z5XTRJMZBBRYOHA62IGYXKAC X7PZS2I6D2GCZVNUDZTSQ7WNI7MIFHVLRJ4FB7WRUHD6UZZEUGHAC C5VA63WAQRWPENIMXRPUPZLZJMC77PL2B3A77HYFWDCZU5QDG7VQC QDTVLBRGHDTRUVT7I3O72K6TMOYAUSAJBZUHGOEFU2RKJNUPWZSQC MSQI3TH6T62JAXQGLL52QZCWAMC372TGB6ZNNRDGUGMJKBNNV2VAC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC 7AMQN7MITMXBNVDAK5VOXTQ4TZIAOD6ZLOFJG7GQMBTY23Y2BKSAC R22TTMI6WXWULC7ODKFF3QCB7MOTETQQ6IR4BUCUPOCQKQNCTT5AC 33ZMPQC6OXTESW7SRW765GRNJUEJRSYONRVZVIEUDAUEJ2PPMB4AC if (player_monster_visible(monster)) // show reaction{std::ostream& chan = msg::streams(MSGCH_MONSTER_ENCHANT);chan << monster->name(DESC_CAP_THE);switch (random2(3)){case 0:chan << " stares at you in amazement and kneels.";break;case 1:chan << " relaxes its fighting stance and smiles at you.";break;case 2:chan << " falls on its knees before you.";break;}chan << std::endl;if (!one_chance_in(3)){std::ostream& tchan = msg::streams(MSGCH_TALK);tchan << "He ";switch (random2(4)){case 0:tchan << "shouts, \"I'll follow thee gladly!\"";break;case 1:tchan << "shouts, \"Surely Beogh must have ""sent you!\"";break;case 2:tchan << "asks, \"Are you our saviour?\"";break;case 3:tchan << "says, \"I'm so glad you are here now.\"";break;}tchan << std::endl;}}monster->attitude = ATT_FRIENDLY;monster->behaviour = BEH_GOD_GIFT; // alternative to BEH_FRIENDLY// not really "created" friendly, but should it become// hostile later on, it won't count as a good killmonster->flags |= MF_CREATED_FRIENDLY;monster->flags |= MF_GOD_GIFT;// to avoid immobile "followers"behaviour_event(monster, ME_ALERT, MHITYOU);
beogh_convert_orc(monster);
}static void beogh_orc_emergency_conversion_speech(std::ostream &chan,const monsters *orc){switch (random2(3)){case 0: chan << " surrenders. "; break;case 1: chan << " falls to " << orc->pronoun(PRONOUN_NOCAP_POSSESSIVE)<< " knees. "; break;case 2: chan << " raises " << orc->pronoun(PRONOUN_NOCAP_POSSESSIVE)<< " hands in surrender. "; break;}chan << std::endl;static const char *mercy_message[] ={" shouts, \"I'll follow you, let me live!\""," says, \"You must be the Messiah, I see it now!\""," yells, \"Beogh is my god, I swear it!\""};msg::streams(MSGCH_TALK) << orc->pronoun(PRONOUN_CAP)<< RANDOM_ELEMENT(mercy_message)<< std::endl;}static void beogh_orc_spontaneous_conversion_speech(std::ostream &chan,const monsters *orc){switch (random2(3)){case 0:chan << " stares at you in amazement and kneels.";break;case 1:chan << " relaxes " << orc->pronoun(PRONOUN_NOCAP_POSSESSIVE)<< " fighting stance and smiles at you.";break;case 2:chan << " falls on " << orc->pronoun(PRONOUN_NOCAP_POSSESSIVE)<< " knees before you.";break;}chan << std::endl;if (!one_chance_in(3)){std::ostream& tchan = msg::streams(MSGCH_TALK);tchan << orc->pronoun(PRONOUN_CAP) << " ";switch (random2(4)){case 0:tchan << "shouts, \"I'll follow thee gladly!\"";break;case 1:tchan << "shouts, \"Surely Beogh must have ""sent you!\"";break;case 2:tchan << "asks, \"Are you our saviour?\"";break;case 3:tchan << "says, \"I'm so glad you are here now.\"";break;}tchan << std::endl;}
void beogh_convert_orc(monsters *orc){ASSERT(mons_species(orc->type) == MONS_ORC);if (player_monster_visible(orc)) // show reaction{std::ostream& chan = msg::streams(MSGCH_MONSTER_ENCHANT);chan << orc->name(DESC_CAP_THE);if (orc->hit_points <= 0)beogh_orc_emergency_conversion_speech(chan, orc);elsebeogh_orc_spontaneous_conversion_speech(chan, orc);}orc->attitude = ATT_FRIENDLY;// not really "created" friendly, but should it become// hostile later on, it won't count as a good killorc->flags |= MF_CREATED_FRIENDLY;orc->flags |= MF_GOD_GIFT;if (orc->hit_points <= 0)orc->hit_points = std::min(random_range(1, 4), orc->max_hit_points);// to avoid immobile "followers"behaviour_event(orc, ME_ALERT, MHITNOT);}
}static bool monster_avoided_death(monsters *monster, killer_type killer, int i){if (monster->hit_points < -25|| monster->hit_points < -monster->max_hit_points|| monster->max_hit_points <= 0|| monster->hit_dice < 1)return (false);// Orcs may convert to Beogh under threat of death.if (YOU_KILL(killer)&& mons_near(monster)&& !mons_friendly(monster)&& mons_species(monster->type) == MONS_ORC&& you.species == SP_HILL_ORC && you.religion == GOD_BEOGH&& !player_under_penance() && you.piety >= 75){#ifdef DEBUG_DIAGNOSTICSmprf(MSGCH_DIAGNOSTICS, "Death convert attempt on %s, HD: %d, ""your xl: %d",monster->name(DESC_PLAIN).c_str(),monster->hit_dice,you.experience_level);#endifif (random2(you.piety) > 30&& random2(you.experience_level) >= random2(monster->hit_dice)// bias beaten-up-conversion towards the stronger orcs.&& random2(monster->hit_dice) > 2){beogh_convert_orc(monster);return (true);}}return (false);
if (player_hurt_monster())
player_hurt_monster();if (damage_done > 0 || !defender_visible)player_announce_hit();else if (damage_done <= 0)no_damage_message =make_stringf("You %s %s.",attack_verb.c_str(),defender->name(DESC_NOCAP_THE).c_str());if (damage_done)
if (damage_done < 1)no_damage_message =make_stringf("You %s %s.",attack_verb.c_str(),defender->name(DESC_NOCAP_THE).c_str());