summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c55
-rw-r--r--src/map/itemdb.c64
-rw-r--r--src/map/script.c8
3 files changed, 64 insertions, 63 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 0530510c4..135247734 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -838,21 +838,17 @@ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, ui
* Elemental attribute fix.
*------------------------------------------*/
int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag){
- struct status_data *sstatus, *tstatus;
- struct status_change *sc;
-
+ struct status_data *tstatus;
+
nullpo_ret(src);
nullpo_ret(target);
- sstatus = iStatus->get_status_data(src);
tstatus = iStatus->get_status_data(target);
- sc = iStatus->get_sc(src);
-
+
if( (nk&NK_NO_ELEFIX) || n_ele )
return damage;
- if( damage > 0 )
- {
+ if( damage > 0 ) {
if( left )
damage = battle->attr_fix(src, target, damage, s_ele_, tstatus->def_ele, tstatus->ele_lv);
else{
@@ -863,14 +859,22 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16
damage += battle_attr_fix(src,target,50*skill_lv,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv);
}
}
+
#ifndef RENEWAL
- if( sc && sc->data[SC_SUB_WEAPONPROPERTY] )
- { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex]
- int temp = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
- damage += battle->attr_fix(src, target, temp, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv);
- if( left ){
- temp = battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
+ {
+ struct status_data *sstatus;
+ struct status_change *sc;
+
+ sstatus = iStatus->get_status_data(src);
+ sc = iStatus->get_sc(src);
+
+ if( sc && sc->data[SC_SUB_WEAPONPROPERTY] ) { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex]
+ int temp = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
damage += battle->attr_fix(src, target, temp, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv);
+ if( left ) {
+ temp = battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
+ damage += battle->attr_fix(src, target, temp, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv);
+ }
}
}
#endif
@@ -3210,8 +3214,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
unsigned int skillratio = 100; //Skill dmg modifiers.
TBL_PC *sd;
-// TBL_PC *tsd;
- struct status_change *sc, *tsc;
+ struct status_change *sc;
struct Damage ad;
struct status_data *sstatus = iStatus->get_status_data(src);
struct status_data *tstatus = iStatus->get_status_data(target);
@@ -3240,9 +3243,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
flag.imdef = nk&NK_IGNORE_DEF?1:0;
sd = BL_CAST(BL_PC, src);
-// tsd = BL_CAST(BL_PC, target);
+
sc = iStatus->get_sc(src);
- tsc = iStatus->get_sc(target);
//Initialize variables that will be used afterwards
s_ele = skill->get_ele(skill_id, skill_lv);
@@ -3929,7 +3931,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
{
unsigned int skillratio = 100; //Skill dmg modifiers.
short temp=0;
- short s_ele, s_ele_, t_class;
+ short s_ele, s_ele_;
int i, nk;
bool n_ele = false; // non-elemental
@@ -4095,7 +4097,6 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
return wd;
}
- t_class = iStatus->get_class(target);
s_ele = s_ele_ = skill->get_ele(skill_id, skill_lv);
if( !skill_id || s_ele == -1 )
{ //Take weapon's element
@@ -5167,7 +5168,7 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
//Calculates BF_WEAPON returned damage.
int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int *dmg, int flag, uint16 skill_id, int *delay){
- int rdamage = 0, damage = *dmg, rdelay = *delay, trdamage = 0;
+ int rdamage = 0, damage = *dmg, trdamage = 0;
struct map_session_data* sd;
struct status_change* sc;
int max_reflect_damage;
@@ -5194,18 +5195,18 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int
if( flag & BF_SHORT) {//Bounces back part of the damage.
if ( sd && sd->bonus.short_weapon_damage_return ){
NORMALIZE_RDAMAGE(damage * sd->bonus.short_weapon_damage_return / 100);
- rdelay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
+ *delay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
}
if( sc && sc->count ) {
if( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION ){
NORMALIZE_RDAMAGE(damage * sc->data[SC_REFLECTSHIELD]->val2 / 100);
- rdelay = clif->skill_damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, CR_REFLECTSHIELD, 1, 4);
+ *delay = clif->skill_damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, CR_REFLECTSHIELD, 1, 4);
}
if( sc->data[SC_LG_REFLECTDAMAGE] && rand()%100 < (30 + 10*sc->data[SC_LG_REFLECTDAMAGE]->val1) ) {
if( skill_id != HT_LANDMINE && skill_id != HT_CLAYMORETRAP
&& skill_id != RA_CLUSTERBOMB && (skill_id <= RA_VERDURETRAP || skill_id > RA_ICEBOUNDTRAP) && skill_id != MA_LANDMINE ){
NORMALIZE_RDAMAGE((*dmg) * sc->data[SC_LG_REFLECTDAMAGE]->val2 / 100);
- rdelay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
+ *delay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
}
}
if( sc->data[SC_DEATHBOUND] && skill_id != WS_CARTTERMINATION && !is_boss(src) ) {
@@ -5219,18 +5220,18 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int
skill->blown(bl, src, skill->get_blewcount(RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1), unit_getdir(src), 0);
if( skill_id )
status_change_end(bl, SC_DEATHBOUND, INVALID_TIMER);
- rdelay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
+ *delay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
}
}
if( sc->data[SC_SHIELDSPELL_DEF] && sc->data[SC_SHIELDSPELL_DEF]->val1 == 2 && !is_boss(src) ){
NORMALIZE_RDAMAGE(damage * sc->data[SC_SHIELDSPELL_DEF]->val2 / 100);
- rdelay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
+ *delay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
}
}
} else {
if (sd && sd->bonus.long_weapon_damage_return){
NORMALIZE_RDAMAGE(damage * sd->bonus.long_weapon_damage_return / 100);
- rdelay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
+ *delay = clif->damage(src, src, iTimer->gettick(), status_get_amotion(src), status_get_dmotion(src), rdamage, 1, 4, 0);
}
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 5dee2bb00..e703ead68 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -720,31 +720,31 @@ void itemdb_write_cached_packages(const char *config_filename) {
}
// first 2 bytes = package count
- fwrite(&pcount,sizeof(pcount),1,file);
+ hwrite(&pcount,sizeof(pcount),1,file);
for(i = 0; i < pcount; i++) {
unsigned short id = itemdb->packages[i].id, random_qty = itemdb->packages[i].random_qty, must_qty = itemdb->packages[i].must_qty;
unsigned short c;
//into a package, first 2 bytes = id.
- fwrite(&id,sizeof(id),1,file);
+ hwrite(&id,sizeof(id),1,file);
//next 2 bytes = must count
- fwrite(&must_qty,sizeof(must_qty),1,file);
+ hwrite(&must_qty,sizeof(must_qty),1,file);
//next 2 bytes = random count
- fwrite(&random_qty,sizeof(random_qty),1,file);
+ hwrite(&random_qty,sizeof(random_qty),1,file);
//now we loop into must
for(c = 0; c < must_qty; c++) {
struct item_package_must_entry *entry = &itemdb->packages[i].must_items[c];
unsigned char announce = entry->announce == 1 ? 1 : 0, named = entry->named == 1 ? 1 : 0;
//first 2 byte = item id
- fwrite(&entry->id,sizeof(entry->id),1,file);
+ hwrite(&entry->id,sizeof(entry->id),1,file);
//next 2 byte = qty
- fwrite(&entry->qty,sizeof(entry->qty),1,file);
+ hwrite(&entry->qty,sizeof(entry->qty),1,file);
//next 2 byte = hours
- fwrite(&entry->hours,sizeof(entry->hours),1,file);
+ hwrite(&entry->hours,sizeof(entry->hours),1,file);
//next 1 byte = announce (1:0)
- fwrite(&announce,sizeof(announce),1,file);
+ hwrite(&announce,sizeof(announce),1,file);
//next 1 byte = named (1:0)
- fwrite(&named,sizeof(announce),1,file);
+ hwrite(&named,sizeof(announce),1,file);
}
//now we loop into random groups
for(c = 0; c < random_qty; c++) {
@@ -752,23 +752,23 @@ void itemdb_write_cached_packages(const char *config_filename) {
unsigned short group_qty = group->random_qty, h;
//next 2 bytes = how many entries in this group
- fwrite(&group_qty,sizeof(group_qty),1,file);
+ hwrite(&group_qty,sizeof(group_qty),1,file);
//now we loop into the group's list
for(h = 0; h < group_qty; h++) {
struct item_package_rand_entry *entry = &itemdb->packages[i].random_groups[c].random_list[h];
unsigned char announce = entry->announce == 1 ? 1 : 0, named = entry->named == 1 ? 1 : 0;
//first 2 byte = item id
- fwrite(&entry->id,sizeof(entry->id),1,file);
+ hwrite(&entry->id,sizeof(entry->id),1,file);
//next 2 byte = qty
- fwrite(&entry->qty,sizeof(entry->qty),1,file);
+ hwrite(&entry->qty,sizeof(entry->qty),1,file);
//next 2 byte = rate
- fwrite(&entry->rate,sizeof(entry->rate),1,file);
+ hwrite(&entry->rate,sizeof(entry->rate),1,file);
//next 2 byte = hours
- fwrite(&entry->hours,sizeof(entry->hours),1,file);
+ hwrite(&entry->hours,sizeof(entry->hours),1,file);
//next 1 byte = announce (1:0)
- fwrite(&announce,sizeof(announce),1,file);
+ hwrite(&announce,sizeof(announce),1,file);
//next 1 byte = named (1:0)
- fwrite(&named,sizeof(announce),1,file);
+ hwrite(&named,sizeof(announce),1,file);
}
}
}
@@ -787,7 +787,7 @@ bool itemdb_read_cached_packages(const char *config_filename) {
}
// first 2 bytes = package count
- fread(&pcount,sizeof(pcount),1,file);
+ hread(&pcount,sizeof(pcount),1,file);
CREATE(itemdb->packages, struct item_package, pcount);
itemdb->package_count = pcount;
@@ -799,11 +799,11 @@ bool itemdb_read_cached_packages(const char *config_filename) {
unsigned short c;
//into a package, first 2 bytes = id.
- fread(&id,sizeof(id),1,file);
+ hread(&id,sizeof(id),1,file);
//next 2 bytes = must count
- fread(&must_qty,sizeof(must_qty),1,file);
+ hread(&must_qty,sizeof(must_qty),1,file);
//next 2 bytes = random count
- fread(&random_qty,sizeof(random_qty),1,file);
+ hread(&random_qty,sizeof(random_qty),1,file);
if( !(data = itemdb->exists(id)) )
ShowWarning("itemdb_read_packages: unknown package item '%d', skipping..\n",id);
@@ -825,15 +825,15 @@ bool itemdb_read_cached_packages(const char *config_filename) {
unsigned char announce = 0, named = 0;
struct item_data *data;
//first 2 byte = item id
- fread(&mid,sizeof(mid),1,file);
+ hread(&mid,sizeof(mid),1,file);
//next 2 byte = qty
- fread(&qty,sizeof(qty),1,file);
+ hread(&qty,sizeof(qty),1,file);
//next 2 byte = hours
- fread(&hours,sizeof(hours),1,file);
+ hread(&hours,sizeof(hours),1,file);
//next 1 byte = announce (1:0)
- fread(&announce,sizeof(announce),1,file);
+ hread(&announce,sizeof(announce),1,file);
//next 1 byte = named (1:0)
- fread(&named,sizeof(announce),1,file);
+ hread(&named,sizeof(announce),1,file);
if( !(data = itemdb->exists(mid)) )
ShowWarning("itemdb_read_packages: unknown item '%d' in package '%s'!\n",mid,itemdb_name(package->id));
@@ -853,7 +853,7 @@ bool itemdb_read_cached_packages(const char *config_filename) {
struct item_package_rand_entry *prev = NULL;
//next 2 bytes = how many entries in this group
- fread(&group_qty,sizeof(group_qty),1,file);
+ hread(&group_qty,sizeof(group_qty),1,file);
package->random_groups[c].random_qty = group_qty;
CREATE(package->random_groups[c].random_list, struct item_package_rand_entry, package->random_groups[c].random_qty);
@@ -868,17 +868,17 @@ bool itemdb_read_cached_packages(const char *config_filename) {
if( prev ) prev->next = entry;
//first 2 byte = item id
- fread(&mid,sizeof(mid),1,file);
+ hread(&mid,sizeof(mid),1,file);
//next 2 byte = qty
- fread(&qty,sizeof(qty),1,file);
+ hread(&qty,sizeof(qty),1,file);
//next 2 byte = rate
- fread(&rate,sizeof(rate),1,file);
+ hread(&rate,sizeof(rate),1,file);
//next 2 byte = hours
- fread(&hours,sizeof(hours),1,file);
+ hread(&hours,sizeof(hours),1,file);
//next 1 byte = announce (1:0)
- fread(&announce,sizeof(announce),1,file);
+ hread(&announce,sizeof(announce),1,file);
//next 1 byte = named (1:0)
- fread(&named,sizeof(announce),1,file);
+ hread(&named,sizeof(announce),1,file);
if( !(data = itemdb->exists(mid)) )
ShowWarning("itemdb_read_packages: unknown item '%d' in package '%s'!\n",mid,itemdb_name(package->id));
diff --git a/src/map/script.c b/src/map/script.c
index b5edec220..3cb31b726 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10486,13 +10486,13 @@ BUILDIN(removemapflag)
{
int16 m,i;
const char *str;
- int val=0;
+ //int val=0;//warning: variable ‘val’ set but not used" - deprecated?
str=script_getstr(st,2);
i=script_getnum(st,3);
- if(script_hasdata(st,4)){
- val=script_getnum(st,4);
- }
+ //if(script_hasdata(st,4)){
+ // val=script_getnum(st,4);
+ //}
m = iMap->mapname2mapid(str);
if(m >= 0) {
switch(i) {