From 64f5b4f481768e661b26002de4d763981de129dc Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 10 Apr 2021 17:54:47 -0300 Subject: Remove calcdmg(); There's a risk of a loop and I don't wanna hear of it. This is pre-renewal with much less overhead, we can use Atk/Matk without mods. Means no criticals; But with no evasion and no defense it is like "always crit". --- src/emap/init.c | 1 - src/emap/script_buildins.c | 74 ---------------------------------------------- src/emap/script_buildins.h | 1 - 3 files changed, 76 deletions(-) (limited to 'src') diff --git a/src/emap/init.c b/src/emap/init.c index 8cad8aa..eafb828 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -225,7 +225,6 @@ HPExport void plugin_init (void) // From Moubootaur Legends addScriptCommand("aggravate", "i", aggravate); - addScriptCommand("calcdmg", "iii", calcdmg); addScriptCommand("harm", "ii??", harm); // Overrides diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index c534de6..4053158 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -2748,80 +2748,6 @@ BUILDIN(aggravate) return true; } -// Returns the estimated damage (ATK or MATK) -// Advantage over getunitdata is: Takes crit and etc. in account -// types: 1- physical; 2- magic. -// calcdmg(source, target, type) -BUILDIN(calcdmg) -{ - struct block_list *src; - struct block_list *bl; - int attack_type, range, damage; - struct map_session_data *sd; - - // Fill data from scripts - src = map->id2bl(script_getnum(st, 2)); - bl = map->id2bl(script_getnum(st, 3)); - attack_type = script_getnum(st,4); - - // Nullity check for source - if (src == NULL) { - ShowWarning("buildin_calcdmg: Error in finding object with given GID %d!\n", script_getnum(st, 2)); - script_pushint(st, 0); - return false; - } - - // Maybe we don't want a target? - if (script_getnum(st, 3) <= 0) { - sd = BL_CAST(BL_PC, src); - switch(attack_type) { - case BF_WEAPON: - range = sd->battle_status.rhw.atk2-sd->battle_status.rhw.atk; - if (range <= 1) - damage = sd->battle_status.rhw.atk; - else - damage = rnd()%range + sd->battle_status.rhw.atk; - damage = damage + rnd()%sd->battle_status.batk; - script_pushint(st, damage); - break; - case BF_MAGIC: - range = sd->battle_status.matk_max-sd->battle_status.matk_min; - if (range <= 1) - script_pushint(st, sd->battle_status.matk_min); - else - script_pushint(st, rnd()%range + sd->battle_status.matk_min); - break; - default: - ShowWarning("buildin_calcdmg: Invalid attack type %d!\n", attack_type); - script_pushint(st, 0); - return false; - } - - return true; - } - - // Nullity check for target - if (bl == NULL) { - ShowWarning("buildin_calcdmg: Error in finding object with given GID %d!\n", script_getnum(st, 3)); - script_pushint(st, 0); - return false; - } - - // Get ATK or MATK - struct Damage d; - switch(attack_type) { - case BF_WEAPON: d = battle->calc_weapon_attack(src, bl, 0,0,0); break; - case BF_MAGIC: d = battle->calc_magic_attack(src, bl, 0,0,0); break; - default: - ShowWarning("buildin_calcdmg: Invalid attack type %d!\n", attack_type); - script_pushint(st, 0); - return false; - break; - } - - script_pushint(st, d.damage); - return true; -} // Like heal() but works against anything (casts battle funcs) // types: 1- physical; 2- magic. diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h index bdc79d2..13d818a 100644 --- a/src/emap/script_buildins.h +++ b/src/emap/script_buildins.h @@ -110,7 +110,6 @@ BUILDIN(getskillname); // Imported from Moubootaur Legends BUILDIN(aggravate); -BUILDIN(calcdmg); BUILDIN(harm); // Overrides -- cgit v1.2.3-60-g2f50