mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Updates from review
This commit is contained in:
parent
9d73fcfc3f
commit
961edf910d
@ -353,7 +353,7 @@
|
||||
Tool(Shield): (
|
||||
guard: Some(Simple(None, "common.abilities.shield.basic_guard")),
|
||||
primary: Simple(None, "common.abilities.shield.singlestrike"),
|
||||
secondary: Simple(None, "common.abilities.shield.singlestrike"),
|
||||
secondary: Simple(None, "common.abilities.shield.power_guard"),
|
||||
abilities: [],
|
||||
),
|
||||
Custom("Stone Golem"): (
|
||||
|
@ -8,7 +8,7 @@ BasicBlock(
|
||||
recover: false,
|
||||
),
|
||||
energy_cost: 5.0,
|
||||
energy_regen: 5.0,
|
||||
energy_regen: 2.5,
|
||||
can_hold: true,
|
||||
blocked_attacks: (
|
||||
melee: true,
|
||||
|
21
assets/common/abilities/shield/power_guard.ron
Normal file
21
assets/common/abilities/shield/power_guard.ron
Normal file
@ -0,0 +1,21 @@
|
||||
BasicBlock(
|
||||
buildup_duration: 0.5,
|
||||
recover_duration: 0.25,
|
||||
max_angle: 90.0,
|
||||
block_strength: 15.0,
|
||||
parry_window: (
|
||||
buildup: true,
|
||||
recover: false,
|
||||
),
|
||||
energy_cost: 15.0,
|
||||
energy_regen: 2.5,
|
||||
can_hold: true,
|
||||
blocked_attacks: (
|
||||
melee: true,
|
||||
projectiles: true,
|
||||
beams: true,
|
||||
ground_shockwaves: false,
|
||||
air_shockwaves: true,
|
||||
explosions: true,
|
||||
),
|
||||
)
|
@ -2,7 +2,7 @@ BasicBlock(
|
||||
buildup_duration: 0.4,
|
||||
recover_duration: 0.2,
|
||||
max_angle: 45.0,
|
||||
block_strength: 5.0,
|
||||
block_strength: 7.5,
|
||||
parry_window: (
|
||||
buildup: true,
|
||||
recover: false,
|
||||
|
@ -2,7 +2,7 @@ BasicBlock(
|
||||
buildup_duration: 0.4,
|
||||
recover_duration: 0.15,
|
||||
max_angle: 60.0,
|
||||
block_strength: 5.75,
|
||||
block_strength: 7.5,
|
||||
parry_window: (
|
||||
buildup: true,
|
||||
recover: false,
|
||||
|
@ -20,7 +20,7 @@ use crate::{
|
||||
},
|
||||
outcome::Outcome,
|
||||
resources::{Secs, Time},
|
||||
states::utils::{HandInfo, StageSection},
|
||||
states::utils::StageSection,
|
||||
uid::{IdMaps, Uid},
|
||||
util::Dir,
|
||||
};
|
||||
@ -1544,41 +1544,35 @@ pub fn precision_mult_from_flank(attack_dir: Vec3<f32>, target_ori: Option<&Ori>
|
||||
}
|
||||
|
||||
pub fn block_strength(inventory: &Inventory, char_state: &CharacterState) -> f32 {
|
||||
char_state
|
||||
.ability_info()
|
||||
.and_then(|a| match a.hand {
|
||||
Some(HandInfo::TwoHanded | HandInfo::MainHand) => Some(EquipSlot::ActiveMainhand),
|
||||
Some(HandInfo::OffHand) => Some(EquipSlot::ActiveOffhand),
|
||||
None => None,
|
||||
})
|
||||
.and_then(|slot| inventory.equipped(slot))
|
||||
.map(|item| match &*item.kind() {
|
||||
ItemKind::Tool(tool) => tool.stats(item.stats_durability_multiplier()).power,
|
||||
_ => 0.0,
|
||||
})
|
||||
.map_or(0.0, |tool_block_strength| match char_state {
|
||||
CharacterState::BasicBlock(data) => data.static_data.block_strength,
|
||||
CharacterState::RiposteMelee(data) => data.static_data.block_strength,
|
||||
_ => {
|
||||
char_state
|
||||
.ability_info()
|
||||
.map(|ability| ability.ability_meta.capabilities)
|
||||
.map_or(0.0, |capabilities| {
|
||||
if capabilities.contains(Capability::PARRIES)
|
||||
|| capabilities.contains(Capability::PARRIES_MELEE)
|
||||
{
|
||||
return tool_block_strength;
|
||||
}
|
||||
|
||||
if capabilities.contains(Capability::BLOCKS) {
|
||||
return tool_block_strength * 0.5;
|
||||
}
|
||||
|
||||
match char_state {
|
||||
CharacterState::BasicBlock(data) => data.static_data.block_strength,
|
||||
CharacterState::RiposteMelee(data) => data.static_data.block_strength,
|
||||
_ => char_state
|
||||
.ability_info()
|
||||
.map(|ability| (ability.ability_meta.capabilities, ability.hand))
|
||||
.map(|(capabilities, hand)| {
|
||||
(
|
||||
if capabilities.contains(Capability::PARRIES)
|
||||
|| capabilities.contains(Capability::PARRIES_MELEE)
|
||||
|| capabilities.contains(Capability::BLOCKS)
|
||||
{
|
||||
FALLBACK_BLOCK_STRENGTH
|
||||
} else {
|
||||
0.0
|
||||
})
|
||||
* FALLBACK_BLOCK_STRENGTH
|
||||
},
|
||||
})
|
||||
},
|
||||
hand.and_then(|hand| inventory.equipped(hand.to_equip_slot()))
|
||||
.map_or(1.0, |item| match &*item.kind() {
|
||||
ItemKind::Tool(tool) => {
|
||||
tool.stats(item.stats_durability_multiplier()).power
|
||||
},
|
||||
_ => 1.0,
|
||||
}),
|
||||
)
|
||||
})
|
||||
.map_or(0.0, |(capability_strength, tool_block_strength)| {
|
||||
capability_strength * tool_block_strength
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_equip_slot_by_block_priority(inventory: Option<&Inventory>) -> EquipSlot {
|
||||
|
@ -210,21 +210,6 @@ impl ActiveAbilities {
|
||||
spec_ability(i),
|
||||
)
|
||||
})
|
||||
.or_else(|| {
|
||||
ability_set(EquipSlot::ActiveMainhand)
|
||||
.and_then(|abilities| {
|
||||
abilities
|
||||
.guard(Some(skill_set), context)
|
||||
.map(|(a, i)| (a.ability.clone(), i))
|
||||
})
|
||||
.map(|(ability, i)| {
|
||||
(
|
||||
scale_ability(ability, EquipSlot::ActiveMainhand),
|
||||
false,
|
||||
spec_ability(i),
|
||||
)
|
||||
})
|
||||
})
|
||||
},
|
||||
Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand)
|
||||
.and_then(|abilities| {
|
||||
@ -410,19 +395,6 @@ impl Ability {
|
||||
.as_ref()
|
||||
.and_then(|g| contextual_id(Some(g)))
|
||||
})
|
||||
})
|
||||
.or_else(|| {
|
||||
ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| {
|
||||
abilities
|
||||
.guard(skillset, context)
|
||||
.map(|a| a.0.id.as_str())
|
||||
.or_else(|| {
|
||||
abilities
|
||||
.guard
|
||||
.as_ref()
|
||||
.and_then(|g| contextual_id(Some(g)))
|
||||
})
|
||||
})
|
||||
}),
|
||||
Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| {
|
||||
abilities
|
||||
@ -528,11 +500,7 @@ impl SpecifiedAbility {
|
||||
.map(|abilities| ability_id(self, &abilities.secondary))
|
||||
}),
|
||||
Ability::ToolGuard => ability_set(combat::get_equip_slot_by_block_priority(inv))
|
||||
.and_then(|abilities| abilities.guard.as_ref().map(|a| ability_id(self, a)))
|
||||
.or_else(|| {
|
||||
ability_set(EquipSlot::ActiveMainhand)
|
||||
.and_then(|abilities| abilities.guard.as_ref().map(|a| ability_id(self, a)))
|
||||
}),
|
||||
.and_then(|abilities| abilities.guard.as_ref().map(|a| ability_id(self, a))),
|
||||
Ability::SpeciesMovement => None, // TODO: Make not None
|
||||
Ability::MainWeaponAux(index) => ability_set(EquipSlot::ActiveMainhand)
|
||||
.and_then(|abilities| abilities.abilities.get(index).map(|a| ability_id(self, a))),
|
||||
@ -3015,7 +2983,7 @@ bitflags::bitflags! {
|
||||
const PARRIES = 0b00000001;
|
||||
// Allows blocking to interrupt the ability at any point
|
||||
const BLOCK_INTERRUPT = 0b00000010;
|
||||
// When the ability is in the buildup section, it counts as a block with 50% DR
|
||||
// The ability will block melee attacks in the buildup portion
|
||||
const BLOCKS = 0b00000100;
|
||||
// When in the ability, an entity only receives half as much poise damage
|
||||
const POISE_RESISTANT = 0b00001000;
|
||||
|
@ -25,7 +25,8 @@ pub struct StaticData {
|
||||
pub recover_duration: Duration,
|
||||
/// Max angle (45.0 will give you a 90.0 angle window)
|
||||
pub max_angle: f32,
|
||||
/// What percentage of power is effective
|
||||
/// Base value that incoming damage is reduced by and converted to poise
|
||||
/// damage
|
||||
pub block_strength: f32,
|
||||
/// What durations are considered a parry
|
||||
pub parry_window: ParryWindow,
|
||||
|
@ -18,7 +18,8 @@ pub struct StaticData {
|
||||
pub swing_duration: Duration,
|
||||
/// How long the state has until exiting
|
||||
pub recover_duration: Duration,
|
||||
/// What percentage of power is effective
|
||||
/// Base value that incoming damage is reduced by and converted to poise
|
||||
/// damage
|
||||
pub block_strength: f32,
|
||||
/// Used to construct the Melee attack
|
||||
pub melee_constructor: MeleeConstructor,
|
||||
|
@ -1402,10 +1402,7 @@ pub fn get_hands(data: &JoinData<'_>) -> (Option<Hands>, Option<Hands>) {
|
||||
|
||||
pub fn get_tool_stats(data: &JoinData<'_>, ai: AbilityInfo) -> tool::Stats {
|
||||
ai.hand
|
||||
.map(|hand| match hand {
|
||||
HandInfo::TwoHanded | HandInfo::MainHand => EquipSlot::ActiveMainhand,
|
||||
HandInfo::OffHand => EquipSlot::ActiveOffhand,
|
||||
})
|
||||
.map(|hand| hand.to_equip_slot())
|
||||
.and_then(|slot| data.inventory.and_then(|inv| inv.equipped(slot)))
|
||||
.and_then(|item| {
|
||||
if let ItemKind::Tool(tool) = &*item.kind() {
|
||||
@ -1607,6 +1604,13 @@ impl HandInfo {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_equip_slot(&self) -> EquipSlot {
|
||||
match self {
|
||||
HandInfo::TwoHanded | HandInfo::MainHand => EquipSlot::ActiveMainhand,
|
||||
HandInfo::OffHand => EquipSlot::ActiveOffhand,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn leave_stance(data: &JoinData<'_>, output_events: &mut OutputEvents) {
|
||||
|
@ -56,7 +56,8 @@ impl Animation for BlockAnimation {
|
||||
| Some("common.abilities.axe.basic_guard")
|
||||
| Some("common.abilities.hammer.basic_guard")
|
||||
| Some("common.abilities.sword.defensive_guard")
|
||||
| Some("common.abilities.shield.basic_guard") => {
|
||||
| Some("common.abilities.shield.basic_guard")
|
||||
| Some("common.abilities.shield.power_guard") => {
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let (movement1base, move2, movement3) = match stage_section {
|
||||
|
@ -14,7 +14,6 @@ use common::{
|
||||
inventory::slot::EquipSlot, item::ItemKind, CharacterAbilityType, CharacterState,
|
||||
Inventory, Pos,
|
||||
},
|
||||
states::utils::HandInfo,
|
||||
terrain::TerrainChunk,
|
||||
vol::ReadVol,
|
||||
};
|
||||
@ -149,10 +148,7 @@ impl CombatEventMapper {
|
||||
let equip_slot = character_state
|
||||
.ability_info()
|
||||
.and_then(|ability| ability.hand)
|
||||
.map_or(EquipSlot::ActiveMainhand, |hand| match hand {
|
||||
HandInfo::TwoHanded | HandInfo::MainHand => EquipSlot::ActiveMainhand,
|
||||
HandInfo::OffHand => EquipSlot::ActiveOffhand,
|
||||
});
|
||||
.map_or(EquipSlot::ActiveMainhand, |hand| hand.to_equip_slot());
|
||||
|
||||
if let Some(item) = inventory.equipped(equip_slot) {
|
||||
if let ItemKind::Tool(data) = &*item.kind() {
|
||||
|
@ -564,6 +564,7 @@ pub fn ability_image(imgs: &img_ids::Imgs, ability_id: &str) -> image::Id {
|
||||
"common.abilities.sceptre.wardingaura" => imgs.skill_sceptre_aura,
|
||||
// Shield
|
||||
"common.abilities.shield.singlestrike" => imgs.onehshield_m1,
|
||||
"common.abilities.shield.power_guard" => imgs.onehshield_m1,
|
||||
// Dagger
|
||||
"common.abilities.dagger.tempbasic" => imgs.onehdagger_m1,
|
||||
// Pickaxe
|
||||
|
Loading…
Reference in New Issue
Block a user