Implement exp_adj
The original source had remnants of a PC-specific experience gain adjustment, which appeared to be intended as a debugging aid. I've restored and implemented it, and used it on the debug party. It doesn't necessary need to be relegated to only a debug feature, but for now, that's good enough.
This commit is contained in:
@@ -311,11 +311,11 @@ void award_xp(short pc_num,short amt,bool force) {
|
|||||||
if(amt <= 0)
|
if(amt <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
amt = percent(amt, adjust);
|
||||||
// univ.party[pc_num].experience += (max(((amt * adjust) / 100), 0) * univ.party[pc_num].exp_adj) / 100;
|
amt = max(amt, 0);
|
||||||
// univ.party.total_xp_gained += (max(((amt * adjust) / 100), 0) * univ.party[pc_num].exp_adj) / 100;
|
amt = percent(amt, univ.party[pc_num].exp_adj);
|
||||||
univ.party[pc_num].experience += (max(((amt * adjust) / 100), 0) * 100) / 100;
|
univ.party[pc_num].experience += amt;
|
||||||
univ.party.total_xp_gained += (max(((amt * adjust) / 100), 0) * 100) / 100;
|
univ.party.total_xp_gained += amt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,7 +40,9 @@ void cPlayer::import_legacy(legacy::pc_record_type old){
|
|||||||
experience = old.experience;
|
experience = old.experience;
|
||||||
skill_pts = old.skill_pts;
|
skill_pts = old.skill_pts;
|
||||||
level = old.level;
|
level = old.level;
|
||||||
// TODO: Why are advan and exp_adj commented out?
|
// Note that advan and exp_adj are both unused in legacy BoE
|
||||||
|
// advan is always 15x false, and exp_adj is always 100
|
||||||
|
exp_adj = old.exp_adj;
|
||||||
for(short i = 0; i < 15; i++){
|
for(short i = 0; i < 15; i++){
|
||||||
status[(eStatus) i] = old.status[i];
|
status[(eStatus) i] = old.status[i];
|
||||||
eTrait trait = eTrait(i);
|
eTrait trait = eTrait(i);
|
||||||
@@ -964,6 +966,7 @@ cPlayer::cPlayer(no_party_t) : weap_poisoned(*this) {
|
|||||||
experience = 0;
|
experience = 0;
|
||||||
skill_pts = 65;
|
skill_pts = 65;
|
||||||
level = 1;
|
level = 1;
|
||||||
|
exp_adj = 100;
|
||||||
std::fill(items.begin(), items.end(), cItem());
|
std::fill(items.begin(), items.end(), cItem());
|
||||||
equip.reset();
|
equip.reset();
|
||||||
|
|
||||||
@@ -1015,6 +1018,7 @@ cPlayer::cPlayer(cParty& party,ePartyPreset key,short slot) : cPlayer(party) {
|
|||||||
experience = 0;
|
experience = 0;
|
||||||
skill_pts = 60;
|
skill_pts = 60;
|
||||||
level = 1;
|
level = 1;
|
||||||
|
exp_adj = 50;
|
||||||
std::fill(items.begin(), items.end(), cItem());
|
std::fill(items.begin(), items.end(), cItem());
|
||||||
equip.reset();
|
equip.reset();
|
||||||
|
|
||||||
@@ -1212,6 +1216,9 @@ void cPlayer::writeTo(cTagFile& file) const {
|
|||||||
page["SKILLPTS"] << skill_pts;
|
page["SKILLPTS"] << skill_pts;
|
||||||
page["LEVEL"] << level;
|
page["LEVEL"] << level;
|
||||||
page["STATUS"].encodeSparse(status);
|
page["STATUS"].encodeSparse(status);
|
||||||
|
if(exp_adj != 100) {
|
||||||
|
page["EXPADJ"] << exp_adj;
|
||||||
|
}
|
||||||
for(int i = 0; i < equip.size(); i++) {
|
for(int i = 0; i < equip.size(); i++) {
|
||||||
if(equip[i]) {
|
if(equip[i]) {
|
||||||
page["EQUIP"] << i;
|
page["EQUIP"] << i;
|
||||||
@@ -1282,6 +1289,9 @@ void cPlayer::readFrom(const cTagFile& file) {
|
|||||||
skills.erase(eSkill::CUR_SKILL);
|
skills.erase(eSkill::CUR_SKILL);
|
||||||
skills.erase(eSkill::INVALID);
|
skills.erase(eSkill::INVALID);
|
||||||
|
|
||||||
|
if(page.contains("EXPADJ")) {
|
||||||
|
page["EXPADJ"] >> exp_adj;
|
||||||
|
} else exp_adj = 100;
|
||||||
|
|
||||||
equip.reset();
|
equip.reset();
|
||||||
for(size_t n = 0; n < page["EQUIP"].size(); n++) {
|
for(size_t n = 0; n < page["EQUIP"].size(); n++) {
|
||||||
|
@@ -93,6 +93,7 @@ public:
|
|||||||
unsigned short experience;
|
unsigned short experience;
|
||||||
short skill_pts;
|
short skill_pts;
|
||||||
short level;
|
short level;
|
||||||
|
short exp_adj;
|
||||||
std::array<cItem,INVENTORY_SIZE> items;
|
std::array<cItem,INVENTORY_SIZE> items;
|
||||||
std::bitset<INVENTORY_SIZE> equip;
|
std::bitset<INVENTORY_SIZE> equip;
|
||||||
std::bitset<62> priest_spells;
|
std::bitset<62> priest_spells;
|
||||||
|
Reference in New Issue
Block a user