more scrolls
This commit is contained in:
parent
03ae8992f6
commit
f5394f10ab
4 changed files with 132 additions and 66 deletions
|
|
@ -7,7 +7,7 @@
|
|||
"value": 50,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "provides_healing": "2d4+2" },
|
||||
"magic": { "class": "common", "naming": "potion" }
|
||||
"magic": { "class": "uncommon", "naming": "potion" }
|
||||
},
|
||||
{
|
||||
"id": "potion_health_weak",
|
||||
|
|
@ -17,7 +17,27 @@
|
|||
"value": 25,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "provides_healing": "1d4+2" },
|
||||
"magic": { "class": "common", "naming": "potion" }
|
||||
"magic": { "class": "uncommon", "naming": "potion" }
|
||||
},
|
||||
{
|
||||
"id": "scroll_health",
|
||||
"name": { "name": "scroll of healing word", "plural": "scrolls of healing word" },
|
||||
"renderable": { "glyph": "?", "fg": "#00FFFF", "bg": "#000000", "order": 2 },
|
||||
"weight": 0.5,
|
||||
"value": 50,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "ranged": "12", "provides_healing": "1d4+2" },
|
||||
"magic": { "class": "uncommon", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
"id": "scroll_mass_health",
|
||||
"name": { "name": "scroll of mass healing word", "plural": "scrolls of mass healing word" },
|
||||
"renderable": { "glyph": "?", "fg": "#00FFFF", "bg": "#000000", "order": 2 },
|
||||
"weight": 0.5,
|
||||
"value": 200,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "ranged": "12", "aoe": "3", "provides_healing": "1d4+2" },
|
||||
"magic": { "class": "rare", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
"id": "scroll_magicmissile",
|
||||
|
|
@ -27,7 +47,17 @@
|
|||
"value": 50,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "ranged": "12", "damage": "3d4+3" },
|
||||
"magic": { "class": "common", "naming": "scroll" }
|
||||
"magic": { "class": "uncommon", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
"id": "scroll_embers",
|
||||
"name": { "name": "scroll of embers", "plural": "scrolls of embers" },
|
||||
"renderable": { "glyph": "?", "fg": "#00FFFF", "bg": "#000000", "order": 2 },
|
||||
"weight": 0.5,
|
||||
"value": 100,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "ranged": "10", "damage": "4d6", "aoe": "2" },
|
||||
"magic": { "class": "uncommon", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
"id": "scroll_fireball",
|
||||
|
|
@ -66,7 +96,7 @@
|
|||
"weight": 0.5,
|
||||
"value": 200,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "ranged": "10", "aoe": "4", "confusion": "3" },
|
||||
"effects": { "ranged": "10", "aoe": "3", "confusion": "3" },
|
||||
"magic": { "class": "veryrare", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,8 +38,12 @@
|
|||
{ "id": "scroll_confusion", "weight": 2, "difficulty": 1},
|
||||
{ "id": "scroll_magicmap_c", "weight": 2, "difficulty": 1},
|
||||
{ "id": "scroll_magicmap", "weight": 2, "difficulty": 1},
|
||||
{ "id": "scroll_embers", "weight": 2, "difficulty": 2},
|
||||
{ "id": "scroll_health", "weight": 2, "difficulty": 2},
|
||||
{ "id": "scroll_fireball", "weight": 2, "difficulty": 2},
|
||||
{ "id": "scroll_fireball_c", "weight": 2, "difficulty": 2}
|
||||
{ "id": "scroll_fireball_c", "weight": 2, "difficulty": 2},
|
||||
{ "id": "scroll_mass_health", "weight": 1, "difficulty": 2},
|
||||
{ "id": "scroll_mass_confusion", "weight": 1, "difficulty": 3}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use super::{add_effect, spatial, EffectType, Entity, Targets, World};
|
||||
use crate::{
|
||||
gamelog, gui::item_colour_ecs, gui::obfuscate_name_ecs, Confusion, Consumable, Cursed, InflictsDamage, MagicMapper,
|
||||
Prop, ProvidesHealing, ProvidesNutrition, RandomNumberGenerator, Renderable, RunState,
|
||||
gamelog, gui::item_colour_ecs, gui::obfuscate_name_ecs, gui::renderable_colour, Confusion, Consumable, Cursed,
|
||||
InflictsDamage, MagicMapper, Player, Prop, ProvidesHealing, ProvidesNutrition, RandomNumberGenerator, Renderable,
|
||||
RunState,
|
||||
};
|
||||
use rltk::prelude::*;
|
||||
use specs::prelude::*;
|
||||
|
|
@ -85,9 +86,29 @@ fn handle_healing(ecs: &mut World, event: &mut EventInfo, mut logger: gamelog::L
|
|||
let mut rng = ecs.write_resource::<RandomNumberGenerator>();
|
||||
let roll = rng.roll_dice(healing_item.n_dice, healing_item.sides) + healing_item.modifier;
|
||||
add_effect(event.source, EffectType::Healing { amount: roll }, event.target.clone());
|
||||
logger = logger.append("You recover some vigour.").buc(event.buc, None, Some("You feel great!"));
|
||||
for target in get_entity_targets(&event.target) {
|
||||
if ecs.read_storage::<Prop>().get(target).is_some() {
|
||||
continue;
|
||||
}
|
||||
let renderables = ecs.read_storage::<Renderable>();
|
||||
if ecs.read_storage::<Player>().get(target).is_some() {
|
||||
logger = logger
|
||||
.colour(renderable_colour(&renderables, target))
|
||||
.append("You")
|
||||
.colour(WHITE)
|
||||
.append("recover some vigour.")
|
||||
.buc(event.buc, None, Some("You feel great!"));
|
||||
} else {
|
||||
logger = logger
|
||||
.append("The")
|
||||
.colour(renderable_colour(&renderables, target))
|
||||
.append(obfuscate_name_ecs(ecs, target).0)
|
||||
.colour(WHITE)
|
||||
.append("is rejuvenated!");
|
||||
}
|
||||
event.log = true;
|
||||
}
|
||||
}
|
||||
return logger;
|
||||
}
|
||||
|
||||
|
|
@ -100,17 +121,21 @@ fn handle_damage(ecs: &mut World, event: &mut EventInfo, mut logger: gamelog::Lo
|
|||
if ecs.read_storage::<Prop>().get(target).is_some() {
|
||||
continue;
|
||||
}
|
||||
let fg = if let Some(renderable) = ecs.read_storage::<Renderable>().get(target) {
|
||||
((renderable.fg.r * 255.0) as u8, (renderable.fg.g * 255.0) as u8, (renderable.fg.b * 255.0) as u8)
|
||||
let renderables = ecs.read_storage::<Renderable>();
|
||||
if ecs.read_storage::<Player>().get(target).is_some() {
|
||||
logger = logger
|
||||
.colour(renderable_colour(&renderables, target))
|
||||
.append(obfuscate_name_ecs(ecs, target).0)
|
||||
.colour(WHITE)
|
||||
.append("are hit!");
|
||||
} else {
|
||||
WHITE
|
||||
};
|
||||
logger = logger
|
||||
.append("The")
|
||||
.colour(fg)
|
||||
.colour(renderable_colour(&renderables, target))
|
||||
.append(obfuscate_name_ecs(ecs, target).0)
|
||||
.colour(WHITE)
|
||||
.append("is hit!");
|
||||
}
|
||||
event.log = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,14 @@ pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity {
|
|||
raws::spawn_named_entity(
|
||||
&raws::RAWS.lock().unwrap(),
|
||||
ecs,
|
||||
"scroll_mass_confusion",
|
||||
"scroll_mass_health",
|
||||
raws::SpawnType::Carried { by: player },
|
||||
0,
|
||||
);
|
||||
raws::spawn_named_entity(
|
||||
&raws::RAWS.lock().unwrap(),
|
||||
ecs,
|
||||
"scroll_mass_health",
|
||||
raws::SpawnType::Carried { by: player },
|
||||
0,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue