summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-27 18:38:11 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-27 18:38:11 +0000
commitc19b8831b8134d9e8f000d8d5ee18ebaa2164fea (patch)
tree6c882ff6ee1fd988ec1f8fd28abf4fee7a0bcd95 /src/map
parent6b7b26291cbcabf23f5a28a684fdfcb317d7b53a (diff)
downloadhercules-c19b8831b8134d9e8f000d8d5ee18ebaa2164fea.tar.gz
hercules-c19b8831b8134d9e8f000d8d5ee18ebaa2164fea.tar.bz2
hercules-c19b8831b8134d9e8f000d8d5ee18ebaa2164fea.tar.xz
hercules-c19b8831b8134d9e8f000d8d5ee18ebaa2164fea.zip
- Moved coma to skill_additional_effect, added special_state.bonus_coma to prevent doing comma calculations for every player attack.
- Added config "vending_tax" to apply a tax to all vending requests, as it was in kRO Sakray some time ago (requested by Playtester) (items.conf). - Some cleaning of skill_additional_effect - Moved the starting of SC_DANCING from skill_initunitgroup to skill_unitsetting - Moved the checks for player_skill_partner_check and (gm_skilluncond for it) to skill_check_pc_partner - Negative aspd rate bonuses will be handled as aspd add rate since the default non-stackable bonus is useless on penalty bonuses. - Added check to prevent the client from using passive skills. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10082 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c19
-rw-r--r--src/map/battle.h3
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/pc.c20
-rw-r--r--src/map/skill.c82
-rw-r--r--src/map/vending.c2
8 files changed, 69 insertions, 64 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index a6dfba50b..715358142 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2928,20 +2928,6 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
battle_delay_damage(tick+wd.amotion, src, target, BF_WEAPON, 0, 0, damage, wd.dmg_lv, wd.dmotion);
- if (!status_isdead(target) && damage > 0) {
- if (sd) {
- int rate = 0;
- if (sd->weapon_coma_ele[tstatus->def_ele] > 0)
- rate += sd->weapon_coma_ele[tstatus->def_ele];
- if (sd->weapon_coma_race[tstatus->race] > 0)
- rate += sd->weapon_coma_race[tstatus->race];
- if (sd->weapon_coma_race[tstatus->mode&MD_BOSS?RC_BOSS:RC_NONBOSS] > 0)
- rate += sd->weapon_coma_race[tstatus->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
- if (rate)
- status_change_start(target, SC_COMA, rate, 0, 0, 0, 0, 0, 0);
- }
- }
-
if (sc && sc->data[SC_AUTOSPELL].timer != -1 && rand()%100 < sc->data[SC_AUTOSPELL].val4) {
int sp = 0;
int skillid = sc->data[SC_AUTOSPELL].val2;
@@ -3692,6 +3678,7 @@ static const struct battle_data_short {
{ "hom_rename", &battle_config.hom_rename },
{ "homunculus_show_growth", &battle_config.homunculus_show_growth }, //[orn]
{ "homunculus_friendly_rate", &battle_config.homunculus_friendly_rate },
+ { "vending_tax", &battle_config.vending_tax },
};
static const struct battle_data_int {
@@ -3955,6 +3942,7 @@ void battle_set_defaults() {
battle_config.mob_warp = 0;
battle_config.dead_branch_active = 0;
battle_config.vending_max_value = 10000000;
+ battle_config.vending_tax = 0;
battle_config.show_steal_in_same_party = 0;
battle_config.party_update_interval = 1000;
battle_config.party_share_type = 0;
@@ -4271,6 +4259,9 @@ void battle_validate_conf() {
if (battle_config.vending_max_value > MAX_ZENY || battle_config.vending_max_value==0)
battle_config.vending_max_value = MAX_ZENY;
+ if (battle_config.vending_tax > 10000)
+ battle_config.vending_tax = 10000;
+
if (battle_config.min_skill_delay_limit < 10)
battle_config.min_skill_delay_limit = 10; // minimum delay of 10ms
diff --git a/src/map/battle.h b/src/map/battle.h
index ada282eab..90b42444c 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -261,7 +261,8 @@ extern struct Battle_Config {
unsigned short chat_warpportal;
unsigned short mob_warp;
unsigned short dead_branch_active;
- unsigned int vending_max_value;
+ int vending_max_value;
+ unsigned short vending_tax;
unsigned short show_steal_in_same_party;
unsigned short party_share_type;
unsigned short party_hp_mode;
diff --git a/src/map/clif.c b/src/map/clif.c
index ded779626..4b39e07af 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9637,8 +9637,8 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) {
sd->idletime = last_tick;
tmp = skill_get_inf(skillnum);
- if (tmp&INF_GROUND_SKILL)
- return; //Using a ground skill on a target? WRONG.
+ if (tmp&INF_GROUND_SKILL || !tmp)
+ return; //Using a ground/passive skill on a target? WRONG.
if (skillnum >= HM_SKILLBASE && skillnum <= HM_SKILLBASE+MAX_HOMUNSKILL) {
clif_parse_UseSkillToId_homun(sd->hd, sd, tick, skillnum, skilllv, target_id);
diff --git a/src/map/map.c b/src/map/map.c
index 785b98504..1018a1cec 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2529,7 +2529,7 @@ int map_readallmaps (void)
exit(1); //No use launching server if maps can't be read.
}
- ShowStatus("Loading maps...\n");
+ ShowStatus("Loading maps (using %s as map cache)...\n", map_cache_file);
for(i = 0; i < map_num; i++)
{
diff --git a/src/map/map.h b/src/map/map.h
index 72e076fb4..fa78fb05d 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -618,6 +618,7 @@ struct map_session_data {
unsigned intravision : 1; // Maya Purple Card effect [DracoRPG]
unsigned perfect_hiding : 1; // [Valaris]
unsigned no_knockback : 1;
+ unsigned bonus_coma : 1;
} special_state;
int login_id1, login_id2;
unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
diff --git a/src/map/pc.c b/src/map/pc.c
index 4c057d849..41be58b42 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1534,9 +1534,11 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
ShowError("pc_bonus: bonus bAspd is no longer supported!\n");
break;
case SP_ASPD_RATE: //Non stackable increase
- if(sd->state.lr_flag != 2 && status->aspd_rate > 1000-val*10)
- status->aspd_rate = 1000-val*10;
- break;
+ if(val >= 0) { //Let negative ASPD bonuses become AddRate ones.
+ if(sd->state.lr_flag != 2 && status->aspd_rate > 1000-val*10)
+ status->aspd_rate = 1000-val*10;
+ break;
+ }
case SP_ASPD_ADDRATE: //Stackable increase - Made it linear as per rodatazone
if(sd->state.lr_flag != 2)
sd->aspd_add_rate -= val;
@@ -2130,12 +2132,16 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
ShowError("pc_bonus2: SP_WEAPON_COMA_ELE: Invalid element %d\n", type2);
break;
}
- if(sd->state.lr_flag != 2)
- sd->weapon_coma_ele[type2] += val;
+ if(sd->state.lr_flag == 2)
+ break;
+ sd->weapon_coma_ele[type2] += val;
+ sd->special_state.bonus_coma = 1;
break;
case SP_WEAPON_COMA_RACE:
- if(sd->state.lr_flag != 2)
- sd->weapon_coma_race[type2] += val;
+ if(sd->state.lr_flag == 2)
+ break;
+ sd->weapon_coma_race[type2] += val;
+ sd->special_state.bonus_coma = 1;
break;
case SP_RANDOM_ATTACK_INCREASE: // [Valaris]
if(sd->state.lr_flag !=2){
diff --git a/src/map/skill.c b/src/map/skill.c
index 91c7b327f..45bc7abd0 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1016,6 +1016,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
if (!tsc) //skill additional effect is about adding effects to the target...
//So if the target can't be inflicted with statuses, this is pointless.
return 0;
+ if (sc && !sc->count)
+ sc = NULL;
switch(skillid){
case 0: // Normal attacks (no skill used)
@@ -1024,8 +1026,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
// Automatic trigger of Blitz Beat
if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (skill=pc_checkskill(sd,HT_BLITZBEAT))>0 &&
rand()%1000 <= sstatus->luk*10/3+1 ) {
- int lv=(sd->status.job_level+9)/10;
- skill_castend_damage_id(src,bl,HT_BLITZBEAT,(skill<lv)?skill:lv,tick,SD_LEVEL);
+ rate=(sd->status.job_level+9)/10;
+ skill_castend_damage_id(src,bl,HT_BLITZBEAT,(skill<rate)?skill:rate,tick,SD_LEVEL);
}
// Gank
if(dstmd && sd->status.weapon != W_BOW &&
@@ -1037,33 +1039,41 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
clif_skill_fail(sd,RG_SNATCHER,0,0);
}
// Chance to trigger Taekwon kicks [Dralnu]
- if(sd->sc.count && sd->sc.data[SC_COMBO].timer == -1) {
- if(sd->sc.data[SC_READYSTORM].timer != -1 &&
+ if(sc && sc->data[SC_COMBO].timer == -1) {
+ if(sc->data[SC_READYSTORM].timer != -1 &&
sc_start(src,SC_COMBO, 15, TK_STORMKICK,
(2000 - 4*sstatus->agi - 2*sstatus->dex)))
; //Stance triggered
- else if(sd->sc.data[SC_READYDOWN].timer != -1 &&
+ else if(sc->data[SC_READYDOWN].timer != -1 &&
sc_start(src,SC_COMBO, 15, TK_DOWNKICK,
(2000 - 4*sstatus->agi - 2*sstatus->dex)))
; //Stance triggered
- else if(sd->sc.data[SC_READYTURN].timer != -1 &&
+ else if(sc->data[SC_READYTURN].timer != -1 &&
sc_start(src,SC_COMBO, 15, TK_TURNKICK,
(2000 - 4*sstatus->agi - 2*sstatus->dex)))
; //Stance triggered
- else if(sd->sc.data[SC_READYCOUNTER].timer != -1)
+ else if(sc->data[SC_READYCOUNTER].timer != -1)
{ //additional chance from SG_FRIEND [Komurka]
rate = 20;
- if (sd->sc.data[SC_SKILLRATE_UP].timer != -1 && sd->sc.data[SC_SKILLRATE_UP].val1 == TK_COUNTER) {
- rate += rate*sd->sc.data[SC_SKILLRATE_UP].val2/100;
+ if (sc->data[SC_SKILLRATE_UP].timer != -1 && sc->data[SC_SKILLRATE_UP].val1 == TK_COUNTER) {
+ rate += rate*sc->data[SC_SKILLRATE_UP].val2/100;
status_change_end(src,SC_SKILLRATE_UP,-1);
}
sc_start4(src,SC_COMBO, rate, TK_COUNTER, bl->id,0,0,
(2000 - 4*sstatus->agi - 2*sstatus->dex));
}
}
- }
- if (sc && sc->count) {
+ if (sd->special_state.bonus_coma) {
+ rate = sd->weapon_coma_ele[tstatus->def_ele];
+ rate += sd->weapon_coma_race[tstatus->race];
+ rate += sd->weapon_coma_race[tstatus->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
+ if (rate)
+ status_change_start(bl, SC_COMA, rate, 0, 0, 0, 0, 0, 0);
+ }
+ }
+
+ if (sc) {
// Enchant Poison gives a chance to poison attacked enemies
if(sc->data[SC_ENCPOISON].timer != -1) //Don't use sc_start since chance comes in 1/10000 rate.
status_change_start(bl,SC_POISON,sc->data[SC_ENCPOISON].val2,
@@ -6771,11 +6781,7 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid,
if(skillid==HT_TALKIEBOX ||
skillid==RG_GRAFFITI){
- group->valstr=(char *) aMallocA(MESSAGE_SIZE*sizeof(char));
- if(group->valstr==NULL){
- ShowFatalError("skill_castend_map: out of memory !\n");
- exit(1);
- }
+ group->valstr=(char *) aMalloc(MESSAGE_SIZE*sizeof(char));
if (sd)
memcpy(group->valstr,sd->message,MESSAGE_SIZE);
else //Eh... we have to write something here... even though mobs shouldn't use this. [Skotlex]
@@ -6870,6 +6876,20 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid,
skill_delunitgroup(src, group, 0);
return NULL;
}
+
+ if (group->state.song_dance) {
+ if(sd){
+ sd->skillid_dance = skillid;
+ sd->skilllv_dance = skilllv;
+ }
+ if (
+ sc_start4(src, SC_DANCING, 100, skillid, (int)group, skilllv,
+ (group->state.song_dance&2?BCT_SELF:0), limit+1000) &&
+ sd && group->state.song_dance&2 && skillid != CG_HERMODE //Hermod is a encore with a warp!
+ )
+ skill_check_pc_partner(sd, skillid, &skilllv, 1, 1);
+ }
+
if (skillid == NJ_TATAMIGAESHI) //Store number of tiles.
group->val1 = group->alive_count;
@@ -7774,6 +7794,11 @@ int skill_check_pc_partner (struct map_session_data *sd, int skill_id, int* skil
static int c=0;
static int p_sd[2] = { 0, 0 };
int i;
+
+ if (!battle_config.player_skill_partner_check ||
+ (battle_config.gm_skilluncond && pc_isGM(sd) >= battle_config.gm_skilluncond))
+ return 99; //As if there were infinite partners.
+
if (cast_flag)
{ //Execute the skill on the partners.
struct map_session_data* tsd;
@@ -8205,10 +8230,6 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
break;
case PR_BENEDICTIO:
{
- if (!battle_config.player_skill_partner_check ||
- (battle_config.gm_skilluncond && pc_isGM(sd) >= battle_config.gm_skilluncond)
- )
- break; //No need to do any partner checking [Skotlex]
if (!(type&1))
{ //Started casting.
if (skill_check_pc_partner(sd, skill, &lv, 1, 0) < 2)
@@ -8218,10 +8239,9 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
}
}
else
- { //Done casting
- //Should I repeat the check? If so, it would be best to only do this on cast-ending. [Skotlex]
+ //Should I repeat the check? If so, it would be best to only do
+ //this on cast-ending. [Skotlex]
skill_check_pc_partner(sd, skill, &lv, 1, 1);
- }
}
break;
case AM_CANNIBALIZE:
@@ -9845,22 +9865,6 @@ struct skill_unit_group *skill_initunitgroup (struct block_list *src, int count,
if (skillid == PR_SANCTUARY) //Sanctuary starts healing +1500ms after casted. [Skotlex]
group->tick += 1500;
group->valstr=NULL;
-
- i = skill_get_unit_flag(skillid); //Reuse for faster access from here on. [Skotlex]
- if (i&(UF_DANCE|UF_SONG|UF_ENSEMBLE)) {
- struct map_session_data *sd = NULL;
- if(src->type==BL_PC && (sd=(struct map_session_data *)src) ){
- sd->skillid_dance=skillid;
- sd->skilllv_dance=skilllv;
- }
- sc_start4(src,SC_DANCING,100,skillid,(int)group,skilllv,(i&UF_ENSEMBLE?BCT_SELF:0),skill_get_time(skillid,skilllv)+1000);
- if (sd && i&UF_ENSEMBLE && skillid != CG_HERMODE && //Hermod is a encore with a warp!
- battle_config.player_skill_partner_check &&
- (!battle_config.gm_skilluncond || pc_isGM(sd) < battle_config.gm_skilluncond)
- ) {
- skill_check_pc_partner(sd, skillid, &skilllv, 1, 1);
- }
- }
return group;
}
diff --git a/src/map/vending.c b/src/map/vending.c
index c12948de0..63551272c 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -158,6 +158,8 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha
//Logs
pc_payzeny(sd, (int)z);
+ if (battle_config.vending_tax)
+ z = z*battle_config.vending_tax/10000;
pc_getzeny(vsd, (int)z);
for(i = 0; 8 + 4 * i < len; i++) {