summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-02-14 01:20:42 -0200
committershennetsind <ind@henn.et>2014-02-14 01:20:42 -0200
commitdf611eb4055fb8478be277243d0734af66173d99 (patch)
treed9679e1e9e174af8c4157e316e77adff5a752952 /src/map/status.c
parent6f264513874c80b912f47dbad1ec0347c67534e7 (diff)
downloadhercules-df611eb4055fb8478be277243d0734af66173d99.tar.gz
hercules-df611eb4055fb8478be277243d0734af66173d99.tar.bz2
hercules-df611eb4055fb8478be277243d0734af66173d99.tar.xz
hercules-df611eb4055fb8478be277243d0734af66173d99.zip
sc sources
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c108
1 files changed, 53 insertions, 55 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 65d982829..12ab870f8 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1236,7 +1236,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
if (sc->data[SC_AUTOBERSERK] &&
(!sc->data[SC_PROVOKE] || !sc->data[SC_PROVOKE]->val2) &&
st->hp < st->max_hp>>2)
- sc_start4(target,SC_PROVOKE,100,10,1,0,0,0);
+ sc_start4(src,target,SC_PROVOKE,100,10,1,0,0,0);
if (sc->data[SC_BERSERK] && st->hp <= 100)
status_change_end(target, SC_BERSERK, INVALID_TIMER);
if( sc->data[SC_RAISINGDRAGON] && st->hp <= 1000 )
@@ -1312,7 +1312,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
status->revive(target, sc->data[SC_KAIZEL]->val2, 0);
status->change_clear(target,0);
clif->skill_nodamage(target,target,ALL_RESURRECTION,1,1);
- sc_start(target,status->skill2sc(PR_KYRIE),100,10,time);
+ sc_start(target,target,status->skill2sc(PR_KYRIE),100,10,time);
if( target->type == BL_MOB )
((TBL_MOB*)target)->state.rebirth = 1;
@@ -6261,10 +6261,7 @@ void status_change_init(struct block_list *bl) {
//Applies SC defense to a given status change.
//Returns the adjusted duration based on flag values.
//the flag values are the same as in status->change_start.
-int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int tick, int flag) {
- //Temporary to simulate the source block_list [Playtester]
- struct block_list *src = bl; // FIXME: This should be passed to the function as argument
-
+int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag) {
//Percentual resistance: 10000 = 100% Resist
//Example: 50% -> sc_def=5000 -> 25%; 5000ms -> tick_def=5000 -> 2500ms
int sc_def = 0, tick_def = -1; //-1 = use sc_def
@@ -6277,6 +6274,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti
struct map_session_data *sd;
nullpo_ret(bl);
+
if(!src)
return tick ? tick : 1; // If no source, it can't be resisted (NPC given)
@@ -6728,7 +6726,7 @@ void status_display_remove(struct map_session_data *sd, enum sc_type type) {
* &4: sc_data loaded, no value has to be altered.
* &8: rate should not be reduced
*------------------------------------------*/
-int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,int tick,int flag) {
+int status_change_start(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int flag) {
struct map_session_data *sd = NULL;
struct status_change* sc;
struct status_change_entry* sce;
@@ -6831,7 +6829,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//Adjust tick according to status resistances
if( !(flag&(1|4)) ) {
- tick = status->get_sc_def(bl, type, rate, tick, flag);
+ tick = status->get_sc_def(src, bl, type, rate, tick, flag);
if( !tick ) return 0;
}
@@ -7528,7 +7526,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if(!(flag&4)) { //&4 - Do not parse val settings when loading SCs
switch(type) {
case SC_ADORAMUS:
- sc_start(bl,SC_BLIND,100,val1,skill->get_time(status->sc2skill(type),val1));
+ sc_start(src,bl,SC_BLIND,100,val1,skill->get_time(status->sc2skill(type),val1));
// Fall through to SC_INC_AGI
case SC_DEC_AGI:
case SC_INC_AGI:
@@ -7542,10 +7540,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int i;
for( i = 0; i < 5; i++ ) {
if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
- status->change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1);
+ status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1);
}
} else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
- status->change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1);
+ status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1);
}
//val4 signals infinite endure (if val4 == 2 it is infinite endure from Berserk)
if( val4 )
@@ -7554,7 +7552,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_AUTOBERSERK:
if (st->hp < st->max_hp>>2 &&
(!sc->data[SC_PROVOKE] || sc->data[SC_PROVOKE]->val2==0))
- sc_start4(bl,SC_PROVOKE,100,10,1,0,0,60000);
+ sc_start4(src,bl,SC_PROVOKE,100,10,1,0,0,60000);
tick = -1;
break;
case SC_CRUCIS:
@@ -7639,10 +7637,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int i;
for( i = 0; i < 5; i++ ) {
if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
- status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
+ status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
} else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
- status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
+ status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
break;
case SC_NOEQUIPWEAPON:
@@ -7778,9 +7776,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if (st->hp - diff < st->max_hp>>2)
diff = st->hp - (st->max_hp>>2);
if( val2 && bl->type == BL_MOB ) {
- struct block_list* src = map->id2bl(val2);
- if( src )
- mob->log_damage((TBL_MOB*)bl,src,diff);
+ struct block_list* src2 = map->id2bl(val2);
+ if( src2 )
+ mob->log_damage((TBL_MOB*)bl,src2,diff);
}
status_zap(bl, diff, 0);
}
@@ -7895,11 +7893,11 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( sd ) {
for( i = 0; i < 5; i++ ) {
if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
- status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
+ status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
}
else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
- status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
+ status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
}
break;
@@ -7916,7 +7914,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
for (i = 0; i < 5; i++) {
//See if there are devoted characters, and pass the status to them. [Skotlex]
if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])))
- status->change_start(&tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1);
+ status->change_start(bl, &tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1);
}
}
}
@@ -7943,14 +7941,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_JOINTBEAT:
if( val2&BREAK_NECK )
- sc_start2(bl,SC_BLOODING,100,val1,val3,skill->get_time2(status->sc2skill(type),val1));
+ sc_start2(src,bl,SC_BLOODING,100,val1,val3,skill->get_time2(status->sc2skill(type),val1));
break;
case SC_BERSERK:
if( val3 == SC__BLOODYLUST )
- sc_start(bl,(sc_type)val3,100,val1,tick);
+ sc_start(src,bl,(sc_type)val3,100,val1,tick);
if( !val3 && !(!sc->data[SC_ENDURE] || !sc->data[SC_ENDURE]->val4) )
- sc_start4(bl, SC_ENDURE, 100,10,0,0,2, tick);
+ sc_start4(src, bl, SC_ENDURE, 100,10,0,0,2, tick);
//HP healing is performing after the calc_status call.
//Val2 holds HP penalty
if (!val4) val4 = skill->get_time2(status->sc2skill(type),val1);
@@ -8043,7 +8041,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
while( i >= 0 ) {
type2 = types[i];
if( d_sc->data[type2] )
- sc_start(bl, type2, 100, d_sc->data[type2]->val1, skill->get_time(status->sc2skill(type2),d_sc->data[type2]->val1));
+ sc_start(bl, bl, type2, 100, d_sc->data[type2]->val1, skill->get_time(status->sc2skill(type2),d_sc->data[type2]->val1));
i--;
}
}
@@ -8052,25 +8050,25 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_COMA: //Coma. Sends a char to 1HP. If val2, do not zap sp
if( val3 && bl->type == BL_MOB ) {
- struct block_list* src = map->id2bl(val3);
- if( src )
- mob->log_damage((TBL_MOB*)bl,src,st->hp - 1);
+ struct block_list* src2 = map->id2bl(val3);
+ if( src2 )
+ mob->log_damage((TBL_MOB*)bl,src2,st->hp - 1);
}
status_zap(bl, st->hp-1, val2 ? 0 : st->sp);
return 1;
break;
case SC_RG_CCONFINE_S:
{
- struct block_list *src = val2 ? map->id2bl(val2) : NULL;
- struct status_change *sc2 = src ? status->get_sc(src) : NULL;
+ struct block_list *src2 = val2 ? map->id2bl(val2) : NULL;
+ struct status_change *sc2 = src ? status->get_sc(src2) : NULL;
struct status_change_entry *sce2 = sc2 ? sc2->data[SC_RG_CCONFINE_M] : NULL;
- if (src && sc2) {
+ if (src2 && sc2) {
if (!sce2) //Start lock on caster.
- sc_start4(src,SC_RG_CCONFINE_M,100,val1,1,0,0,tick+1000);
+ sc_start4(src,src2,SC_RG_CCONFINE_M,100,val1,1,0,0,tick+1000);
else { //Increase count of locked enemies and refresh time.
(sce2->val2)++;
timer->delete(sce2->timer, status->change_timer);
- sce2->timer = timer->add(timer->gettick()+tick+1000, status->change_timer, src->id, SC_RG_CCONFINE_M);
+ sce2->timer = timer->add(timer->gettick()+tick+1000, status->change_timer, src2->id, SC_RG_CCONFINE_M);
}
} else //Status failed.
return 0;
@@ -8168,7 +8166,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = 5*val1; //Batk/Watk Increase
val3 = 10*val1; //Hit Increase
val4 = 5*val1; //Def reduction
- sc_start(bl, SC_ENDURE, 100, 1, tick); //Endure effect
+ sc_start(src, bl, SC_ENDURE, 100, 1, tick); //Endure effect
break;
case SC_ANGELUS:
val2 = 5*val1; //def increase
@@ -8429,7 +8427,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick_time = 4000; // [GodLesZ] tick time
break;
case SC_PYREXIA:
- status->change_start(bl,SC_BLIND,10000,val1,0,0,0,30000,11); // Blind status that last for 30 seconds
+ status->change_start(src, bl,SC_BLIND,10000,val1,0,0,0,30000,11); // Blind status that last for 30 seconds
val4 = tick / 3000;
tick_time = 3000; // [GodLesZ] tick time
break;
@@ -8567,8 +8565,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC__WEAKNESS:
val2 = 10 * val1;
// bypasses coating protection and MADO
- sc_start(bl,SC_NOEQUIPWEAPON,100,val1,tick);
- sc_start(bl,SC_NOEQUIPSHIELD,100,val1,tick);
+ sc_start(src, bl,SC_NOEQUIPWEAPON,100,val1,tick);
+ sc_start(src, bl,SC_NOEQUIPSHIELD,100,val1,tick);
break;
case SC_GN_CARTBOOST:
if( val1 < 3 )
@@ -8593,10 +8591,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
break;
case SC_BLOOD_SUCKER:
{
- struct block_list *src = map->id2bl(val2);
+ struct block_list *src2 = map->id2bl(val2);
val3 = 1;
- if(src)
- val3 = 200 + 100 * val1 + status_get_int(src);
+ if(src2)
+ val3 = 200 + 100 * val1 + status_get_int(src2);
val4 = tick / 1000;
tick_time = 1000; // [GodLesZ] tick time
}
@@ -8742,20 +8740,20 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
break;
case SC_GENTLETOUCH_CHANGE:
{// take note there is no def increase as skill desc says. [malufett]
- struct block_list * src;
+ struct block_list * src2;
val3 = st->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] %
- if( (src = map->id2bl(val2)) ){
- val4 = ( 200/status_get_int(src) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level]
- val2 = ( status_get_dex(src)/4 + status_get_str(src)/2 ) * val1 / 5; // ATK increase: ATK [{(Caster DEX / 4) + (Caster STR / 2)} x Skill Level / 5]
+ if( (src2 = map->id2bl(val2)) ){
+ val4 = ( 200/status_get_int(src2) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level]
+ val2 = ( status_get_dex(src2)/4 + status_get_str(src2)/2 ) * val1 / 5; // ATK increase: ATK [{(Caster DEX / 4) + (Caster STR / 2)} x Skill Level / 5]
}
}
break;
case SC_GENTLETOUCH_REVITALIZE:
{// take note there is no vit,aspd,speed increase as skill desc says. [malufett]
- struct block_list * src;
+ struct block_list * src2;
val3 = val1 * 30 + 150; // Natural HP recovery increase: [(Skill Level x 30) + 50] %
- if( (src = map->id2bl(val2)) ) // the stat def is not shown in the status window and it is process differently
- val4 = ( status_get_vit(src)/4 ) * val1; // STAT DEF increase: [(Caster VIT / 4) x Skill Level]
+ if( (src2 = map->id2bl(val2)) ) // the stat def is not shown in the status window and it is process differently
+ val4 = ( status_get_vit(src2)/4 ) * val1; // STAT DEF increase: [(Caster VIT / 4) x Skill Level]
}
break;
case SC_PYROTECHNIC_OPTION:
@@ -8930,7 +8928,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = 2*val1; //aspd reduction %
val3 = 2*val1; //dmg reduction %
if(sc->data[SC_NEEDLE_OF_PARALYZE])
- sc_start(bl, SC_ENDURE, 100, val1, tick); //start endure for same duration
+ sc_start(src, bl, SC_ENDURE, 100, val1, tick); //start endure for same duration
break;
case SC_STYLE_CHANGE: //[Lighta] need real info
tick = -1;
@@ -9684,7 +9682,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
&& DIFF_TICK(timer->gettick(), starttick) <= 1000
&& (!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0))
)
- sc_start(bl,SC_STRUP,100,sce->val1,skill->get_time2(status->sc2skill(type), sce->val1));
+ sc_start(bl, bl,SC_STRUP,100,sce->val1,skill->get_time2(status->sc2skill(type), sce->val1));
}
break;
case SC_AUTOBERSERK:
@@ -9888,9 +9886,9 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
sc->data[SC_ENDURE]->val4 = 0;
status_change_end(bl, SC_ENDURE, INVALID_TIMER);
}
- sc_start4(bl, SC_GDSKILL_REGENERATION, 100, 10,0,0,(RGN_HP|RGN_SP), skill->get_time(LK_BERSERK, sce->val1));
+ sc_start4(bl, bl, SC_GDSKILL_REGENERATION, 100, 10,0,0,(RGN_HP|RGN_SP), skill->get_time(LK_BERSERK, sce->val1));
if( type == SC_SATURDAY_NIGHT_FEVER ) //Sit down force of Saturday Night Fever has the duration of only 3 seconds.
- sc_start(bl,SC_SITDOWN_FORCE,100,sce->val1,skill->get_time2(WM_SATURDAY_NIGHT_FEVER,sce->val1));
+ sc_start(bl,bl,SC_SITDOWN_FORCE,100,sce->val1,skill->get_time2(WM_SATURDAY_NIGHT_FEVER,sce->val1));
break;
case SC_GOSPEL:
if (sce->val3) { //Clear the group.
@@ -9966,7 +9964,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
clif->millenniumshield(bl,0);
break;
case SC_HALLUCINATIONWALK:
- sc_start(bl,SC_HALLUCINATIONWALK_POSTDELAY,100,sce->val1,skill->get_time2(GC_HALLUCINATIONWALK,sce->val1));
+ sc_start(bl,bl,SC_HALLUCINATIONWALK_POSTDELAY,100,sce->val1,skill->get_time2(GC_HALLUCINATIONWALK,sce->val1));
break;
case SC_WHITEIMPRISON:
{
@@ -10062,7 +10060,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
calc_flag = SCB_ALL;/* required for overlapping */
break;
case SC_FULL_THROTTLE:
- sc_start(bl,SC_REBOUND,100,sce->val1,skill->get_time2(ALL_FULL_THROTTLE,sce->val1));
+ sc_start(bl,bl,SC_REBOUND,100,sce->val1,skill->get_time2(ALL_FULL_THROTTLE,sce->val1));
break;
case SC_MONSTER_TRANSFORM:
if( sce->val2 )
@@ -10389,7 +10387,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
break; //Not enough SP to continue.
if (!sc->data[SC_CHASEWALK2]) {
- sc_start(bl, SC_CHASEWALK2,100,1<<(sce->val1-1),
+ sc_start(bl,bl, SC_CHASEWALK2,100,1<<(sce->val1-1),
(sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_ROGUE?10:1) //SL bonus -> x10 duration
* skill->get_time2(status->sc2skill(type),sce->val1));
}
@@ -11502,7 +11500,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) {
data.val2 = sc->data[i]->val2;
data.val3 = sc->data[i]->val3;
data.val4 = sc->data[i]->val4;
- status->change_start(bl,(sc_type)i,10000,data.val1,data.val2,data.val3,data.val4,data.tick,1|2|8);
+ status->change_start(src,bl,(sc_type)i,10000,data.val1,data.val2,data.val3,data.val4,data.tick,1|2|8);
flag = 1;
}
}
@@ -11675,7 +11673,7 @@ int status_natural_heal(struct block_list* bl, va_list args) {
val*=2;
sd->state.doridori = 0;
if ((rate = pc->checkskill(sd,TK_SPTIME)))
- sc_start(bl,status->skill2sc(TK_SPTIME),
+ sc_start(bl,bl,status->skill2sc(TK_SPTIME),
100,rate,skill->get_time(TK_SPTIME, rate));
if ((sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR
&&rnd()%10000 < battle_config.sg_angel_skill_ratio