Hammer skill tree complete.

This commit is contained in:
Sam 2020-12-20 17:28:17 -05:00
parent 72604e8a4e
commit 4dfe14c103
10 changed files with 246 additions and 6 deletions

View File

@ -3,7 +3,7 @@ ComboMelee(
stage: 1,
base_damage: 130,
damage_increase: 10,
knockback: 0.0,
knockback: 10.0,
range: 4.5,
angle: 50.0,
base_buildup_duration: 600,

View File

@ -3,7 +3,7 @@ ItemDef(
description: "Shouldn't this be a hammer?",
kind: Tool(
(
kind: Axe,
kind: Hammer,
stats: (
equip_time_millis: 0,
power: 1000.0,

View File

@ -21,4 +21,17 @@
Axe(LKnockback): Some(2),
Axe(LCost): Some(2),
Axe(LDistance): Some(2),
Hammer(SsKnockback): Some(2),
Hammer(SsDamage): Some(3),
Hammer(SsRegen): Some(2),
Hammer(SsSpeed): Some(3),
Hammer(CDamage): Some(3),
Hammer(CKnockback): Some(3),
Hammer(CDrain): Some(2),
Hammer(CSpeed): Some(2),
Hammer(LDamage): Some(2),
Hammer(LCost): Some(2),
Hammer(LDistance): Some(2),
Hammer(LKnockback): Some(2),
Hammer(LRange): Some(2),
})

View File

@ -28,4 +28,15 @@
Axe(LKnockback): {Axe(LUnlockLeap): None},
Axe(LCost): {Axe(LUnlockLeap): None},
Axe(LDistance): {Axe(LUnlockLeap): None},
Hammer(SsDamage): {Hammer(SsKnockback): Some(1)},
Hammer(SsRegen): {Hammer(SsKnockback): Some(1)},
Hammer(SsSpeed): {Hammer(SsKnockback): Some(1)},
Hammer(CDamage): {Hammer(CKnockback): Some(1)},
Hammer(CDrain): {Hammer(CKnockback): Some(1)},
Hammer(CSpeed): {Hammer(CKnockback): Some(1)},
Hammer(LDamage): {Hammer(LUnlockLeap): None},
Hammer(LCost): {Hammer(LUnlockLeap): None},
Hammer(LDistance): {Hammer(LUnlockLeap): None},
Hammer(LKnockback): {Hammer(LUnlockLeap): None},
Hammer(LRange): {Hammer(LUnlockLeap): None},
})

View File

@ -43,7 +43,20 @@
Axe(LDistance),
],
Weapon(Hammer): [
Hammer(UnlockLeap),
Hammer(SsKnockback),
Hammer(SsDamage),
Hammer(SsSpeed),
Hammer(SsRegen),
Hammer(CDamage),
Hammer(CKnockback),
Hammer(CDrain),
Hammer(CSpeed),
Hammer(LUnlockLeap),
Hammer(LDamage),
Hammer(LCost),
Hammer(LDistance),
Hammer(LKnockback),
Hammer(LRange),
],
Weapon(Bow): [
Bow(UnlockRepeater),

View File

@ -1111,6 +1111,76 @@ impl Client {
SkillGroupType::Weapon(Hammer),
)));
},
"@unlock hammer combo" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::SsKnockback,
)));
},
"@unlock hammer combo damage" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::SsDamage,
)));
},
"@unlock hammer combo speed" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::SsSpeed,
)));
},
"@unlock hammer combo regen" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::SsRegen,
)));
},
"@unlock hammer charge knockback" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::CKnockback,
)));
},
"@unlock hammer charge damage" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::CDamage,
)));
},
"@unlock hammer charge drain" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::CDrain,
)));
},
"@unlock hammer charge speed" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::CSpeed,
)));
},
"@unlock hammer leap unlock" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::LUnlockLeap,
)));
},
"@unlock hammer leap damage" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::LDamage,
)));
},
"@unlock hammer leap cost" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::LCost,
)));
},
"@unlock hammer leap distance" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::LDistance,
)));
},
"@unlock hammer leap knockback" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::LKnockback,
)));
},
"@unlock hammer leap range" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::Hammer(
HammerSkill::LRange,
)));
},
"@unlock bow" => {
self.send_msg(ClientGeneral::UnlockSkill(Skill::UnlockGroup(
SkillGroupType::Weapon(Bow),

View File

@ -512,7 +512,7 @@ impl CharacterAbility {
ref mut is_interruptible,
ref mut speed_increase,
ref mut max_speed_increase,
ref mut stage_data,
ref stage_data,
ref mut max_energy_gain,
ref mut scales_from_combo,
..
@ -707,6 +707,109 @@ impl CharacterAbility {
_ => {},
}
},
ToolKind::Hammer => {
use skills::HammerSkill::*;
match self {
ComboMelee {
ref mut speed_increase,
ref mut max_speed_increase,
ref mut stage_data,
ref mut max_energy_gain,
ref mut scales_from_combo,
..
} => {
if let Some(level) = skills.get(&Hammer(SsKnockback)).copied().flatten()
{
*stage_data = (*stage_data)
.iter()
.map(|s| s.modify_strike(1.5_f32.powi(level.into())))
.collect::<Vec<combo_melee::Stage<u64>>>();
}
let speed_segments =
Hammer(SsSpeed).get_max_level().unwrap_or(1) as f32;
let speed_level =
skills.get(&Hammer(SsSpeed)).copied().flatten().unwrap_or(0) as f32;
{
*speed_increase *= speed_level / speed_segments;
*max_speed_increase *= speed_level / speed_segments;
}
let energy_level = if let Some(level) =
skills.get(&Hammer(SsRegen)).copied().flatten()
{
level
} else {
0
};
{
*max_energy_gain = (*max_energy_gain as f32
* ((energy_level + 1) * stage_data.len() as u16) as f32
/ ((Hammer(SsRegen).get_max_level().unwrap() + 1)
* stage_data.len() as u16)
as f32)
as u32;
}
*scales_from_combo = skills
.get(&Hammer(SsDamage))
.copied()
.flatten()
.unwrap_or(0)
.into();
},
ChargedMelee {
ref mut scaled_damage,
ref mut scaled_knockback,
ref mut energy_drain,
ref mut speed,
..
} => {
if let Some(level) = skills.get(&Hammer(CDamage)).copied().flatten() {
*scaled_damage =
(*scaled_damage as f32 * 1.25_f32.powi(level.into())) as u32;
}
if let Some(level) = skills.get(&Hammer(CKnockback)).copied().flatten()
{
*scaled_knockback *= 1.5_f32.powi(level.into());
}
if let Some(level) = skills.get(&Hammer(CDrain)).copied().flatten() {
*energy_drain =
(*energy_drain as f32 * 0.75_f32.powi(level.into())) as u32;
}
if let Some(level) = skills.get(&Hammer(CSpeed)).copied().flatten() {
*speed *= 1.23_f32.powi(level.into());
}
},
LeapMelee {
ref mut base_damage,
ref mut knockback,
ref mut energy_cost,
ref mut forward_leap_strength,
ref mut vertical_leap_strength,
ref mut range,
..
} => {
if let Some(level) = skills.get(&Hammer(LDamage)).copied().flatten() {
*base_damage =
(*base_damage as f32 * 1.4_f32.powi(level.into())) as u32;
}
if let Some(level) = skills.get(&Hammer(LKnockback)).copied().flatten()
{
*knockback *= 1.4_f32.powi(level.into());
}
if let Some(level) = skills.get(&Hammer(LCost)).copied().flatten() {
*energy_cost =
(*energy_cost as f32 * 0.75_f32.powi(level.into())) as u32;
}
if let Some(level) = skills.get(&Hammer(LDistance)).copied().flatten() {
*forward_leap_strength *= 1.4_f32.powi(level.into());
*vertical_leap_strength *= 1.4_f32.powi(level.into());
}
if let Some(level) = skills.get(&Hammer(LRange)).copied().flatten() {
*range += 1.0 * level as f32;
}
},
_ => {},
}
},
_ => {},
}
}

View File

@ -121,7 +121,23 @@ pub enum AxeSkill {
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub enum HammerSkill {
UnlockLeap,
// Single strike upgrades
SsKnockback,
SsDamage,
SsSpeed,
SsRegen,
// Charged melee upgrades
CDamage,
CKnockback,
CDrain,
CSpeed,
// Leap upgrades
LUnlockLeap,
LDamage,
LCost,
LDistance,
LKnockback,
LRange,
}
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -58,6 +58,11 @@ impl Stage<u64> {
self.base_recover_duration = (self.base_recover_duration as f32 / speed) as u64;
self
}
pub fn modify_strike(mut self, knockback_mult: f32) -> Self {
self.knockback *= knockback_mult;
self
}
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]

View File

@ -3,7 +3,7 @@ use crate::{
inventory::slot::EquipSlot,
item::{Hands, ItemKind, Tool, ToolKind},
quadruped_low, quadruped_medium,
skills::{AxeSkill, Skill, SwordSkill},
skills::{AxeSkill, HammerSkill, Skill, SwordSkill},
theropod, Body, CharacterState, StateUpdate,
},
consts::{FRIC_GROUND, GRAVITY},
@ -503,6 +503,15 @@ pub fn handle_ability3_input(data: &JoinData, update: &mut StateUpdate) {
{
None
},
Some(ToolKind::Hammer)
if !&data
.stats
.skill_set
.skills
.contains_key(&Skill::Hammer(HammerSkill::LUnlockLeap)) =>
{
None
},
_ => Some(s),
})
.map(|a| {