summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-19 16:21:09 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-19 16:21:09 +0000
commit11e47ab6ff3d3ba751bf111d0c1948ac23dbb313 (patch)
tree4050919dd7b3d7bfe3770a556c08717f98107c24 /src
parent0dfce081c8043b95b11e617cd40ca8ce85e9b1df (diff)
downloadhercules-11e47ab6ff3d3ba751bf111d0c1948ac23dbb313.tar.gz
hercules-11e47ab6ff3d3ba751bf111d0c1948ac23dbb313.tar.bz2
hercules-11e47ab6ff3d3ba751bf111d0c1948ac23dbb313.tar.xz
hercules-11e47ab6ff3d3ba751bf111d0c1948ac23dbb313.zip
- Added the Monk combos to skill_castnodex so their delay is not decreased by skills.
- Added the actual skill delay of 1000ms to Triple Attack and Chain combo in skill_cast_db. Added Combo Finish and TigerFist as well with a delay of 700ms. - Phantasmic arrow now knockbacks even if it misses. - Adjusted the way Monk combo times work. The combo time is now always 300ms (adjusted by combo_delay_rate) which takes effect inmediately AFTER your current skill's canact-delay (which is why the particular skill delays were moved to skillcast_db) - Modified skill_delayfix so it performs the can-act reduction from agi/dex for combos there. - Modified pc_steal_item so that it behaves more closely to the way it does on Aegis. - Commented out the monster_noteleport mapflag from the guild castles as this is the Aegis behaviour git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9012 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.c45
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/skill.c103
3 files changed, 72 insertions, 78 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index a69d63e29..e615b1807 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3179,9 +3179,10 @@ int pc_show_steal(struct block_list *bl,va_list ap)
*------------------------------------------
*/
//** pc.c:
-int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
+int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
{
- int i,skill,itemid,flag;
+ static int i = 0;
+ int rate,itemid,flag;
struct status_data *sd_status, *md_status;
struct mob_data *md;
struct item tmp_item;
@@ -3193,33 +3194,43 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
md_status= status_get_status_data(bl);
md = (TBL_MOB *)bl;
- if(md->state.steal_flag>=battle_config.skill_steal_max_tries || md_status->mode&MD_BOSS || md->master_id ||
+ if(md->state.steal_flag>=battle_config.skill_steal_max_tries ||
+ md_status->mode&MD_BOSS || md->master_id ||
(md->class_>=1324 && md->class_<1364) || // prevent stealing from treasure boxes [Valaris]
map[md->bl.m].flag.nomobloot || // check noloot map flag [Lorky]
- md->sc.data[SC_STONE].timer != -1 || md->sc.data[SC_FREEZE].timer != -1 //status change check
+ md->sc.opt1 //status change check
)
return 0;
- skill = battle_config.skill_steal_type == 1
- ? (sd_status->dex - md_status->dex)/2 + pc_checkskill(sd,TF_STEAL)*6 + 10
- : sd_status->dex - md_status->dex + pc_checkskill(sd,TF_STEAL)*3 + 10;
+ rate = battle_config.skill_steal_type
+ ? (sd_status->dex - md_status->dex)/2 + lv*6 + 10
+ : sd_status->dex - md_status->dex + lv*3 + 10;
- skill+= sd->add_steal_rate; //Better make the steal_Rate addition affect % rather than an absolute on top of the total drop rate. [Skotlex]
+ rate += sd->add_steal_rate; //Better make the steal_Rate addition affect % rather than an absolute on top of the total drop rate. [Skotlex]
- if (skill < 1)
+ if (rate < 1)
return 0;
md->state.steal_flag++; //increase steal tries number
- for(i = 0; i<MAX_MOB_DROP; i++)//Pick one mobs drop slot.
- {
- itemid = md->db->dropitem[i].nameid;
- if(itemid <= 0 || (itemid>4000 && itemid<5000 && pc_checkskill(sd,TF_STEAL) <= 5))
- continue;
- if(rand() % 10000 < md->db->dropitem[i].p*skill/100)
- break;
+ //preliminar statistical data hints at this behaviour:
+ //each steal attempt: try to steal against ONE mob drop, and no more.
+ //We use a static index to prevent giving priority to any of the slots.
+ old_i = i;
+ do {
+ i++;
+ if (i == MAX_MOB_DROP-1 && lv <= 5)
+ continue; //Cannot steal "last slot" (card slot)
+ if (i == MAX_MOB_DROP)
+ i = 0;
+ } while (md->db->dropitem[i].p <= 0 && old_i != i);
+
+ if(old_i == i) {
+ md->state.steal_flag = UCHAR_MAX; //Tag for speed up in case you reinsist
+ return 0; //Mob has nothing stealable!
}
- if (i == MAX_MOB_DROP)
+
+ if(rand() % 10000 >= md->db->dropitem[i].p*rate/100)
return 0;
md->state.steal_flag = UCHAR_MAX; //you can't steal from this mob any more
diff --git a/src/map/pc.h b/src/map/pc.h
index d0928c203..a9ec1dd09 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -171,7 +171,7 @@ int pc_skill(struct map_session_data*,int,int,int);
int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
-int pc_steal_item(struct map_session_data *sd,struct block_list *bl);
+int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int skilllv);
int pc_steal_coin(struct map_session_data *sd,struct block_list *bl);
int pc_modifybuyvalue(struct map_session_data*,int);
diff --git a/src/map/skill.c b/src/map/skill.c
index 6a4993ec8..d9af46f18 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1031,7 +1031,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
if(dstmd && dstmd->state.steal_flag<battle_config.skill_steal_max_tries && sd->status.weapon != W_BOW &&
(skill=pc_checkskill(sd,RG_SNATCHER)) > 0 &&
(skill*15 + 55) + pc_checkskill(sd,TF_STEAL)*10 > rand()%1000) {
- if(pc_steal_item(sd,bl))
+ if(pc_steal_item(sd,bl,pc_checkskill(sd,TF_STEAL)))
clif_skill_nodamage(src,bl,TF_STEAL,skill,1);
else
clif_skill_fail(sd,RG_SNATCHER,0,0);
@@ -1896,7 +1896,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
type=(skillid==0)?5:skill_get_hit(skillid);
if(damage < dmg.div_
- && skillid != CH_PALMSTRIKE) //Palm Strike is the only skill that will knockback even if it misses. [Skotlex]
+ //Only skills that knockback even when they miss. [Skotlex]
+ && skillid != CH_PALMSTRIKE
+ && skillid != HT_PHANTASMIC)
dmg.blewcount = 0;
if(skillid == CR_GRANDCROSS||skillid == NPC_GRANDDARKNESS) {
@@ -1906,8 +1908,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
}
if(sd) {
- //Sorry for removing the Japanese comments, but they were actually distracting
- //from the actual code and I couldn't understand a thing anyway >.< [Skotlex]
+ int flag = 0; //Used to signal if this skill can be combo'ed later on.
if (sd->sc.data[SC_COMBO].timer!=-1)
{ //End combo state after skill is invoked. [Skotlex]
switch (skillid) {
@@ -1933,65 +1934,29 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
switch(skillid)
{
case MO_TRIPLEATTACK:
- {
- int delay = 1000 - 4*sstatus->agi - 2*sstatus->dex;
- if (pc_checkskill(sd, MO_CHAINCOMBO) > 0)
- delay += 300 * battle_config.combo_delay_rate / 100;
- sc_start(src,SC_COMBO,100,MO_TRIPLEATTACK,delay);
- clif_combo_delay(src, delay);
-
if (sd->status.party_id>0) //bonus from SG_FRIEND [Komurka]
party_skill_check(sd, sd->status.party_id, MO_TRIPLEATTACK, skilllv);
+ if (pc_checkskill(sd, MO_CHAINCOMBO) > 0)
+ flag=1;
break;
- }
case MO_CHAINCOMBO:
- {
- int delay = 1000 - 4*sstatus->agi - 2*sstatus->dex;
if(pc_checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0)
- delay += 300 * battle_config.combo_delay_rate /100;
- sc_start(src,SC_COMBO,100,MO_CHAINCOMBO,delay);
- clif_combo_delay(src,delay);
+ flag=1;
break;
- }
case MO_COMBOFINISH:
- {
- int delay = 700 - 4*sstatus->agi - 2*sstatus->dex;
- if (
- (pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 4 && sd->sc.data[SC_EXPLOSIONSPIRITS].timer != -1) ||
- (pc_checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0) ||
- (pc_checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)
- )
- delay += 300 * battle_config.combo_delay_rate /100;
- sc_start(src,SC_COMBO,100,MO_COMBOFINISH,delay);
- clif_combo_delay(src,delay);
- break;
- }
+ if (pc_checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0)
+ flag=1;
case CH_TIGERFIST:
- { //Tigerfist is now a combo-only skill. [Skotlex]
- int delay = 1000 - 4*sstatus->agi - 2*sstatus->dex;
- if(
- (pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 3 && sd->sc.data[SC_EXPLOSIONSPIRITS].timer != -1) ||
- (pc_checkskill(sd, CH_CHAINCRUSH) > 0)
- )
- delay += 300 * battle_config.combo_delay_rate /100;
- sc_start(src,SC_COMBO,100,CH_TIGERFIST,delay);
- clif_combo_delay(src,delay);
- break;
- }
+ if (!flag && pc_checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)
+ flag=1;
case CH_CHAINCRUSH:
- {
- int delay = 1000 - 4*sstatus->agi - 2*sstatus->dex;
- if(pc_checkskill(sd, MO_EXTREMITYFIST) > 0 &&
- sd->spiritball >= 1 &&
- sd->sc.data[SC_EXPLOSIONSPIRITS].timer != -1)
- delay += 300 * battle_config.combo_delay_rate /100;
- sc_start(src,SC_COMBO,100,CH_CHAINCRUSH,delay);
- clif_combo_delay(src,delay);
+ if (!flag && pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball > 0 && sd->sc.data[SC_EXPLOSIONSPIRITS].timer != -1)
+ flag=1;
break;
- }
case AC_DOUBLE:
if((tstatus->race == RC_BRUTE || tstatus->race == RC_INSECT) &&
- pc_checkskill(sd, HT_POWER)) {
+ pc_checkskill(sd, HT_POWER))
+ {
//TODO: This code was taken from Triple Blows, is this even how it should be? [Skotlex]
sc_start4(src,SC_COMBO,100,HT_POWER,bl->id,0,0,2000);
clif_combo_delay(src,2000);
@@ -2014,6 +1979,13 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
sd->ud.attackabletime = sd->canuseitem_tick = sd->ud.canact_tick;
break;
} //Switch End
+ if (flag) { //Possible to chain
+ flag = DIFF_TICK(sd->ud.canact_tick, tick);
+ if (flag < 0) flag = 0;
+ flag += 300 * battle_config.combo_delay_rate/100;
+ sc_start(src,SC_COMBO,100,skillid,flag);
+ clif_combo_delay(src, flag);
+ }
}
//Display damage.
@@ -4223,7 +4195,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case TF_STEAL:
if(sd) {
- if(pc_steal_item(sd,bl))
+ if(pc_steal_item(sd,bl,skilllv))
clif_skill_nodamage(src,bl,skillid,skilllv,1);
else
clif_skill_fail(sd,skillid,0x0a,0);
@@ -8613,7 +8585,7 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
if (bl->type&battle_config.no_skill_delay)
return battle_config.min_skill_delay_limit;
-
+
// instant cast attack skills depend on aspd as delay [celest]
if (time == 0) {
if (skill_get_type(skill_id)&(BF_WEAPON|BF_MISC) && !(skill_get_nk(skill_id)&NK_NO_DAMAGE))
@@ -8623,13 +8595,24 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
} else if (time < 0)
time = -time + status_get_amotion(bl); // if set to <0, the attack motion is added.
else //Agi reduction should apply only to non-zero delay skills.
- if (battle_config.delay_dependon_agi && !(delaynochange&1))
- { // if skill casttime is allowed to be reduced by dex
- int scale = battle_config.castrate_dex_scale - status_get_agi(bl);
- if (scale > 0)
- time = time * scale / battle_config.castrate_dex_scale;
- else //To be capped later to minimum.
- time = 0;
+ switch (skill_id)
+ { //Monk combo skills have their delay reduced by agi/dex.
+ case MO_TRIPLEATTACK:
+ case MO_CHAINCOMBO:
+ case MO_COMBOFINISH:
+ case CH_TIGERFIST:
+ case CH_CHAINCRUSH:
+ time -= 4*status_get_agi(bl) - 2*status_get_dex(bl);
+ break;
+ default:
+ if (battle_config.delay_dependon_agi && !(delaynochange&1))
+ { // if skill casttime is allowed to be reduced by dex
+ int scale = battle_config.castrate_dex_scale - status_get_agi(bl);
+ if (scale > 0)
+ time = time * scale / battle_config.castrate_dex_scale;
+ else //To be capped later to minimum.
+ time = 0;
+ }
}
if (bl->type == BL_PC && ((TBL_PC*)bl)->delayrate != 100)