Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author Desperion emulator 2.0 by Little-Scaraby and Nekkro
- *
- */
- public static int truncate(double n)
- {
- double loc2 = Math.pow(Double.valueOf(10), Double.valueOf(0));
- double loc3 = n * loc2;
- return (int)((int)(loc3) / loc2);
- }
- /**
- *
- * @author Desperion emulator 2.0 by Little-Scaraby and Nekkro
- *
- */
- public static long calculateXpMonster(double groupXp, double groupLevel, double highestMonsterLevel, double ageBonus, Fighter ch, ArrayList<Fighter> team, double mountRatio, double guildRatio)
- {
- // Calcul du niveau de la team, ainsi que du niveau du personnage le plus fort
- double totalTeamLevel = 0;
- double highestTeamLevel = 0;
- for(int a = 0; a < team.size(); ++a)
- {
- totalTeamLevel += team.get(a).getLvl();
- if(team.get(a).getLvl() > highestTeamLevel)
- highestTeamLevel = team.get(a).getLvl();
- }
- // Calcul du coefficient dû au niveau de la team par rapport au niveau du groupe de monstres
- double levelCoeff = 1;
- if(totalTeamLevel - 5 > groupLevel)
- levelCoeff = groupLevel / totalTeamLevel;
- else if(totalTeamLevel + 10 < groupLevel)
- levelCoeff = (totalTeamLevel + 10) / groupLevel;
- // pondération avec le niveau de ch
- double min = Math.min(ch.getLvl(), truncate(2.5 * highestMonsterLevel));
- double loc16 = min / totalTeamLevel * 100;
- /*
- détermination d'un facteur de multiplication en fonction du nombre de personnes
- dans la team: chaque personnage de la team doit avoir un niveau supérieur à
- (highestTeamLevel / 3) pour être considéré
- */
- double[] teamFactors = {1, 1.1, 1.5, 2.3, 3.1, 3.6, 4.2, 4.7};
- byte index = 0;
- for(int a = 0; a < team.size(); ++a)
- {
- if(team.get(a).getLvl() >= highestTeamLevel / 3)
- ++index;
- }
- if(index == 0)
- index = 1;
- double loc20 = truncate(groupXp * teamFactors[index - 1] * levelCoeff);
- double loc22 = truncate(loc16 / 100 * loc20);
- double totalWisdom = ch.getTotalStats().getEffect(Constants.STATS_ADD_SAGE);
- if(totalWisdom < 0)
- totalWisdom = 0;
- double ageCoeff = ageBonus <= 0 ? 1 : (1 + ageBonus / 100);
- double xp = truncate(truncate(loc22 * (100 + totalWisdom) / 100) * ageCoeff); // xp totale gagnée par ch
- // on retranche l'xp perdue à cause de la drago
- if(mountRatio > 0)
- xp -= truncate(xp * mountRatio / 100);
- if(guildRatio > 0) // idem (la guilde passe après la drago)
- xp -= truncate(xp * guildRatio / 100);
- return (long) xp;
- }
Advertisement
Add Comment
Please, Sign In to add comment