Commit 5ef5c02d authored by Ruby's avatar Ruby

i26p6 started making use of the redirects field in EntCreate

parent c0e64b00
Pipeline #170759348 passed with stages
in 3 minutes and 40 seconds
......@@ -103,7 +103,7 @@ dependencies = [
[[package]]
name = "powers"
version = "2.0.4"
version = "2.0.5"
dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
......
[package]
name = "powers"
version = "2.0.4"
version = "2.0.5"
authors = ["Ruby <[email protected]>"]
edition = "2018"
......
......@@ -140,6 +140,7 @@ Creates an entity ("pet"). This could be a true pet such as a mastermind summon,
| `display_name` | string | The name of the entity as it's displayed in the game client. |
| `powers` | array | An array of objects that point to the granted powers. See [power reference](#power-reference) below. |
| `power_refs` | array | If for some reason the specific powers can't be loaded, this will contain the names of the powers as specified by the villain definition. |
| `redirects` | array | An arry of objects that point to _redirected_ powers. These replace the effect of summoning a pet if present. See [power reference](#power-reference) below. |
### Phase (`phase`)
......
......@@ -562,7 +562,7 @@ where
read_name_key_arr(&mut entcreate.ppch_powerset_names, reader, strings)?;
read_name_key_arr(&mut entcreate.ppch_power_names, reader, strings)?;
// i26p5: this appears to be an array that wasn't being used before
read_pool_string_arr(&mut entcreate.redirects, reader, strings, messages)?;
read_name_key_arr(&mut entcreate.redirects, reader, strings)?;
// pp powers TOK_NO_BIN
// p villain TOK_NO_BIN
// p class TOK_NO_BIN
......
......@@ -198,7 +198,19 @@ fn resolve_entity_defs_and_power_grants(
for param in &mut attrib_mod.p_params {
match param {
AttribModParam::EntCreate(e) if !e.resolved => {
if let Some(entity_def_name) = &e.pch_entity_def {
if e.redirects.len() > 0 {
// i26p6: Started seeing this in the beta files... instead
// of creating an entity, it redirects to one or more powers?
for redirect_def_name in &e.redirects {
mark_power_for_inclusion(
redirect_def_name,
&power.archetypes,
power_cats,
power_sets,
*p_powers.get(),
);
}
} else if let Some(entity_def_name) = &e.pch_entity_def {
if let Some(entity_def) = villains.get(entity_def_name) {
// copy entity def data into the mod param
e.villain_def = Some(Rc::clone(entity_def));
......
......@@ -65,6 +65,7 @@ pub enum AttribModParamOutput {
tags: Vec<String>,
},
CreateEntity {
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<NameKey>,
#[serde(skip_serializing_if = "Option::is_none")]
display_name: Option<String>,
......@@ -72,6 +73,8 @@ pub enum AttribModParamOutput {
powers: Vec<AttribModParamPowerRefAndUrl>,
#[serde(skip_serializing_if = "Vec::is_empty")]
power_names: Vec<NameKey>,
#[serde(skip_serializing_if = "Vec::is_empty")]
redirects: Vec<AttribModParamPowerRefAndUrl>,
},
Phase {
exclusive_vision_phase: i32,
......@@ -128,6 +131,23 @@ impl AttribModParamOutput {
display_name,
powers,
power_names: Vec::new(),
redirects: Vec::new(),
})
} else if e.redirects.len() > 0 {
let mut powers = Vec::new();
for power in &e.redirects {
powers.push(AttribModParamPowerRefAndUrl {
name: Some(power.clone()),
display_name: None, // TODO
url: make_power_ref_url(Some(power), config),
});
}
Some(AttribModParamOutput::CreateEntity {
name: None,
display_name: None,
powers: Vec::new(),
power_names: Vec::new(),
redirects: powers,
})
} else {
Some(AttribModParamOutput::CreateEntity {
......@@ -135,6 +155,7 @@ impl AttribModParamOutput {
display_name: e.pch_display_name.clone(),
powers: Vec::new(),
power_names: e.ppch_power_names.clone(),
redirects: Vec::new(),
})
}
}
......
......@@ -725,7 +725,7 @@ pub struct AttribModParam_EntCreate {
pub ppch_powerset_names: Vec<NameKey>,
pub ppch_power_names: Vec<NameKey>,
/// added i26p5
pub redirects: Vec<String>,
pub redirects: Vec<NameKey>,
/// reference to full Villain Def (not inline)
pub villain_def: Option<Rc<VillainDef>>,
/// reference to entity's powers (not inline)
......
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