diff options
author | shennetsind <ind@henn.et> | 2013-02-14 23:12:19 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-02-14 23:12:19 -0200 |
commit | ef49bfc4445d464f19f84d78a2e6a1a5a3d9f0ac (patch) | |
tree | df150223d48b5379d47a365c05a143691c79cdf6 /src/map/npc.c | |
parent | 7d33212f95653edd621961487f5622611d62ae88 (diff) | |
download | hercules-ef49bfc4445d464f19f84d78a2e6a1a5a3d9f0ac.tar.gz hercules-ef49bfc4445d464f19f84d78a2e6a1a5a3d9f0ac.tar.bz2 hercules-ef49bfc4445d464f19f84d78a2e6a1a5a3d9f0ac.tar.xz hercules-ef49bfc4445d464f19f84d78a2e6a1a5a3d9f0ac.zip |
New Mapflag adjust_skill_damage
Made as a improvement of the original ADJUST_SKILL_DAMAGE -- special thanks to Muad_Dib! .
This mapflag allows you to modify the damage of any skill in any map, for example
"prontera mapflag adjust_skill_damage MG_FIREBOLT 200"
doubles the damage of Firebolt in prontera
Another Example:
"prontera mapflag adjust_skill_damage MG_FIREBOLT 50"
Halves the damage of Firebolt in prontera.
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 265fbb01f..671b4485a 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3412,11 +3412,30 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", atoi(mod), w4, map[m].name, filepath, strline(buffer,start-buffer)); } else { int idx = map[m].unit_count; - RECREATE(map[m].units, struct adjust_unit_duration*, ++map[m].unit_count); - CREATE(map[m].units[idx],struct adjust_unit_duration,1); - map[m].units[idx]->skill_id = skill_id; + RECREATE(map[m].units, struct mapflag_skill_adjust*, ++map[m].unit_count); + CREATE(map[m].units[idx],struct mapflag_skill_adjust,1); + map[m].units[idx]->skill_id = (unsigned short)skill_id; map[m].units[idx]->modifier = (unsigned short)atoi(mod); } + } else if (!strcmpi(w3,"adjust_skill_damage")) { + char *mod; + int skill_id; + + strtok(w4,"\t");/* makes w4 contain only 4th param */ + + if( !(mod = strtok(NULL,"\t")) ) {/* makes mod contain only the 5th param */ + ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer)); + } else if( !( skill_id = skill_name2id(w4) ) ) { + ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", w4, map[m].name, filepath, strline(buffer,start-buffer)); + } else if ( atoi(mod) < 1 || atoi(mod) > USHRT_MAX ) { + ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_skill_damage' flag! removing flag from %s (file '%s', line '%d').\n", atoi(mod), w4, map[m].name, filepath, strline(buffer,start-buffer)); + } else { + int idx = map[m].skill_count; + RECREATE(map[m].skills, struct mapflag_skill_adjust*, ++map[m].skill_count); + CREATE(map[m].skills[idx],struct mapflag_skill_adjust,1); + map[m].skills[idx]->skill_id = (unsigned short)skill_id; + map[m].skills[idx]->modifier = (unsigned short)atoi(mod); + } } else ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').\n", w3, filepath, strline(buffer,start-buffer)); |