summaryrefslogtreecommitdiff
path: root/src/emap/script_buildins.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r--src/emap/script_buildins.c74
1 files changed, 0 insertions, 74 deletions
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.