- 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://svn.code.sf.net/p/rathena/svn/trunk@10082 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2007-03-27 18:38:11 +00:00
parent d6b2ea1268
commit 3839fa7619
11 changed files with 80 additions and 64 deletions

View File

@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/03/28
* 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. [Skotlex]
* Updated sql-files [Playtester]
* Removed a missing file reference in the athena-start script
* Fixed a #error "<malloc.h> has been replaced by <stdlib.h>" problem

View File

@ -1,5 +1,8 @@
Date Added
2007/03/28
* Added config "vending_tax" to apply a tax to all vending requests, as it
was in kRO Sakray some time ago (items.conf).
2007/03/22
* Made packet_ver_flag's description use hexadecimal values for the packet
versions, and changed the default to 0xFFFF. [Skotlex]

View File

@ -30,6 +30,11 @@
// The highest value at which an item can be sold via the merchant vend skill. (in zeny) (Note 3)
vending_max_value: 1000000000
// Tax to apply to all vending transactions (eg: 10000 = 100%, 50 = 0.50%)
// When a tax is applied, the item's full price is charged to the buyer, but
// the vender will not get the whole price paid (they get 100% - this tax).
vending_tax: 0
// Show the buyer's name when successfully vended an item
buyer_name: yes

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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++)
{

View File

@ -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]

View File

@ -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(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)
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)
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){

View File

@ -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 (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 && sc->count) {
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,11 +8239,10 @@ 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:
case AM_SPHEREMINE:
@ -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;
}

View File

@ -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++) {