Fix and change the beast xp modifier

This commit is contained in:
Reedux
2021-03-06 13:56:49 +00:00
parent 4e31f60232
commit 8025be7759
3 changed files with 9 additions and 39 deletions

View File

@@ -1896,7 +1896,7 @@ public class beast_lib extends script.base_script
stop(currentBeast);
storeBeast(bcd);
}
public static void incrementBeastExperience(obj_id beast) throws InterruptedException
public static void incrementBeastExperience(obj_id beast, dictionary params) throws InterruptedException
{
if (!isValidBeast(beast))
{
@@ -1927,6 +1927,9 @@ public class beast_lib extends script.base_script
if (isValidPlayer(master))
{
int experienceGain = Math.round(100 * percentageBonuses);
if (params.containsKey("xpAmount")) {
experienceGain = Math.round(params.getInt("xpAmount") * percentageBonuses);
}
experienceGain += experienceGain * 0.01f * getEnhancedSkillStatisticModifierUncapped(master, "bm_xp_mod_boost");
int multiplier = utils.stringToInt(getConfigSetting("GameServer", "xpMultiplier"));
if (multiplier > 1)
@@ -1940,41 +1943,6 @@ public class beast_lib extends script.base_script
setBeastExperience(beast, experience);
setBCDBeastExperience(bcd, experience);
}
public static void incrementBeastExperienceMission(obj_id beast, int xpAmountToGrant) throws InterruptedException {
if (!isValidBeast(beast)) {
return;
}
int experience = getBeastExperience(beast);
int previousExperience = experience;
obj_id bcd = getBeastBCD(beast);
if (!isValidBCD(bcd)) {
return;
}
float happinessAdjustment = (getBCDBeastHappiness(bcd) / 100.0f) + 1.0f;
if (happinessAdjustment > 1.5f) {
happinessAdjustment = 1.5f;
} else if (happinessAdjustment < 0.5f) {
happinessAdjustment = 0.5f;
}
float percentageBonuses = happinessAdjustment;
if (buff.hasBuff(beast, "bm_beast_steroid")) {
percentageBonuses += 0.01f * utils.getIntScriptVar(beast, "beastBuff.beastXpBonusPercent");
}
obj_id master = getMaster(beast);
if (isValidPlayer(master)) {
int experienceGain = Math.round(xpAmountToGrant * percentageBonuses);
experienceGain += experienceGain * 0.01f * getEnhancedSkillStatisticModifierUncapped(master, "bm_xp_mod_boost");
int multiplier = utils.stringToInt(getConfigSetting("GameServer", "xpMultiplier"));
if (multiplier > 1) {
experienceGain *= multiplier;
}
experience += experienceGain;
prose_package pp = prose.getPackage(xp.SID_FLYTEXT_XP, experience - previousExperience);
showFlyTextPrivate(beast, master, pp, 2.5f, new color(180, 60, 240, 255));
}
setBeastExperience(beast, experience);
setBCDBeastExperience(bcd, experience);
}
public static void incrementBeastLevel(obj_id beast) throws InterruptedException
{
if (!isValidBeast(beast))
@@ -2038,7 +2006,7 @@ public class beast_lib extends script.base_script
int level = getBeastLevel(beast);
if (level < 90)
{
incrementBeastExperience(beast);
incrementBeastExperience(beast, new dictionary());
}
if (canBeastLevelUp(beast))
{

View File

@@ -321,7 +321,7 @@ public class player_beastmaster extends script.base_script
return;
}
debugSpeakMsg(beast, "Current experience: " + beast_lib.getBeastExperience(beast));
beast_lib.incrementBeastExperience(beast);
beast_lib.incrementBeastExperience(beast, new dictionary());
debugSpeakMsg(beast, "Incremented experience: " + beast_lib.getBeastExperience(beast));
}
public void showHappiness(obj_id self) throws InterruptedException

View File

@@ -160,7 +160,9 @@ public class mission_base extends script.base_script
intReward = intReward / (int)divisor;
if (missions.canEarnDailyMissionXp(objPlayer) && missions.isDestroyMission(objMissionData)){
if (beast_lib.isBeastMaster(objPlayer) && beast_lib.hasActiveBeast(objPlayer)) {
beast_lib.incrementBeastExperienceMission(beast_lib.getBeastOnPlayer(objPlayer), xp.getMissionXpAmount(objPlayer, intPlayerDifficulty) / 2);
dictionary returnDict = new dictionary();
returnDict.addInt("xpAmount", xp.getMissionXpAmount(objPlayer, intPlayerDifficulty) / 2);
beast_lib.incrementBeastExperience(beast_lib.getBeastOnPlayer(objPlayer), returnDict);
}
xp.grantMissionXp(objPlayer, intPlayerDifficulty);
}