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 ### Changed
- Made dungeon tiers 3, 4, and 5 more common - Made dungeon tiers 3, 4, and 5 more common
- Tweaked CR and exp calculation formula
### Removed ### Removed

View File

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

View File

@ -759,15 +759,15 @@ impl Body {
match self { match self {
Body::Object(_) | Body::Ship(_) => 0.0, Body::Object(_) | Body::Ship(_) => 0.0,
Body::BipedLarge(b) => match b.species { Body::BipedLarge(b) => match b.species {
biped_large::Species::Mindflayer => 4.8, biped_large::Species::Mindflayer => 4.35,
biped_large::Species::Minotaur => 3.2, biped_large::Species::Minotaur => 4.05,
biped_large::Species::Tidalwarrior => 2.25, biped_large::Species::Tidalwarrior => 2.75,
biped_large::Species::Yeti => 2.0, biped_large::Species::Yeti => 2.25,
biped_large::Species::Harvester => 2.4, biped_large::Species::Harvester => 2.1,
_ => 1.0, _ => 1.0,
}, },
Body::Golem(g) => match g.species { Body::Golem(g) => match g.species {
golem::Species::ClayGolem => 2.0, golem::Species::ClayGolem => 2.45,
_ => 1.0, _ => 1.0,
}, },
_ => 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 inventories = state.ecs().read_storage::<Inventory>();
let players = state.ecs().read_storage::<Player>(); let players = state.ecs().read_storage::<Player>();
let bodies = state.ecs().read_storage::<Body>(); let bodies = state.ecs().read_storage::<Body>();
let poises = state.ecs().read_storage::<comp::Poise>();
let by = if let Some(by) = last_change.by { let by = if let Some(by) = last_change.by {
by by
} else { } else {
@ -204,30 +205,39 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
} else { } else {
return; return;
}; };
let (entity_skill_set, entity_health, entity_energy, entity_inventory, entity_body) = let (
if let ( entity_skill_set,
Some(entity_skill_set), entity_health,
Some(entity_health), entity_energy,
Some(entity_energy), entity_inventory,
Some(entity_inventory), entity_body,
Some(entity_body), entity_poise,
) = ( ) = if let (
skill_set.get(entity), Some(entity_skill_set),
healths.get(entity), Some(entity_health),
energies.get(entity), Some(entity_energy),
inventories.get(entity), Some(entity_inventory),
bodies.get(entity), Some(entity_body),
) { Some(entity_poise),
( ) = (
entity_skill_set, skill_set.get(entity),
entity_health, healths.get(entity),
entity_energy, energies.get(entity),
entity_inventory, inventories.get(entity),
entity_body, bodies.get(entity),
) poises.get(entity),
} else { ) {
return; (
}; entity_skill_set,
entity_health,
entity_energy,
entity_inventory,
entity_body,
entity_poise,
)
} else {
return;
};
let groups = state.ecs().read_storage::<Group>(); let groups = state.ecs().read_storage::<Group>();
let attacker_group = groups.get(attacker); let attacker_group = groups.get(attacker);
@ -249,10 +259,11 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
entity_inventory, entity_inventory,
entity_health, entity_health,
entity_energy, entity_energy,
entity_poise,
entity_skill_set, entity_skill_set,
*entity_body, *entity_body,
&msm, &msm,
) * 2.5; ) * 20.0;
// Distribute EXP to group // Distribute EXP to group
let positions = state.ecs().read_storage::<Pos>(); let positions = state.ecs().read_storage::<Pos>();

View File

@ -547,6 +547,7 @@ pub struct Bag<'a> {
show: &'a Show, show: &'a Show,
body: &'a Body, body: &'a Body,
msm: &'a MaterialStatManifest, msm: &'a MaterialStatManifest,
poise: &'a Poise,
} }
impl<'a> Bag<'a> { impl<'a> Bag<'a> {
@ -570,6 +571,7 @@ impl<'a> Bag<'a> {
show: &'a Show, show: &'a Show,
body: &'a Body, body: &'a Body,
msm: &'a MaterialStatManifest, msm: &'a MaterialStatManifest,
poise: &'a Poise,
) -> Self { ) -> Self {
Self { Self {
client, client,
@ -591,6 +593,7 @@ impl<'a> Bag<'a> {
show, show,
body, body,
msm, msm,
poise,
} }
} }
} }
@ -869,6 +872,7 @@ impl<'a> Widget for Bag<'a> {
inventory, inventory,
self.health, self.health,
self.energy, self.energy,
self.poise,
self.skill_set, self.skill_set,
*self.body, *self.body,
self.msm, 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 inventory = client_state.ecs().read_storage::<common::comp::Inventory>();
let uid_allocator = client_state.ecs().read_resource::<UidAllocator>(); let uid_allocator = client_state.ecs().read_resource::<UidAllocator>();
let bodies = client_state.ecs().read_storage::<common::comp::Body>(); 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 // Keep track of the total number of widget ids we are using for buffs
let mut total_buff_count = 0; 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 inventory = entity.and_then(|entity| inventory.get(entity));
let is_leader = uid == leader; let is_leader = uid == leader;
let body = entity.and_then(|entity| bodies.get(entity)); let body = entity.and_then(|entity| bodies.get(entity));
let poise = entity.and_then(|entity| poises.get(entity));
if let ( if let (
Some(stats), Some(stats),
@ -377,10 +379,11 @@ impl<'a> Widget for Group<'a> {
Some(health), Some(health),
Some(energy), Some(energy),
Some(body), 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( 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 char_name = stats.name.to_string();
let health_perc = health.current() / health.base_max().max(health.maximum()); 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 msm = ecs.read_resource::<MaterialStatManifest>();
let entities = ecs.entities(); let entities = ecs.entities();
let me = client.entity(); let me = client.entity();
let poises = ecs.read_storage::<comp::Poise>();
if (client.pending_trade().is_some() && !self.show.trade) if (client.pending_trade().is_some() && !self.show.trade)
|| (client.pending_trade().is_none() && self.show.trade) || (client.pending_trade().is_none() && self.show.trade)
@ -1722,6 +1723,7 @@ impl Hud {
&uids, &uids,
&inventories, &inventories,
players.maybe(), players.maybe(),
poises.maybe(),
) )
.join() .join()
.filter(|t| { .filter(|t| {
@ -1745,6 +1747,7 @@ impl Hud {
uid, uid,
inventory, inventory,
player, player,
poise,
)| { )| {
// Use interpolated position if available // Use interpolated position if available
let pos = interpolated.map_or(pos.0, |i| i.pos); let pos = interpolated.map_or(pos.0, |i| i.pos);
@ -1784,9 +1787,11 @@ impl Hud {
health, health,
buffs, buffs,
energy, 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( combat::combat_rating(
inventory, health, energy, skill_set, *body, &msm, inventory, health, energy, poise, skill_set, *body, &msm,
) )
} else { } else {
0.0 0.0
@ -2663,6 +2668,7 @@ impl Hud {
let character_states = ecs.read_storage::<comp::CharacterState>(); let character_states = ecs.read_storage::<comp::CharacterState>();
let controllers = ecs.read_storage::<comp::Controller>(); let controllers = ecs.read_storage::<comp::Controller>();
let bodies = ecs.read_storage::<comp::Body>(); let bodies = ecs.read_storage::<comp::Body>();
let poises = ecs.read_storage::<comp::Poise>();
// Combo floater stuffs // Combo floater stuffs
self.floaters self.floaters
.combo_floaters .combo_floaters
@ -2720,12 +2726,20 @@ impl Hud {
} }
// Bag contents // Bag contents
if self.show.bag { 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()), stats.get(client.entity()),
skill_sets.get(client.entity()), skill_sets.get(client.entity()),
healths.get(entity), healths.get(entity),
energies.get(entity), energies.get(entity),
bodies.get(entity), bodies.get(entity),
poises.get(entity),
) { ) {
match Bag::new( match Bag::new(
client, client,
@ -2746,6 +2760,7 @@ impl Hud {
&self.show, &self.show,
body, body,
&msm, &msm,
poise,
) )
.set(self.ids.bag, ui_widgets) .set(self.ids.bag, ui_widgets)
{ {