summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-04 12:22:22 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-10 21:12:13 +0300
commit1165a64ff7f054cf4cb875b623c7943eb809b0e6 (patch)
treedb04d0faf579f84df586d7d304957201b7d5272a
parent5cdb3d12c4236e0c3a682e30fed96192d2c58188 (diff)
downloadhercules-1165a64ff7f054cf4cb875b623c7943eb809b0e6.tar.gz
hercules-1165a64ff7f054cf4cb875b623c7943eb809b0e6.tar.bz2
hercules-1165a64ff7f054cf4cb875b623c7943eb809b0e6.tar.xz
hercules-1165a64ff7f054cf4cb875b623c7943eb809b0e6.zip
Extend battle.c for using custom skills from plugins.
-rw-r--r--src/map/battle.c30
-rw-r--r--src/map/battle.h4
2 files changed, 34 insertions, 0 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index de57e7d2c..edb5fd69f 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -757,6 +757,9 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
case HT_FREEZINGTRAP:
damage += 40 * pc->checkskill(sd, RA_RESEARCHTRAP);
break;
+ default:
+ battle->calc_masteryfix_unknown(src, target, &skill_id, &skill_lv, &damage, &div, &left, &weapon);
+ break;
}
if( sc ){ // sc considered as masteries
@@ -837,6 +840,10 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
return damage;
}
+
+void battle_calc_masteryfix_unknown(struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int64 *damage, int *div, bool *left, bool *weapon) {
+}
+
/*==========================================
* Elemental attribute fix.
*------------------------------------------*/
@@ -1771,6 +1778,9 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
}
}
break;
+ default:
+ battle->calc_skillratio_magic_unknown(&attack_type, src, target, &skill_id, &skill_lv, &skillratio, &flag);
+ break;
}
break;
case BF_WEAPON:
@@ -2537,6 +2547,9 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
case MH_MAGMA_FLOW:
skillratio += -100 + 100 * skill_lv;
break;
+ default:
+ battle->calc_skillratio_weapon_unknown(&attack_type, src, target, &skill_id, &skill_lv, &skillratio, &flag);
+ break;
}
//Skill damage modifiers that stack linearly
if(sc && skill_id != PA_SACRIFICE){
@@ -2581,6 +2594,13 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
return 0;
return skillratio;
}
+
+void battle_calc_skillratio_magic_unknown(int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag) {
+}
+
+void battle_calc_skillratio_weapon_unknown(int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag) {
+}
+
/*==========================================
* Check damage trough status.
* ATK may be MISS, BLOCKED FAIL, reduce, increase, end status...
@@ -3938,6 +3958,9 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
}
break;
+ default:
+ battle->calc_misc_attack_unknown(src, target, &skill_id, &skill_lv, &mflag, &md);
+ break;
}
if (nk&NK_SPLASHSPLIT){ // Divide ATK among targets
@@ -4078,6 +4101,9 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
return md;
}
+void battle_calc_misc_attack_unknown(struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *mflag, struct Damage *md) {
+}
+
/*==========================================
* battle_calc_weapon_attack (by Skotlex)
*------------------------------------------*/
@@ -7262,4 +7288,8 @@ void battle_defaults(void) {
battle->config_adjust = battle_adjust_conf;
battle->get_enemy_area = battle_getenemyarea;
battle->damage_area = battle_damage_area;
+ battle->calc_masteryfix_unknown = battle_calc_masteryfix_unknown;
+ battle->calc_skillratio_magic_unknown = battle_calc_skillratio_magic_unknown;
+ battle->calc_skillratio_weapon_unknown = battle_calc_skillratio_weapon_unknown;
+ battle->calc_misc_attack_unknown = battle_calc_misc_attack_unknown;
}
diff --git a/src/map/battle.h b/src/map/battle.h
index e80e0091d..ea2538c30 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -612,6 +612,10 @@ struct battle_interface {
struct block_list* (*get_enemy_area) (struct block_list *src, int x, int y, int range, int type, int ignore_id);
/* damages area, originally for royal guard's reflect damage */
int (*damage_area) (struct block_list *bl, va_list ap);
+ void (*calc_masteryfix_unknown) (struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int64 *damage, int *div, bool *left, bool *weapon);
+ void (*calc_skillratio_magic_unknown) (int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag);
+ void (*calc_skillratio_weapon_unknown) (int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag);
+ void (*calc_misc_attack_unknown) (struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *mflag, struct Damage *md);
};
struct battle_interface *battle;