diff options
author | malufett <malufett.eat.my.binaries@gmail.com> | 2013-01-17 22:23:33 +0800 |
---|---|---|
committer | malufett <malufett.eat.my.binaries@gmail.com> | 2013-01-17 22:23:33 +0800 |
commit | 2bf913eebcc0a18057c9012be187585a7afb2f72 (patch) | |
tree | c6331085709e12e4fe58a915b05ed648924b4759 /src | |
parent | 541c5f69913da208356ef68f556d3cb888d01911 (diff) | |
parent | 32ea0d89b449710473aab78d83840d22fccfd5b4 (diff) | |
download | hercules-2bf913eebcc0a18057c9012be187585a7afb2f72.tar.gz hercules-2bf913eebcc0a18057c9012be187585a7afb2f72.tar.bz2 hercules-2bf913eebcc0a18057c9012be187585a7afb2f72.tar.xz hercules-2bf913eebcc0a18057c9012be187585a7afb2f72.zip |
Merge remote-tracking branch 'origin/rathena'
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 9 | ||||
-rw-r--r-- | src/map/battle.c | 34 | ||||
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 7 | ||||
-rw-r--r-- | src/map/skill.c | 67 | ||||
-rw-r--r-- | src/map/status.c | 25 |
6 files changed, 95 insertions, 49 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index c6292a7a9..2a18b7d2f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8585,7 +8585,7 @@ ACMD_FUNC(accinfo) { ACMD_FUNC(set) { char reg[32], val[128]; struct script_data* data; - int toset = 0; + int toset = 0, len; bool is_str = false; if( !message || !*message || (toset = sscanf(message, "%32s %128[^\n]s", reg, val)) < 1 ) { @@ -8607,6 +8607,13 @@ ACMD_FUNC(set) { is_str = ( reg[strlen(reg) - 1] == '$' ) ? true : false; + if( ( len = strlen(val) ) > 1 ) { + if( val[0] == '"' && val[len-1] == '"') { + val[len-1] = '\0'; //Strip quotes. + memmove(val, val+1, len-1); + } + } + if( toset >= 2 ) {/* we only set the var if there is an val, otherwise we only output the value */ if( is_str ) set_var(sd, reg, (void*) val); diff --git a/src/map/battle.c b/src/map/battle.c index 7b6bf5869..0959ea858 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1857,19 +1857,35 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo wd.div_ = skill_get_num(GS_CHAINACTION,skill_lv); wd.type = 0x08; } - else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW && (i = sd->equip_index[EQI_AMMO]) >= 0 && sd->inventory_data[i] && sd->status.inventory[i].amount > 1){ - short rate[] = { 4, 4, 7, 9, 10 }; - if(sc->data[SC_FEARBREEZE]->val1 > 0 && sc->data[SC_FEARBREEZE]->val1 < 6 && rand()%100 < rate[sc->data[SC_FEARBREEZE]->val1-1]) { + else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW + && (i = sd->equip_index[EQI_AMMO]) >= 0 && sd->inventory_data[i] && sd->status.inventory[i].amount > 1){ + int chance = rand()%100; wd.type = 0x08; - wd.div_ = 2; - if(sc->data[SC_FEARBREEZE]->val1 > 2){ - int chance = rand()%100; - wd.div_ += (chance >= 40) + (chance >= 70) + (chance >= 90); - wd.div_ = min(wd.div_,sc->data[SC_FEARBREEZE]->val1); + switch(sc->data[SC_FEARBREEZE]->val1){ + case 5: + if( chance < 3){// 3 % chance to attack 5 times. + wd.div_ = 5; + break; + } + case 4: + if( chance < 7){// 6 % chance to attack 4 times. + wd.div_ = 4; + break; + } + case 3: + if( chance < 10){// 9 % chance to attack 3 times. + wd.div_ = 3; + break; + } + case 2: + case 1: + if( chance < 13){// 12 % chance to attack 2 times. + wd.div_ = 2; + break; + } } wd.div_ = min(wd.div_,sd->status.inventory[i].amount); sc->data[SC_FEARBREEZE]->val4 = wd.div_-1; - } } } diff --git a/src/map/clif.c b/src/map/clif.c index a47a98891..31c3cc53c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11057,7 +11057,7 @@ void clif_parse_Cooking(int fd,struct map_session_data *sd) { return; } if( skill_can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) - skill_produce_mix(sd,0,nameid,0,0,0,amount); + skill_produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); clif_menuskill_clear(sd); } diff --git a/src/map/script.c b/src/map/script.c index a918bc853..4099820f1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7414,7 +7414,7 @@ BUILDIN_FUNC(getequipname) i = pc_checkequip(sd,equip[num]); if( i < 0 ) { - script_pushint(st,-1); + script_pushconststr(st,""); return 0; } @@ -12911,6 +12911,11 @@ BUILDIN_FUNC(npcwalkto) y=script_getnum(st,3); if(nd) { + if (!nd->status.hp) { + status_calc_npc(nd, true); + } else { + status_calc_npc(nd, false); + } unit_walktoxy(&nd->bl,x,y,0); } diff --git a/src/map/skill.c b/src/map/skill.c index 8c21b7eba..8718c3b58 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -988,7 +988,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case AM_ACIDTERROR: - sc_start(bl,SC_BLEEDING,(skill_lv*3),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start2(bl,SC_BLEEDING,(skill_lv*3),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); if (skill_break_equip(bl, EQP_ARMOR, 100*skill_get_time(skill_id,skill_lv), BCT_ENEMY)) clif_emotion(bl,E_OMG); break; @@ -1060,7 +1060,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint sc_start(bl,status_skill2sc(skill_id),70,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NPC_BLEEDING: - sc_start(bl,SC_BLEEDING,(20*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start2(bl,SC_BLEEDING,(20*skill_lv),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); break; case NPC_MENTALBREAKER: { //Based on observations by Tharis, Mental Breaker should do SP damage @@ -1106,13 +1106,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint case LK_HEADCRUSH: //Headcrush has chance of causing Bleeding status, except on demon and undead element if (!(battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON)) - sc_start(bl, SC_BLEEDING,50, skill_lv, skill_get_time2(skill_id,skill_lv)); + sc_start2(bl, SC_BLEEDING,50, skill_lv, src->id, skill_get_time2(skill_id,skill_lv)); break; case LK_JOINTBEAT: status = status_skill2sc(skill_id); if (tsc->jb_flag) { - sc_start2(bl,status,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,skill_get_time2(skill_id,skill_lv)); + sc_start4(bl,status,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,src->id,0,skill_get_time2(skill_id,skill_lv)); tsc->jb_flag = 0; } break; @@ -1126,7 +1126,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint sc_start(bl,SC_STUN,(5+skill_lv*5),skill_lv,skill_get_time2(skill_id,2)); break; default: - sc_start(bl,SC_BLEEDING,(5+skill_lv*5),skill_lv,skill_get_time2(skill_id,3)); + sc_start2(bl,SC_BLEEDING,(5+skill_lv*5),skill_lv,src->id,skill_get_time2(skill_id,3)); } break; @@ -1167,7 +1167,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint status_change_start(bl,SC_COMA,10,skill_lv,0,src->id,0,0,0); break; case GS_PIERCINGSHOT: - sc_start(bl,SC_BLEEDING,(skill_lv*3),skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start2(bl,SC_BLEEDING,(skill_lv*3),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); break; case NJ_HYOUSYOURAKU: sc_start(bl,SC_FREEZE,(10+10*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); @@ -1271,7 +1271,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint rate = 30 + (((5 * (sd?pc_checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + status_get_lv(src))) / 10); switch( skill_lv ) { case 1: - sc_start(bl,SC_BLEEDING,rate,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start2(bl,SC_BLEEDING,rate,skill_lv,src->id,skill_get_time(skill_id,skill_lv)); break; case 2: if( dstsd && dstsd->spiritball && rnd()%100 < rate ) @@ -1351,7 +1351,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint } break; case SO_EARTHGRAVE: - sc_start(bl, SC_BLEEDING, 5 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); // Need official rate. [LimitLine] + sc_start2(bl, SC_BLEEDING, 5 * skill_lv, skill_lv, src->id, skill_get_time2(skill_id, skill_lv)); // Need official rate. [LimitLine] break; case SO_DIAMONDDUST: rate = 5 + 5 * skill_lv; @@ -1367,7 +1367,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint switch( sd->itemid ) { // Starting SCs here instead of do it in skill_additional_effect to simplify the code. case 13261: sc_start(bl, SC_STUN, 100, skill_lv, skill_get_time2(GN_SLINGITEM, skill_lv)); - sc_start(bl, SC_BLEEDING, 100, skill_lv, skill_get_time2(GN_SLINGITEM, skill_lv)); + sc_start2(bl, SC_BLEEDING, 100, skill_lv, src->id, skill_get_time2(GN_SLINGITEM, skill_lv)); break; case 13262: sc_start(bl, SC_MELON_BOMB, 100, skill_lv, skill_get_time(GN_SLINGITEM, skill_lv)); // Reduces ASPD and moviment speed @@ -1382,10 +1382,10 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint break; case GN_HELLS_PLANT_ATK: sc_start(bl, SC_STUN, 5 + 5 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); - sc_start(bl, SC_BLEEDING, 20 + 10 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); + sc_start2(bl, SC_BLEEDING, 20 + 10 * skill_lv, skill_lv, src->id,skill_get_time2(skill_id, skill_lv)); break; case EL_WIND_SLASH: // Non confirmed rate. - sc_start(bl, SC_BLEEDING, 25, skill_lv, skill_get_time(skill_id,skill_lv)); + sc_start2(bl, SC_BLEEDING, 25, skill_lv, src->id, skill_get_time(skill_id,skill_lv)); break; case EL_STONE_HAMMER: rate = 10 * skill_lv; @@ -3239,7 +3239,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { i = applyeffects[rnd()%j]; status_change_start(target, i, 10000, skl->skill_lv, - (i == SC_BURNING ? 1000 : 0), + (i == SC_BURNING ? 1000 : (i == SC_BLEEDING ? src->id : 0)), (i == SC_BURNING ? src->id : 0), 0, skill_get_time(WL_TETRAVORTEX,skl->skill_lv), 0); } @@ -4496,11 +4496,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } break; - case WM_LULLABY_DEEPSLEEP: - if( bl != src && rnd()%100 < 88 + 2 * skill_lv ) - sc_start(bl,status_skill2sc(skill_id),100,skill_lv,skill_get_time(skill_id,skill_lv)); - break; - case SO_POISON_BUSTER: { struct status_change *tsc = status_get_sc(bl); if( tsc && tsc->data[SC_POISON] ) { @@ -7393,7 +7388,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui const enum sc_type sc[] = { SC_STUN, SC_SILENCE, SC_CONFUSION, SC_BLEEDING }; int j; j = i = rnd()%ARRAYLENGTH(sc); - while ( !sc_start(bl,sc[i],100,skill_lv,skill_get_time2(skill_id,i+1)) ) { + while ( !sc_start2(bl,sc[i],100,skill_lv,src->id,skill_get_time2(skill_id,i+1)) ) { i++; if ( i == ARRAYLENGTH(sc) ) i = 0; @@ -7413,7 +7408,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NPC_SLOWCAST: case NPC_WIDEHELLDIGNITY: if (flag&1) - sc_start(bl,type,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start2(bl,type,100,skill_lv,src->id,skill_get_time2(skill_id,skill_lv)); else { skill_area_temp[2] = 0; //For SD_PREAMBLE clif_skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -8592,12 +8587,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SO_ARRULLO: - if( flag&1 ) - sc_start2(bl, type, 88 + 2 * skill_lv, skill_lv, 1, skill_get_time(skill_id, skill_lv)); - else { - clif_skill_nodamage(src, bl, skill_id, 0, 1); + { + // [(15 + 5 * Skill Level) + ( Caster’s INT / 5 ) + ( Caster’s Job Level / 5 ) - ( Target’s INT / 6 ) - ( Target’s LUK / 10 )] % + int rate = (15 + 5 * skill_lv) + status_get_int(src)/5 + (sd)?sd->status.job_level:0; + rate -= status_get_int(bl)/6 - status_get_luk(bl)/10; + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); + sc_start2(bl, type, rate, skill_lv, 1, skill_get_time(skill_id, skill_lv)); + } + break; + + case WM_LULLABY_DEEPSLEEP: + if( flag&1 ){ + //[(Skill Level x 4) + (Voice Lessons Skill Level x 2) + (Caster’s Base Level / 15) + (Caster’s Job Level / 5)] % + int rate = (4 * skill_lv) + ( (sd) ? pc_checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + status_get_lv(src) / 15; + if( bl != src ) + sc_start(bl,type,rate,skill_lv,skill_get_time(skill_id,skill_lv)); + }else { + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, - src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill_castend_nodamage_id); } break; @@ -9821,6 +9829,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui (skill_lv >= 4) ? sd->status.memo_point[2].map : 0 ); } + if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] ) //Should only remove after the skill has been casted. + status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER); return 0; // not to consume item. case MO_BODYRELOCATION: @@ -10008,10 +10018,15 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case NC_COLDSLOWER: case NC_ARMSCANNON: case RK_DRAGONBREATH: - case WM_LULLABY_DEEPSLEEP: i = skill_get_splash(skill_id,skill_lv); map_foreachinarea(skill_area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), - src,skill_id,skill_lv,tick,flag|(skill_id==WM_LULLABY_DEEPSLEEP?BCT_ALL:BCT_ENEMY)|1,skill_castend_damage_id); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + break; + + case SO_ARRULLO: + i = skill_get_splash(skill_id,skill_lv); + map_foreachinarea(skill_area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); break; /** * Guilotine Cross diff --git a/src/map/status.c b/src/map/status.c index 649cfa1ae..8a173f611 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2995,6 +2995,10 @@ int status_calc_pc_(struct map_session_data* sd, bool first) sd->subele[ELE_NEUTRAL] += skill; sd->subele[ELE_FIRE] += skill*4; } + if((skill=pc_checkskill(sd,NC_RESEARCHFE))>0) { + sd->subele[ELE_EARTH] += skill*10; + sd->subele[ELE_FIRE] += skill*10; + } if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ skill = skill*4; sd->right_weapon.addrace[RC_DRAGON]+=skill; @@ -3246,7 +3250,7 @@ int status_calc_npc_(struct npc_data *nd, bool first) { status->race = RC_DEMIHUMAN; status->size = nd->size; status->rhw.range = 1 + status->size; - status->mode = MD_CANMOVE|MD_CANATTACK; + status->mode = (MD_CANMOVE|MD_CANATTACK); status->speed = nd->speed; } @@ -3700,7 +3704,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) else status->def2 = status_calc_def2(bl, sc, b_status->def2 #ifdef RENEWAL - + (int)( ((float)status->vit/2 + (float)b_status->vit/2) + ((float)status->agi/5 + (float)b_status->agi/5) ) + + (int)( ((float)status->vit/2 - (float)b_status->vit/2) + ((float)status->agi/5 - (float)b_status->agi/5) ) #else + (status->vit - b_status->vit) #endif @@ -3725,7 +3729,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) else status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2 +(status->int_ - b_status->int_) #ifdef RENEWAL - + (int)( ((float)status->dex/5 - (float)b_status->dex/5) + ((float)status->vit/5 + (float)b_status->vit/5) ) + + (int)( ((float)status->dex/5 - (float)b_status->dex/5) + ((float)status->vit/5 - (float)b_status->vit/5) ) #else + ((status->vit - b_status->vit)>>1) #endif @@ -4978,8 +4982,6 @@ static signed short status_calc_def2(struct block_list *bl, struct status_change def2 -= def2 * ( 14 * sc->data[SC_ANALYZE]->val1 ) / 100; if( sc->data[SC_ECHOSONG] ) def2 += def2 * sc->data[SC_ECHOSONG]->val2/100; - if( sc->data[SC_GT_REVITALIZE] && sc->data[SC_GT_REVITALIZE]->val4) - def2 += def2 * sc->data[SC_GT_REVITALIZE]->val4 / 100; if(sc->data[SC_ASH] && (bl->type==BL_MOB)){ if(status_get_race(bl)==RC_PLANT) def2 /= 2; @@ -5791,7 +5793,7 @@ struct status_data *status_get_status_data(struct block_list *bl) case BL_HOM: return &((TBL_HOM*)bl)->battle_status; case BL_MER: return &((TBL_MER*)bl)->battle_status; case BL_ELEM: return &((TBL_ELEM*)bl)->battle_status; - case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : &dummy_status); + case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : &dummy_status); default: return &dummy_status; } @@ -5807,7 +5809,7 @@ struct status_data *status_get_base_status(struct block_list *bl) case BL_HOM: return &((TBL_HOM*)bl)->base_status; case BL_MER: return &((TBL_MER*)bl)->base_status; case BL_ELEM: return &((TBL_ELEM*)bl)->base_status; - case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : NULL); + case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : NULL); default: return NULL; } @@ -5825,8 +5827,8 @@ defType status_get_def(struct block_list *bl) { unsigned short status_get_speed(struct block_list *bl) { - if(bl->type==BL_NPC)//Only BL with speed data but no status_data [Skotlex] - return ((struct npc_data *)bl)->speed; + if(bl->type==BL_NPC)//Only BL with speed data but no status_data [Skotlex] + return ((struct npc_data *)bl)->speed; return status_get_status_data(bl)->speed; } @@ -7587,7 +7589,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_JOINTBEAT: if( val2&BREAK_NECK ) - sc_start(bl,SC_BLEEDING,100,val1,skill_get_time2(status_sc2skill(type),val1)); + sc_start2(bl,SC_BLEEDING,100,val1,val3,skill_get_time2(status_sc2skill(type),val1)); break; case SC_BERSERK: @@ -9948,8 +9950,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) case SC_BLEEDING: if (--(sce->val4) >= 0) { int hp = rnd()%600 + 200; + struct block_list* src = map_id2bl(sce->val2); map_freeblock_lock(); - status_fix_damage(NULL, bl, sd||hp<status->hp?hp:status->hp-1, 1); + status_fix_damage(src, bl, sd||hp<status->hp?hp:status->hp-1, 1); if( sc->data[type] ) { if( status->hp == 1 ) { map_freeblock_unlock(); |