Changed weights of cr calculation and exp from cr formula.

This commit is contained in:
Sam 2021-09-17 01:45:30 -04:00
parent 0af6969d19
commit c62162c2d3
7 changed files with 86 additions and 46 deletions

View File

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Made dungeon tiers 3, 4, and 5 more common
- Tweaked CR and exp calculation formula
### Removed

View File

@ -888,27 +888,34 @@ pub fn combat_rating(
inventory: &Inventory,
health: &Health,
energy: &Energy,
poise: &Poise,
skill_set: &SkillSet,
body: Body,
msm: &MaterialStatManifest,
) -> f32 {
const WEAPON_WEIGHT: f32 = 1.0;
const HEALTH_WEIGHT: f32 = 0.5;
const HEALTH_WEIGHT: f32 = 1.5;
const ENERGY_WEIGHT: f32 = 0.5;
const SKILLS_WEIGHT: f32 = 1.0;
const POISE_WEIGHT: f32 = 0.5;
const CRIT_WEIGHT: f32 = 0.6;
// Assumes a "standard" max health of 100
let health_rating = 10.0 * health.base_max()
const CRIT_WEIGHT: f32 = 0.5;
// Normalzied with a standard max health of 100
let health_rating = health.base_max()
/ 100.0
/ (1.0 - Damage::compute_damage_reduction(Some(inventory), None, None)).max(0.00001);
// Assumes a "standard" max energy of 100 and energy reward multiplier of 1.0
let energy_rating = 5.0 * energy.maximum() * compute_energy_reward_mod(Some(inventory)) / 100.0;
// Normalzied with a standard max energy of 100 and energy reward multiplier of
// x1
let energy_rating = (energy.base_max() + compute_max_energy_mod(Some(inventory))) / 100.0
* compute_energy_reward_mod(Some(inventory));
let poise_rating = 10.0 / (1.0 - Poise::compute_poise_damage_reduction(inventory)).max(0.00001);
// Normalzied with a standard max poise of 100
let poise_rating = poise.base_max() as f32
/ 100.0
/ (1.0 - Poise::compute_poise_damage_reduction(inventory)).max(0.00001);
let crit_rating = 10.0 * compute_crit_mult(Some(inventory));
// Normalzied with a standard crit multiplier of 1.2
let crit_rating = compute_crit_mult(Some(inventory)) / 1.2;
// Assumes a standard person has earned 20 skill points in the general skill
// tree and 10 skill points for the weapon skill tree
@ -916,8 +923,7 @@ pub fn combat_rating(
+ weapon_skills(inventory, skill_set) / 10.0)
/ 2.0;
//Multiply weapon rating by 10 to keep it in the same scale as the others
let weapon_rating = 10.0 * get_weapon_rating(inventory, msm);
let weapon_rating = get_weapon_rating(inventory, msm);
let combined_rating = (health_rating * HEALTH_WEIGHT
+ energy_rating * ENERGY_WEIGHT

View File

@ -759,15 +759,15 @@ impl Body {
match self {
Body::Object(_) | Body::Ship(_) => 0.0,
Body::BipedLarge(b) => match b.species {
biped_large::Species::Mindflayer => 4.8,
biped_large::Species::Minotaur => 3.2,
biped_large::Species::Tidalwarrior => 2.25,
biped_large::Species::Yeti => 2.0,
biped_large::Species::Harvester => 2.4,
biped_large::Species::Mindflayer => 4.35,
biped_large::Species::Minotaur => 4.05,
biped_large::Species::Tidalwarrior => 2.75,
biped_large::Species::Yeti => 2.25,
biped_large::Species::Harvester => 2.1,
_ => 1.0,
},
Body::Golem(g) => match g.species {
golem::Species::ClayGolem => 2.0,
golem::Species::ClayGolem => 2.45,
_ => 1.0,
},
_ => 1.0,

View File

@ -194,6 +194,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
let inventories = state.ecs().read_storage::<Inventory>();
let players = state.ecs().read_storage::<Player>();
let bodies = state.ecs().read_storage::<Body>();
let poises = state.ecs().read_storage::<comp::Poise>();
let by = if let Some(by) = last_change.by {
by
} else {
@ -204,19 +205,27 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
} else {
return;
};
let (entity_skill_set, entity_health, entity_energy, entity_inventory, entity_body) =
if let (
let (
entity_skill_set,
entity_health,
entity_energy,
entity_inventory,
entity_body,
entity_poise,
) = if let (
Some(entity_skill_set),
Some(entity_health),
Some(entity_energy),
Some(entity_inventory),
Some(entity_body),
Some(entity_poise),
) = (
skill_set.get(entity),
healths.get(entity),
energies.get(entity),
inventories.get(entity),
bodies.get(entity),
poises.get(entity),
) {
(
entity_skill_set,
@ -224,6 +233,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
entity_energy,
entity_inventory,
entity_body,
entity_poise,
)
} else {
return;
@ -249,10 +259,11 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
entity_inventory,
entity_health,
entity_energy,
entity_poise,
entity_skill_set,
*entity_body,
&msm,
) * 2.5;
) * 20.0;
// Distribute EXP to group
let positions = state.ecs().read_storage::<Pos>();

View File

@ -547,6 +547,7 @@ pub struct Bag<'a> {
show: &'a Show,
body: &'a Body,
msm: &'a MaterialStatManifest,
poise: &'a Poise,
}
impl<'a> Bag<'a> {
@ -570,6 +571,7 @@ impl<'a> Bag<'a> {
show: &'a Show,
body: &'a Body,
msm: &'a MaterialStatManifest,
poise: &'a Poise,
) -> Self {
Self {
client,
@ -591,6 +593,7 @@ impl<'a> Bag<'a> {
show,
body,
msm,
poise,
}
}
}
@ -869,6 +872,7 @@ impl<'a> Widget for Bag<'a> {
inventory,
self.health,
self.energy,
self.poise,
self.skill_set,
*self.body,
self.msm,

View File

@ -355,6 +355,7 @@ impl<'a> Widget for Group<'a> {
let inventory = client_state.ecs().read_storage::<common::comp::Inventory>();
let uid_allocator = client_state.ecs().read_resource::<UidAllocator>();
let bodies = client_state.ecs().read_storage::<common::comp::Body>();
let poises = client_state.ecs().read_storage::<common::comp::Poise>();
// Keep track of the total number of widget ids we are using for buffs
let mut total_buff_count = 0;
@ -369,6 +370,7 @@ impl<'a> Widget for Group<'a> {
let inventory = entity.and_then(|entity| inventory.get(entity));
let is_leader = uid == leader;
let body = entity.and_then(|entity| bodies.get(entity));
let poise = entity.and_then(|entity| poises.get(entity));
if let (
Some(stats),
@ -377,10 +379,11 @@ impl<'a> Widget for Group<'a> {
Some(health),
Some(energy),
Some(body),
) = (stats, skill_set, inventory, health, energy, body)
Some(poise),
) = (stats, skill_set, inventory, health, energy, body, poise)
{
let combat_rating = combat::combat_rating(
inventory, health, energy, skill_set, *body, self.msm,
inventory, health, energy, poise, skill_set, *body, self.msm,
);
let char_name = stats.name.to_string();
let health_perc = health.current() / health.base_max().max(health.maximum());

View File

@ -1110,6 +1110,7 @@ impl Hud {
let msm = ecs.read_resource::<MaterialStatManifest>();
let entities = ecs.entities();
let me = client.entity();
let poises = ecs.read_storage::<comp::Poise>();
if (client.pending_trade().is_some() && !self.show.trade)
|| (client.pending_trade().is_none() && self.show.trade)
@ -1722,6 +1723,7 @@ impl Hud {
&uids,
&inventories,
players.maybe(),
poises.maybe(),
)
.join()
.filter(|t| {
@ -1745,6 +1747,7 @@ impl Hud {
uid,
inventory,
player,
poise,
)| {
// Use interpolated position if available
let pos = interpolated.map_or(pos.0, |i| i.pos);
@ -1784,9 +1787,11 @@ impl Hud {
health,
buffs,
energy,
combat_rating: if let (Some(health), Some(energy)) = (health, energy) {
combat_rating: if let (Some(health), Some(energy), Some(poise)) =
(health, energy, poise)
{
combat::combat_rating(
inventory, health, energy, skill_set, *body, &msm,
inventory, health, energy, poise, skill_set, *body, &msm,
)
} else {
0.0
@ -2663,6 +2668,7 @@ impl Hud {
let character_states = ecs.read_storage::<comp::CharacterState>();
let controllers = ecs.read_storage::<comp::Controller>();
let bodies = ecs.read_storage::<comp::Body>();
let poises = ecs.read_storage::<comp::Poise>();
// Combo floater stuffs
self.floaters
.combo_floaters
@ -2720,12 +2726,20 @@ impl Hud {
}
// Bag contents
if self.show.bag {
if let (Some(player_stats), Some(skill_set), Some(health), Some(energy), Some(body)) = (
if let (
Some(player_stats),
Some(skill_set),
Some(health),
Some(energy),
Some(body),
Some(poise),
) = (
stats.get(client.entity()),
skill_sets.get(client.entity()),
healths.get(entity),
energies.get(entity),
bodies.get(entity),
poises.get(entity),
) {
match Bag::new(
client,
@ -2746,6 +2760,7 @@ impl Hud {
&self.show,
body,
&msm,
poise,
)
.set(self.ids.bag, ui_widgets)
{