mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
You can now roll without a weapon equipped.
This commit is contained in:
parent
c594f67d47
commit
0b10ffc715
@ -246,7 +246,6 @@ impl PartialEq for ItemDef {
|
||||
pub struct ItemConfig {
|
||||
pub abilities: AbilitySet<CharacterAbility>,
|
||||
pub block_ability: Option<CharacterAbility>,
|
||||
pub dodge_ability: Option<CharacterAbility>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -270,6 +269,7 @@ impl TryFrom<(&ItemKind, &[Item], &AbilityMap, &MaterialStatManifest)> for ItemC
|
||||
})
|
||||
} else {
|
||||
Err(ItemConfigError::BadItemKind)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -570,17 +570,9 @@ pub fn attempt_input(data: &JoinData, update: &mut StateUpdate) {
|
||||
/// attempts to perform their dodge ability
|
||||
pub fn handle_dodge_input(data: &JoinData, update: &mut StateUpdate) {
|
||||
if input_is_pressed(data, InputKind::Roll) && data.body.is_humanoid() {
|
||||
if let Some(ability) = data
|
||||
.inventory
|
||||
.equipped(EquipSlot::Mainhand)
|
||||
.and_then(|i| {
|
||||
i.item_config_expect()
|
||||
.dodge_ability
|
||||
.as_ref()
|
||||
.map(|a| a.clone().adjusted_by_skills(&data.stats.skill_set, None))
|
||||
})
|
||||
.filter(|ability| ability.requirements_paid(data, update))
|
||||
{
|
||||
let ability =
|
||||
CharacterAbility::default_roll().adjusted_by_skills(&data.stats.skill_set, None);
|
||||
if ability.requirements_paid(data, update) {
|
||||
update.character = CharacterState::from((
|
||||
&ability,
|
||||
AbilityInfo::from_input(data, false, InputKind::Roll),
|
||||
|
@ -78,11 +78,12 @@ impl State {
|
||||
let inventory = inventories.get(client.entity());
|
||||
let stats = client.state().ecs().read_storage::<common::comp::Stats>();
|
||||
let stat = stats.get(client.entity());
|
||||
|
||||
let hands = |equip_slot| match inventory.and_then(|i| i.equipped(equip_slot).map(|i| i.kind())) {
|
||||
Some(ItemKind::Tool(tool)) => Some(tool.hands),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let hands =
|
||||
|equip_slot| match inventory.and_then(|i| i.equipped(equip_slot).map(|i| i.kind())) {
|
||||
Some(ItemKind::Tool(tool)) => Some(tool.hands),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let equip_slot = match (hands(EquipSlot::Mainhand), hands(EquipSlot::Offhand)) {
|
||||
(Some(_), _) => Some(EquipSlot::Mainhand),
|
||||
@ -90,7 +91,9 @@ impl State {
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let should_be_present = if let (Some(inventory), Some(stat), Some(equip_slot)) = (inventory, stat, equip_slot) {
|
||||
let should_be_present = if let (Some(inventory), Some(stat), Some(equip_slot)) =
|
||||
(inventory, stat, equip_slot)
|
||||
{
|
||||
inventory.equipped(equip_slot).map_or(false, |i| {
|
||||
i.item_config_expect()
|
||||
.abilities
|
||||
|
@ -674,8 +674,7 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
(_, Some(_)) => second_tool,
|
||||
(_, _) => None,
|
||||
};
|
||||
|
||||
|
||||
|
||||
Button::image(match tool.map(|(_, t)| t.kind) {
|
||||
Some(ToolKind::Sword) => self.imgs.twohsword_m1,
|
||||
Some(ToolKind::Dagger) => self.imgs.onehdagger_m1,
|
||||
|
@ -158,15 +158,11 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
|
||||
(_, _) => None,
|
||||
};
|
||||
|
||||
let tool = equip_slot.and_then(|es|
|
||||
match inventory
|
||||
.equipped(es)
|
||||
.map(|i| (i, i.kind()))
|
||||
{
|
||||
let tool =
|
||||
equip_slot.and_then(|es| match inventory.equipped(es).map(|i| (i, i.kind())) {
|
||||
Some((item, ItemKind::Tool(tool))) => Some((item, tool)),
|
||||
_ => None,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
tool.and_then(|(item, tool)| {
|
||||
hotbar_image(tool.kind).map(|i| {
|
||||
|
Loading…
Reference in New Issue
Block a user