summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index e187b7e8b..726deaa9a 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -476,9 +476,9 @@ int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* b
return 0;
// Couldn't preserve 3rd Class/Summoner skills except only when using Reproduce skill. [Jobbie]
- if (!(sd->sc.data[SC__REPRODUCE]) &&
- ((skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK) ||
- (skill_id >= RL_GLITTERING_GREED && skill_id <= OB_AKAITSUKI) ||
+ if (!(sd->sc.data[SC__REPRODUCE]) &&
+ ((skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK) ||
+ (skill_id >= RL_GLITTERING_GREED && skill_id <= OB_AKAITSUKI) ||
(skill_id >= GC_DARKCROW && skill_id <= SU_FRESHSHRIMP)))
return 0;
// Reproduce will only copy skills according on the list. [Jobbie]
@@ -806,7 +806,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
break; // If a normal attack is a skill, it's splash damage. [Inkfish]
if(sd) {
// Automatic trigger of Blitz Beat
- if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=pc->checkskill(sd,HT_BLITZBEAT))>0 &&
+ if (pc_isfalcon(sd) && sd->weapontype == W_BOW && (temp=pc->checkskill(sd,HT_BLITZBEAT))>0 &&
rnd()%1000 <= sstatus->luk*3 ) {
rate = sd->status.job_level / 10 + 1;
skill->castend_damage_id(src,bl,HT_BLITZBEAT,(temp<rate)?temp:rate,tick,SD_LEVEL);
@@ -815,7 +815,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
if( pc_iswug(sd) && (temp=pc->checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*3 )
skill->castend_damage_id(src,bl,RA_WUGSTRIKE,temp,tick,0);
// Gank
- if(dstmd && sd->status.weapon != W_BOW &&
+ if(dstmd && sd->weapontype != W_BOW &&
(temp=pc->checkskill(sd,RG_SNATCHER)) > 0 &&
(temp*15 + 55) + pc->checkskill(sd,TF_STEAL)*10 > rnd()%1000) {
if(pc->steal_item(sd,bl,pc->checkskill(sd,TF_STEAL)))
@@ -2012,7 +2012,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in
if (sd->bonus.unbreakable)
rate -= rate*sd->bonus.unbreakable/100;
if (where&EQP_WEAPON) {
- switch (sd->status.weapon) {
+ switch (sd->weapontype) {
case W_FIST: //Bare fists should not break :P
case W_1HAXE:
case W_2HAXE:
@@ -5917,7 +5917,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
case SA_LIGHTNINGLOADER:
case SA_SEISMICWEAPON:
if (dstsd) {
- if(dstsd->status.weapon == W_FIST ||
+ if (dstsd->weapontype == W_FIST ||
(dstsd->sc.count && !dstsd->sc.data[type] &&
( //Allow re-enchanting to lengthen time. [Skotlex]
dstsd->sc.data[SC_PROPERTYFIRE] ||
@@ -13391,7 +13391,7 @@ int skill_isammotype (struct map_session_data *sd, int skill_id)
nullpo_ret(sd);
return (
battle_config.arrow_decrement==2 &&
- (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)) &&
+ (sd->weapontype == W_BOW || (sd->weapontype >= W_REVOLVER && sd->weapontype <= W_GRENADE)) &&
skill_id != HT_PHANTASMIC &&
skill->get_type(skill_id) == BF_WEAPON &&
!(skill->get_nk(skill_id)&NK_NO_DAMAGE) &&
@@ -13832,9 +13832,9 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
break;
case PR_REDEMPTIO:
{
- int exp;
- if( ((exp = pc->nextbaseexp(sd)) > 0 && get_percentage(sd->status.base_exp, exp) < 1) ||
- ((exp = pc->nextjobexp(sd)) > 0 && get_percentage(sd->status.job_exp, exp) < 1)) {
+ int64 exp;
+ if (((exp = pc->nextbaseexp(sd)) > 0 && get_percentage64(sd->status.base_exp, exp) < 1) ||
+ ((exp = pc->nextjobexp(sd)) > 0 && get_percentage64(sd->status.job_exp, exp) < 1)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); //Not enough exp.
return 0;
}
@@ -14245,7 +14245,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
}
break;
case ST_SHIELD:
- if(sd->status.shield <= 0) {
+ if (!sd->has_shield) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -14555,7 +14555,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
clif->messagecolor_self(sd->fd, COLOR_RED, e_msg);
return 0;
}
- if (!(require.ammo&1<<sd->inventory_data[i]->look)) { //Ammo type check. Send the "wrong weapon type" message
+ if (!(require.ammo&1<<sd->inventory_data[i]->subtype)) { //Ammo type check. Send the "wrong weapon type" message
//which is the closest we have to wrong ammo type. [Skotlex]
clif->arrow_fail(sd,0); //Haplo suggested we just send the equip-arrows message instead. [Skotlex]
//clif->skill_fail(sd,skill_id,USESKILL_FAIL_THIS_WEAPON,0);
@@ -18984,7 +18984,8 @@ void skill_init_unit_layout (void)
void skill_init_unit_layout_unknown(int skill_idx)
{
- ShowError("unknown unit layout at skill %d\n", skill_idx);
+ Assert_retv(skill_idx >= 0 && skill_idx < MAX_SKILL_DB);
+ ShowError("unknown unit layout at skill %d\n", skill->dbs->db[skill_idx].nameid);
}
int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id)
@@ -19530,7 +19531,7 @@ void skill_validate_skilltype(struct config_setting_t *conf, struct s_skill_db *
}
}
}
-
+
/**
* Validates "SkillInfo" when reading skill_db.conf
* @param conf struct, pointer to skill configuration
@@ -20442,7 +20443,7 @@ void skill_validate_additional_fields(struct config_setting_t *conf, struct s_sk
bool skill_validate_skilldb(struct s_skill_db *sk, const char *source)
{
int idx;
-
+
nullpo_retr(false, sk);
idx = skill->get_index(sk->nameid);
if (idx == 0) {
@@ -20460,10 +20461,10 @@ bool skill_validate_skilldb(struct s_skill_db *sk, const char *source)
strdb_iput(skill->name2id_db, skill->dbs->db[idx].name, skill->dbs->db[idx].nameid);
/* Set Name to Id script constants */
script->set_constant2(skill->dbs->db[idx].name, (int)skill->dbs->db[idx].nameid, false, false);
-
+
return true;
}
-
+
/**
* Reads skill_db.conf from relative filepath and processes [ Smokexyz/Hercules ]
* entries into the skill database.
@@ -20477,11 +20478,11 @@ bool skill_read_skilldb(const char *filename)
char filepath[256];
int count=0, index=0;
bool duplicate[MAX_SKILL] = {0};
-
+
nullpo_retr(false, filename);
sprintf(filepath,"db/%s",filename);
-
+
if (!libconfig->load_file(&skilldb, filepath)) {
return false; // Libconfig error report.
}
@@ -20503,9 +20504,9 @@ bool skill_read_skilldb(const char *filename)
ShowError("skill_read_skilldb: Skill Id not specified for entry %d in '%s', skipping...\n", index, filepath );
continue;
}
-
+
tmp_db.nameid = skill_id;
-
+
if((idx = skill->get_index(skill_id)) == 0) {
ShowError("skill_read_skilldb: Skill Id %d is out of range, or within a reserved range (for guild, homunculus, mercenary or elemental skills). skipping...\n", idx);
continue;
@@ -20515,7 +20516,7 @@ bool skill_read_skilldb(const char *filename)
ShowWarning("skill_read_skilldb: Duplicate Skill Id %d in entry %d in '%s', skipping...\n", skill_id, index, filepath);
continue;
}
-
+
/* Skill Name Constant */
if (!libconfig->setting_lookup_mutable_string(conf, "Name", tmp_db.name, sizeof(tmp_db.name))) {
ShowError("skill_read_skilldb: Name not specified for skill Id %d in '%s', skipping...\n", skill_id, filepath);
@@ -20705,12 +20706,12 @@ bool skill_read_skilldb(const char *filename)
/* Additional Fields for Plugins */
skill->validate_additional_fields(conf, &tmp_db);
-
+
// Validate the skill entry, add it to the duplicate array and increment count on success.
if ((duplicate[idx] = skill->validate_skilldb(&tmp_db, filepath)))
count++;
}
-
+
libconfig->destroy(&skilldb);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filepath);
@@ -20742,7 +20743,7 @@ void skill_readdb(bool minimal)
safestrncpy(skill->dbs->db[0].desc, "Unknown Skill", sizeof(skill->dbs->db[0].desc));
itemdb->name_constants(); // refresh ItemDB constants before loading of skills
-
+
#ifdef ENABLE_CASE_CHECK
script->parser_current_file = DBPATH"skill_db.conf";
#endif // ENABLE_CASE_CHECK
@@ -20753,7 +20754,7 @@ void skill_readdb(bool minimal)
if (minimal)
return;
-
+
skill->init_unit_layout();
sv->readdb(map->db_path, "produce_db.txt", ',', 4, 4+2*MAX_PRODUCE_RESOURCE, MAX_SKILL_PRODUCE_DB, skill->parse_row_producedb);
sv->readdb(map->db_path, "create_arrow_db.txt", ',', 1+2, 1+2*MAX_ARROW_RESOURCE, MAX_SKILL_ARROW_DB, skill->parse_row_createarrowdb);