Skip to content

Commit

Permalink
Merge pull request #34550 from KorGgenT/AEA_PULSE
Browse files Browse the repository at this point in the history
AEA_PULSE
  • Loading branch information
ZhilkinSerg committed Oct 8, 2019
2 parents 308c677 + af14cb2 commit 2904bfd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
29 changes: 29 additions & 0 deletions data/json/legacy_artifact_active.json
Original file line number Diff line number Diff line change
Expand Up @@ -523,5 +523,34 @@
"max_damage": 40,
"valid_targets": [ "self" ],
"extra_effects": [ { "id": "AEA_SCREAM_morale" } ]
},
{
"type": "SPELL",
"id": "AEA_PULSE_bash_terrain",
"name": "Bash Terrain",
"description": "Damages the terrain",
"valid_targets": [ "self", "ally", "hostile", "ground" ],
"effect": "bash",
"min_damage": 40,
"max_damage": 40,
"min_aoe": 2,
"max_aoe": 2
},
{
"type": "SPELL",
"id": "AEA_PULSE",
"name": "Artifact Pulse",
"description": "Damages the terrain",
"message": "",
"sound_description": "The earth shakes!",
"sound_id": "misc",
"sound_variant": "earthquake",
"sound_ambient": true,
"sound_type": "combat",
"valid_targets": [ "self" ],
"min_damage": 30,
"max_damage": 30,
"effect": "noise",
"extra_effects": [ { "id": "AEA_PULSE_bash_terrain" }, { "id": "AEA_PULSE_bash_terrain" }, { "id": "AEA_PULSE_bash_terrain" } ]
}
]
2 changes: 2 additions & 0 deletions doc/MAGIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ Any aoe will manifest as a circular area centered on the target, and will only d

* "mutate" - mutates the target(s). if effect_str is defined, mutates toward that category instead of picking at random. the "MUTATE_TRAIT" flag allows effect_str to be a specific trait instead of a category. damage() / 100 is the percent chance the mutation will be successful (a value of 10000 represents 100.00%)

* "bash" - bashes the terrain at the target. uses damage() as the strength of the bash.

* "WONDER" - Unlike the above, this is not an "effect" but a "flag". This alters the behavior of the parent spell drastically: The spell itself doesn't cast, but its damage and range information is used in order to cast the extra_effects. N of the extra_effects will be chosen at random to be cast, where N is the current damage of the spell (stacks with RANDOM_DAMAGE flag) and the message of the spell cast by this spell will also be displayed. If this spell's message is not wanted to be displayed, make sure the message is an empty string.

* "RANDOM_TARGET" - A special spell flag (like wonder) that forces the spell to choose a random valid target within range instead of the caster choosing the target. This also affects extra_effects.
Expand Down
1 change: 1 addition & 0 deletions src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ void spell_type::load( JsonObject &jo, const std::string & )
{ "map", spell_effect::map },
{ "morale", spell_effect::morale },
{ "mutate", spell_effect::mutate },
{ "bash", spell_effect::bash },
{ "none", spell_effect::none }
};

Expand Down
1 change: 1 addition & 0 deletions src/magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ void mod_moves( const spell &sp, Creature &caster, const tripoint &target );
void map( const spell &sp, Creature &caster, const tripoint & );
void morale( const spell &sp, Creature &caster, const tripoint &target );
void mutate( const spell &sp, Creature &caster, const tripoint &target );
void bash( const spell &sp, Creature &caster, const tripoint &target );
void none( const spell &sp, Creature &, const tripoint &target );
} // namespace spell_effect

Expand Down
12 changes: 12 additions & 0 deletions src/magic_spell_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,3 +810,15 @@ void spell_effect::mutate( const spell &sp, Creature &caster, const tripoint &ta
sp.make_sound( potential_target );
}
}

void spell_effect::bash( const spell &sp, Creature &caster, const tripoint &target )
{
const std::set<tripoint> area = spell_effect_blast( sp, caster.pos(), target, sp.aoe(), false );
for( const tripoint &potential_target : area ) {
if( !sp.is_valid_target( caster, potential_target ) ) {
continue;
}
// the bash already makes noise, so no need for spell::make_sound()
g->m.bash( potential_target, sp.damage(), sp.has_flag( spell_flag::SILENT ) );
}
}

0 comments on commit 2904bfd

Please sign in to comment.