mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed exp splitting in inactive equip slots.
This commit is contained in:
parent
42c8c08145
commit
b826d5cb2b
@ -38,7 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Sort inventory button
|
||||
- Option to change the master volume when window is unfocused
|
||||
- Crafting stations in towns
|
||||
- Option to change the master volume when window is unfocused
|
||||
- Option to change the master volume when window is unfocused
|
||||
- Entities now have mass
|
||||
- Entities now have density
|
||||
- Buoyancy is calculated from the difference in density between an entity and surrounding fluid
|
||||
@ -63,7 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- NPC's now hear certain sounds
|
||||
- Renamed Animal Trainers to Beastmasters and gave them their own set of armor to wear
|
||||
- ChargedRanged attacks (such as some bow attacks) use an FOV zoom effect to indicate charge.
|
||||
- Add chest to each dungeon with unique loot
|
||||
- Add chest to each dungeon with unique loot
|
||||
|
||||
### Changed
|
||||
|
||||
@ -111,6 +111,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Entities catch on fire if they stand too close to campfires
|
||||
- Water extinguishes entities on fire
|
||||
- Item pickups are shown in separate window and inventory-full shows above item
|
||||
- Reworked bow
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -909,19 +909,33 @@ fn handle_exp_gain(
|
||||
uid: &Uid,
|
||||
outcomes: &mut Vec<Outcome>,
|
||||
) {
|
||||
let (main_tool_kind, second_tool_kind) = combat::get_weapons(inventory);
|
||||
use comp::inventory::{item::ItemKind, slot::EquipSlot};
|
||||
// Create hash set of xp pools to consider splitting xp amongst
|
||||
let mut xp_pools = HashSet::<SkillGroupKind>::new();
|
||||
// Insert general pool since it is always accessible
|
||||
xp_pools.insert(SkillGroupKind::General);
|
||||
if let Some(w) = main_tool_kind {
|
||||
if skill_set.contains_skill_group(SkillGroupKind::Weapon(w)) {
|
||||
xp_pools.insert(SkillGroupKind::Weapon(w));
|
||||
// Closure to add xp pool corresponding to weapon type equipped in a particular
|
||||
// EquipSlot
|
||||
let mut add_tool_from_slot = |equip_slot| {
|
||||
let tool_kind = inventory.equipped(equip_slot).and_then(|i| {
|
||||
if let ItemKind::Tool(tool) = &i.kind() {
|
||||
Some(tool.kind)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
if let Some(weapon) = tool_kind {
|
||||
// Only adds to xp pools if entity has that skill group available
|
||||
if skill_set.contains_skill_group(SkillGroupKind::Weapon(weapon)) {
|
||||
xp_pools.insert(SkillGroupKind::Weapon(weapon));
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(w) = second_tool_kind {
|
||||
if skill_set.contains_skill_group(SkillGroupKind::Weapon(w)) {
|
||||
xp_pools.insert(SkillGroupKind::Weapon(w));
|
||||
}
|
||||
}
|
||||
};
|
||||
// Add weapons to xp pools considered
|
||||
add_tool_from_slot(EquipSlot::ActiveMainhand);
|
||||
add_tool_from_slot(EquipSlot::ActiveOffhand);
|
||||
add_tool_from_slot(EquipSlot::InactiveMainhand);
|
||||
add_tool_from_slot(EquipSlot::InactiveOffhand);
|
||||
let num_pools = xp_pools.len() as f32;
|
||||
for pool in xp_pools {
|
||||
skill_set.change_experience(pool, (exp_reward / num_pools).ceil() as i32);
|
||||
|
@ -2107,25 +2107,25 @@ impl<'a> AgentData<'a> {
|
||||
.push(ControlAction::basic_input(InputKind::Primary));
|
||||
}
|
||||
}
|
||||
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
|
||||
if can_see_tgt(
|
||||
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2)
|
||||
&& can_see_tgt(
|
||||
&*read_data.terrain,
|
||||
self.pos,
|
||||
tgt_data.pos,
|
||||
attack_data.dist_sqrd,
|
||||
) {
|
||||
// If not really far, and can see target, attempt to shoot bow
|
||||
if self.energy.current() < DESIRED_ENERGY_LEVEL {
|
||||
// If low on energy, use primary to attempt to regen energy
|
||||
controller
|
||||
.actions
|
||||
.push(ControlAction::basic_input(InputKind::Primary));
|
||||
} else {
|
||||
// Else we have enough energy, use repeater
|
||||
controller
|
||||
.actions
|
||||
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||
}
|
||||
)
|
||||
{
|
||||
// If not really far, and can see target, attempt to shoot bow
|
||||
if self.energy.current() < DESIRED_ENERGY_LEVEL {
|
||||
// If low on energy, use primary to attempt to regen energy
|
||||
controller
|
||||
.actions
|
||||
.push(ControlAction::basic_input(InputKind::Primary));
|
||||
} else {
|
||||
// Else we have enough energy, use repeater
|
||||
controller
|
||||
.actions
|
||||
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||
}
|
||||
}
|
||||
// Logic to move. Intentionally kept separate from ability logic so duplicated
|
||||
|
Loading…
Reference in New Issue
Block a user