add impaler upgrades
This commit is contained in:
parent
4c5a650a1a
commit
6cea0e97e9
5 changed files with 92 additions and 7 deletions
|
|
@ -11,6 +11,7 @@ combat = { path = "../combat" }
|
|||
building = { path = "../building" }
|
||||
resources = { path = "../resources" }
|
||||
combat_damagers = { path = "../combat_damagers" }
|
||||
upgrade = { path = "../upgrade" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@
|
|||
|
||||
use bevy::prelude::*;
|
||||
use building::{BuildingInfo, BuildingPreview, PREVIEW_ALPHA, PopulatePlacedBuilding};
|
||||
use combat::Health;
|
||||
use combat::{Defense, Health};
|
||||
use combat_damagers::ContactDamage;
|
||||
use resources::{Cost, Quantity};
|
||||
use upgrade::{Upgrade, UpgradeApplied, UpgradeTree};
|
||||
|
||||
pub struct BuildingImpalerPlugin;
|
||||
|
||||
|
|
@ -48,6 +49,87 @@ fn register(
|
|||
});
|
||||
|
||||
let info = commands.spawn_empty().id();
|
||||
let tier3 = vec![
|
||||
commands
|
||||
.spawn((
|
||||
Name::new("become mega"),
|
||||
Upgrade {
|
||||
description: "i will be mega :o".to_string(),
|
||||
cost: Quantity {
|
||||
souls: 250,
|
||||
bones: 50,
|
||||
},
|
||||
unlocks: vec![],
|
||||
},
|
||||
))
|
||||
.observe(
|
||||
|trigger: Trigger<UpgradeApplied>,
|
||||
mut query: Query<(&mut Transform, &mut Health)>| {
|
||||
if let Ok((mut tf, mut health)) = query.get_mut(trigger.event().building) {
|
||||
tf.scale *= 2.;
|
||||
tf.translation.y += 1.5;
|
||||
*health = Health::new(health.max * 3.);
|
||||
}
|
||||
},
|
||||
)
|
||||
.id(),
|
||||
];
|
||||
let tier2 = vec![
|
||||
commands
|
||||
.spawn((
|
||||
Name::new("grow some more"),
|
||||
Upgrade {
|
||||
description: "i grow some more :)".to_string(),
|
||||
cost: Quantity {
|
||||
souls: 50,
|
||||
bones: 10,
|
||||
},
|
||||
unlocks: tier3,
|
||||
},
|
||||
))
|
||||
.observe(
|
||||
|trigger: Trigger<UpgradeApplied>,
|
||||
mut query: Query<(&mut Transform, &mut Health, &mut Defense)>| {
|
||||
if let Ok((mut tf, mut health, mut defense)) =
|
||||
query.get_mut(trigger.event().building)
|
||||
{
|
||||
tf.scale *= 2.;
|
||||
tf.translation.y += 0.75;
|
||||
defense.amount += 3.;
|
||||
*health = Health::new(health.max * 2.);
|
||||
}
|
||||
},
|
||||
)
|
||||
.id(),
|
||||
];
|
||||
let upgrades = vec![
|
||||
commands
|
||||
.spawn((
|
||||
Name::new("grow"),
|
||||
Upgrade {
|
||||
description: "i grow".to_string(),
|
||||
cost: Quantity {
|
||||
souls: 10,
|
||||
bones: 5,
|
||||
},
|
||||
unlocks: tier2,
|
||||
},
|
||||
))
|
||||
.observe(
|
||||
|trigger: Trigger<UpgradeApplied>,
|
||||
mut query: Query<(&mut Transform, &mut Health, &mut Defense)>| {
|
||||
if let Ok((mut tf, mut health, mut defense)) =
|
||||
query.get_mut(trigger.event().building)
|
||||
{
|
||||
tf.scale *= 1.5;
|
||||
tf.translation.y += 0.25;
|
||||
defense.amount += 2.;
|
||||
*health = Health::new(health.max * 2.);
|
||||
}
|
||||
},
|
||||
)
|
||||
.id(),
|
||||
];
|
||||
let preview = commands
|
||||
.spawn((
|
||||
BuildingPreview { info },
|
||||
|
|
@ -62,6 +144,7 @@ fn register(
|
|||
size: SIZE,
|
||||
unlocked: true,
|
||||
},
|
||||
UpgradeTree { upgrades },
|
||||
Cost(Quantity { souls: 5, bones: 0 }),
|
||||
Health::new(20.0),
|
||||
Name::new("Impaler"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue