Commit 48ab1c0d authored by Ruby's avatar Ruby

Add count to granted powers

parent 5c86826e
Pipeline #158265768 passed with stages
in 3 minutes and 31 seconds
......@@ -152,11 +152,12 @@ Adjusts the "phase" of the target, which modifies what the target can see and/or
### Power (`power`)
Grants a power to the target.
Grants a power to the target or executes a power.
| Field | Type | Description |
| --- | --- | --- |
| `powers` | array | An array of objects that point to the granted powers. See [power reference](#power-reference) below. |
| `count` | int | If a granted power that gives more than 1 stack, this will be the number granted. |
| `powers` | array | An array of objects that point to the granted/executed powers. See [power reference](#power-reference) below. |
### Reward (`reward`)
......@@ -203,6 +204,7 @@ Adjusts the values of script variables.
References a power elsewhere in the data set.
| Field | Type | Destruction |
| --- | --- | --- |
| `name` | key | The internal name of the power. |
| `url` | url | A URL pointing to the [power set](powersets.md) where the referenced power can be found. |
......
......@@ -166,8 +166,7 @@ fn mark_powers_in_power_param(
power_sets: &mut Keyed<BasePowerSet>,
powers: &mut Keyed<BasePower>,
) {
// side note, the i_count in the param seems to be completely wrong
// also the power categories and sets are never used, everything is flattened into the power name
// the power categories and sets are never used, everything is flattened into the power name
for power_name in &power_param.ppch_power_names {
mark_power_for_inclusion(power_name, archetypes, power_cats, power_sets, powers);
}
......
......@@ -79,6 +79,8 @@ pub enum AttribModParamOutput {
vision_phases: Vec<i32>,
},
Power {
#[serde(skip_serializing_if = "Option::is_none")]
count: Option<i32>,
powers: Vec<AttribModParamPowerRefAndUrl>,
},
Reward {
......@@ -99,10 +101,7 @@ pub enum AttribModParamOutput {
}
impl AttribModParamOutput {
fn from_attrib_mod_param(
param: &AttribModParam,
config: &PowersConfig,
) -> Option<Self> {
fn from_attrib_mod_param(param: &AttribModParam, config: &PowersConfig) -> Option<Self> {
match param {
AttribModParam::Costume(c) => Some(AttribModParamOutput::Costume {
costume_name: c.pch_costume_name.clone(),
......@@ -153,7 +152,8 @@ impl AttribModParamOutput {
url: make_power_ref_url(Some(power_name), config),
});
}
Some(AttribModParamOutput::Power { powers })
let count = if p.i_count > 1 { Some(p.i_count) } else { None };
Some(AttribModParamOutput::Power { count, powers })
}
AttribModParam::Reward(r) => Some(AttribModParamOutput::Reward {
rewards: r.ppch_rewards.clone(),
......@@ -377,8 +377,7 @@ impl AttribModOutput {
}
// params
if let Some(param) = &attrib_mod.p_params {
output.parameter =
AttribModParamOutput::from_attrib_mod_param(param, config);
output.parameter = AttribModParamOutput::from_attrib_mod_param(param, config);
}
// scaling per archetype
if !matches!(output.attr_type, Some(AttribType::kAttribType_Special)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment