Skip to content

Commit

Permalink
Merge pull request #34551 from KorGgenT/AEA_ENTRANCE
Browse files Browse the repository at this point in the history
AEA_ENTRANCE
  • Loading branch information
ZhilkinSerg committed Oct 8, 2019
2 parents 2904bfd + da1e6d1 commit 44daa0d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/json/legacy_artifact_active.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,22 @@
"min_duration": 180000,
"max_duration": 180000
},
{
"type": "SPELL",
"id": "AEA_ENTRANCE",
"name": "Artifact Entrance",
"description": "Entrances surrounding monsters",
"effect": "charm_monster",
"message": "",
"min_damage": 0,
"max_damage": 600,
"min_duration": 500,
"max_duration": 5000,
"min_aoe": 8,
"max_aoe": 8,
"valid_targets": [ "self", "hostile" ],
"flags": [ "RANDOM_DAMAGE", "RANDOM_DURATION" ]
},
{
"type": "SPELL",
"id": "AEA_SCREAM",
Expand Down
2 changes: 2 additions & 0 deletions doc/MAGIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ Any aoe will manifest as a circular area centered on the target, and will only d

* "morale" - gives a morale effect to all npcs or avatar within aoe, with value damage(). decay_start is duration() / 10.

* "charm_monster" - charms a monster that has less hp than damage() for approximately duration()

* "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.
Expand Down
1 change: 1 addition & 0 deletions src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ void spell_type::load( JsonObject &jo, const std::string & )
{ "mod_moves", spell_effect::mod_moves },
{ "map", spell_effect::map },
{ "morale", spell_effect::morale },
{ "charm_monster", spell_effect::charm_monster },
{ "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 @@ -506,6 +506,7 @@ void flashbang( const spell &sp, Creature &caster, const tripoint &target );
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 charm_monster( 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 );
Expand Down
19 changes: 19 additions & 0 deletions src/magic_spell_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,25 @@ void spell_effect::morale( const spell &sp, Creature &caster, const tripoint &ta
}
}

void spell_effect::charm_monster( 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;
}
monster *mon = g->critter_at<monster>( potential_target );
if( !mon ) {
continue;
}
sp.make_sound( potential_target );
if( mon->friendly == 0 && mon->get_hp() <= sp.damage() ) {
mon->unset_dest();
mon->friendly += sp.duration() / 100;
}
}
}

void spell_effect::mutate( const spell &sp, Creature &caster, const tripoint &target )
{
const std::set<tripoint> area = spell_effect_blast( sp, caster.pos(), target, sp.aoe(), false );
Expand Down

0 comments on commit 44daa0d

Please sign in to comment.