Skip to content

Commit

Permalink
AEA_DIM and AEA_LIGHT
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT committed Sep 21, 2019
1 parent 178117c commit 0b97f1a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
25 changes: 25 additions & 0 deletions data/json/legacy_artifact_active.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,30 @@
"effect": "vomit",
"base_casting_time": 100,
"message": "A wave of nausea passes through you!"
},
{
"type": "SPELL",
"id": "AEA_LIGHT",
"name": "Artifact Light",
"description": "Makes some light.",
"valid_targets": [ "self" ],
"effect": "timed_event",
"effect_str": "artifact_light",
"base_casting_time": 100,
"min_duration": 18000,
"max_duration": 18000,
"message": "You glow brightly!"
},
{
"type": "SPELL",
"id": "AEA_DIM",
"name": "Artifact Dim",
"description": "Darkens the sky.",
"valid_targets": [ "self" ],
"effect": "timed_event",
"effect_str": "dim",
"min_duration": 30000,
"max_duration": 30000,
"message": "The sky starts to dim."
}
]
2 changes: 2 additions & 0 deletions doc/MAGIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ Any aoe will manifest as a circular area centered on the target, and will only d

* "vomit" - any creature within its area of effect will instantly vomit, if it's able to do so.

* "timed_event" - adds a timed event to the player only. valid timed events: "help", "wanted", "robot_attack", "spawn_wyrms", "amigara", "roots_die", "temple_open", "temple_flood", "temple_spawn", "dim", "artifact_light" NOTE: This was added only for artifact active effects. support is limited, use at your own risk.

##### For Spells that have an attack type, these are the available damage types:
* "fire"
* "acid"
Expand Down
1 change: 1 addition & 0 deletions src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ void spell_type::load( JsonObject &jo, const std::string & )
{ "translocate", spell_effect::translocate },
{ "area_pull", spell_effect::area_pull },
{ "area_push", spell_effect::area_push },
{ "timed_event", spell_effect::timed_event },
{ "ter_transform", spell_effect::transform_blast },
{ "vomit", spell_effect::vomit },
{ "none", spell_effect::none }
Expand Down
2 changes: 2 additions & 0 deletions src/magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ void spawn_ethereal_item( const spell &sp, Creature &, const tripoint & );
void recover_energy( const spell &sp, Creature &, const tripoint &target );
void spawn_summoned_monster( const spell &sp, Creature &caster, const tripoint &target );
void translocate( const spell &sp, Creature &caster, const tripoint &target );
// adds a timed event to the caster only
void timed_event( const spell &sp, Creature &caster, const tripoint & );
void transform_blast( const spell &sp, Creature &caster, const tripoint &target );
void vomit( const spell &sp, Creature &caster, const tripoint &target );
void none( const spell &sp, Creature &, const tripoint &target );
Expand Down
28 changes: 28 additions & 0 deletions src/magic_spell_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "ret_val.h"
#include "rng.h"
#include "translations.h"
#include "timed_event.h"

static tripoint random_point( int min_distance, int max_distance, const tripoint &player_pos )
{
Expand Down Expand Up @@ -611,6 +612,33 @@ void spell_effect::recover_energy( const spell &sp, Creature &caster, const trip
sp.make_sound( caster.pos() );
}

void spell_effect::timed_event( const spell &sp, Creature &caster, const tripoint & )
{
const std::map<std::string, timed_event_type> timed_event_map{
{ "help", timed_event_type::TIMED_EVENT_HELP },
{ "wanted", timed_event_type::TIMED_EVENT_WANTED },
{ "robot_attack", timed_event_type::TIMED_EVENT_ROBOT_ATTACK },
{ "spawn_wyrms", timed_event_type::TIMED_EVENT_SPAWN_WYRMS },
{ "amigara", timed_event_type::TIMED_EVENT_AMIGARA },
{ "roots_die", timed_event_type::TIMED_EVENT_ROOTS_DIE },
{ "temple_open", timed_event_type::TIMED_EVENT_TEMPLE_OPEN },
{ "temple_flood", timed_event_type::TIMED_EVENT_TEMPLE_FLOOD },
{ "temple_spawn", timed_event_type::TIMED_EVENT_TEMPLE_SPAWN },
{ "dim", timed_event_type::TIMED_EVENT_DIM },
{ "artifact_light", timed_event_type::TIMED_EVENT_ARTIFACT_LIGHT }
};

timed_event_type spell_event = timed_event_type::TIMED_EVENT_NULL;

const auto iter = timed_event_map.find( sp.effect_data() );
if( iter != timed_event_map.cend() ) {
spell_event = iter->second;
}

sp.make_sound( caster.pos() );
g->timed_events.add( spell_event, calendar::turn + sp.duration_turns() );
}

static bool is_summon_friendly( const spell &sp )
{
const bool hostile = sp.has_flag( spell_flag::HOSTILE_SUMMON );
Expand Down

0 comments on commit 0b97f1a

Please sign in to comment.