Add skillbar stuff for 3rd skills

This commit is contained in:
jiminycrick 2020-09-21 13:45:50 -07:00
parent 951acfca21
commit 04175bab09
11 changed files with 118 additions and 9 deletions

BIN
assets/voxygen/element/icons/skill_axe_leap_slash.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/icons/skill_bow_jump_burst.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/icons/skill_hammergolf.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -86,6 +86,7 @@ pub enum CharacterAbility {
projectile_speed: f32,
repetitions: u32,
current_rep: u32,
leap: bool,
},
Boost {
duration: Duration,
@ -587,6 +588,7 @@ impl From<&CharacterAbility> for CharacterState {
projectile_speed,
repetitions,
current_rep,
leap,
} => CharacterState::RepeaterRanged(repeater_ranged::Data {
exhausted: false,
prepare_timer: Duration::default(),
@ -602,6 +604,7 @@ impl From<&CharacterAbility> for CharacterState {
repetitions: *repetitions,
current_rep: *current_rep,
initialize: true,
leap: *leap,
}),
CharacterAbility::GroundShockwave {
energy_cost: _,

View File

@ -322,10 +322,10 @@ impl Tool {
max_projectile_speed: 500.0,
},
RepeaterRanged {
energy_cost: 400,
energy_cost: 200,
holdable: true,
movement_duration: Duration::from_millis(200),
prepare_duration: Duration::from_millis(1000),
prepare_duration: Duration::from_millis(500),
recover_duration: Duration::from_millis(1000),
projectile: Projectile {
hit_solid: vec![projectile::Effect::Stick],
@ -345,6 +345,7 @@ impl Tool {
projectile_speed: 100.0,
repetitions: 4,
current_rep: 0,
leap: true,
},
],
Dagger(_) => vec![BasicMelee {

View File

@ -32,6 +32,8 @@ pub struct Data {
/// Current repetition
pub current_rep: u32,
pub initialize: bool,
/// Whether there should be a jump
pub leap: bool,
}
impl CharacterBehavior for Data {
@ -64,10 +66,13 @@ impl CharacterBehavior for Data {
repetitions: self.repetitions,
current_rep: self.current_rep,
initialize: false,
leap: self.leap,
});
} else if self.movement_duration != Duration::default() {
// Jumping
update.vel.0 = Vec3::new(data.vel.0[0], data.vel.0[1], 10.0);
if self.leap {
update.vel.0 = Vec3::new(data.vel.0[0], data.vel.0[1], 10.0);
}
update.character = CharacterState::RepeaterRanged(Data {
movement_duration: self
@ -87,6 +92,7 @@ impl CharacterBehavior for Data {
repetitions: self.repetitions,
current_rep: self.current_rep,
initialize: false,
leap: self.leap,
});
} else if !self.exhausted && self.current_rep < self.repetitions {
let mut projectile = self.projectile.clone();
@ -120,6 +126,7 @@ impl CharacterBehavior for Data {
repetitions: self.repetitions,
current_rep: self.current_rep + 1,
initialize: false,
leap: self.leap,
});
} else if self.recover_duration != Duration::default() {
// Recovery
@ -141,6 +148,7 @@ impl CharacterBehavior for Data {
repetitions: self.repetitions,
current_rep: 0,
initialize: false,
leap: self.leap,
});
return update;
} else {

View File

@ -81,6 +81,9 @@ impl State {
ToolKind::Staff(_) => true,
ToolKind::Debug(kind) => kind == "Boost",
ToolKind::Sword(_) => true,
ToolKind::Hammer(_) => true,
ToolKind::Axe(_) => true,
ToolKind::Bow(_) => true,
_ => false,
}
} else {

View File

@ -140,7 +140,7 @@ image_ids! {
flyingrod_m1: "voxygen.element.icons.debug_wand_m1",
flyingrod_m2: "voxygen.element.icons.debug_wand_m2",
sword_pierce: "voxygen.element.icons.skill_sword_pierce",
hammerleap: "voxygen.element.icons.skill_hammerleap",
hammergolf: "voxygen.element.icons.skill_hammergolf",
axespin: "voxygen.element.icons.skill_axespin",
// Skillbar
@ -277,6 +277,9 @@ image_ids! {
heal_0: "voxygen.element.icons.heal_0",
sword_whirlwind: "voxygen.element.icons.sword_whirlwind",
heal_bomb: "voxygen.element.icons.heal_bomb",
hammerleap: "voxygen.element.icons.skill_hammerleap",
skill_axe_leap_slash: "voxygen.element.icons.skill_axe_leap_slash",
skill_bow_jump_burst: "voxygen.element.icons.skill_bow_jump_burst",
// Buttons
button: "voxygen.element.buttons.button",

View File

@ -696,7 +696,8 @@ impl<'a> Widget for Skillbar<'a> {
Some(ToolKind::Sword(_)) => self.imgs.twohsword_m2,
Some(ToolKind::Dagger(_)) => self.imgs.onehdagger_m2,
Some(ToolKind::Shield(_)) => self.imgs.onehshield_m2,
Some(ToolKind::Hammer(_)) => self.imgs.hammerleap,
//Some(ToolKind::Hammer(_)) => self.imgs.hammerleap,
Some(ToolKind::Hammer(_)) => self.imgs.hammergolf,
Some(ToolKind::Axe(_)) => self.imgs.axespin,
Some(ToolKind::Bow(_)) => self.imgs.bow_m2,
Some(ToolKind::Sceptre(_)) => self.imgs.heal_bomb,
@ -809,6 +810,10 @@ impl<'a> Widget for Skillbar<'a> {
"Whirlwind",
"\nMove forward while spinning with \n your sword.",
)),
ToolKind::Bow(_) => Some((
"Burst",
"\nLaunches a burst of arrows at the top \nof a running leap.",
)),
ToolKind::Debug(kind) => match kind.as_ref() {
"Boost" => Some((
"Possessing Arrow",

View File

@ -85,6 +85,9 @@ pub enum HotbarImage {
Fireball,
SnakeArrow,
SwordWhirlwind,
HammerLeap,
AxeLeapSlash,
BowJumpBurst,
}
type HotbarSource<'a> = (&'a hotbar::State, &'a Inventory, &'a Loadout, &'a Energy);
@ -110,6 +113,9 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
match kind {
ItemKind::Tool(Tool { kind, .. }) => match kind {
ToolKind::Staff(_) => Some(HotbarImage::Fireball),
ToolKind::Hammer(_) => Some(HotbarImage::HammerLeap),
ToolKind::Axe(_) => Some(HotbarImage::AxeLeapSlash),
ToolKind::Bow(_) => Some(HotbarImage::BowJumpBurst),
ToolKind::Debug(kind) => match kind.as_ref() {
"Boost" => Some(HotbarImage::SnakeArrow),
_ => None,
@ -119,11 +125,27 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
},
_ => None,
}
.map(|image_key| {
(
.map(|image_key| match image_key {
HotbarImage::Fireball => (
image_key,
(energy.current() < 500).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
)
(energy.current() < 450).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
),
HotbarImage::HammerLeap => (
image_key,
(energy.current() < 700).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
),
HotbarImage::AxeLeapSlash => (
image_key,
(energy.current() < 300).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
),
HotbarImage::BowJumpBurst => (
image_key,
(energy.current() < 200).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
),
_ => (
image_key,
(energy.current() < 1000).then_some(Color::Rgba(1.0, 1.0, 1.0, 1.0)),
),
})
}),
})
@ -146,6 +168,9 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
HotbarImage::SnakeArrow => imgs.snake_arrow_0,
HotbarImage::Fireball => imgs.fire_spell_1,
HotbarImage::SwordWhirlwind => imgs.sword_whirlwind,
HotbarImage::HammerLeap => imgs.hammerleap,
HotbarImage::AxeLeapSlash => imgs.skill_axe_leap_slash,
HotbarImage::BowJumpBurst => imgs.skill_bow_jump_burst,
}
}
}

View File

@ -848,6 +848,32 @@ impl FigureMgr {
)
}
},
CharacterState::ChargedMelee(data) => {
if data.exhausted {
anim::character::AlphaAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
} else {
anim::character::ChargeAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0.magnitude(),
ori,
state.last_ori,
time,
),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
},
CharacterState::ChargedRanged(data) => {
if data.exhausted {
anim::character::ShootAnimation::update_skeleton(
@ -874,6 +900,32 @@ impl FigureMgr {
)
}
},
CharacterState::RepeaterRanged(data) => {
if data.exhausted {
anim::character::ShootAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
} else {
anim::character::ChargeAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0.magnitude(),
ori,
state.last_ori,
time,
),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
},
CharacterState::Sneak { .. } => {
anim::character::SneakAnimation::update_skeleton(
&CharacterSkeleton::default(),