diff options
author | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-13 04:25:58 +0000 |
---|---|---|
committer | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-13 04:25:58 +0000 |
commit | 67dc0c7a4ade3c375dd8fc3e721ecea00152904d (patch) | |
tree | a779254454f7e42bba9307feceb3b372357d9c58 /src/map | |
parent | 2a016f61728aedb1599b746ccc27a5773e8baf55 (diff) | |
download | hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.tar.gz hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.tar.bz2 hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.tar.xz hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.zip |
Merged jA's equipment breaking system into the current one
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1099 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/map.h | 4 | ||||
-rw-r--r-- | src/map/pc.c | 77 | ||||
-rw-r--r-- | src/map/pc.h | 7 |
3 files changed, 14 insertions, 74 deletions
diff --git a/src/map/map.h b/src/map/map.h index 7238974fd..91e296f69 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -159,8 +159,6 @@ struct map_session_data { unsigned no_weapon_damage : 1; unsigned no_gemstone : 1; unsigned infinite_endure : 1; - unsigned unbreakable_weapon : 1; - unsigned unbreakable_armor : 1; unsigned infinite_autospell : 1; } special_state; int char_id, login_id1, login_id2, sex; @@ -169,6 +167,7 @@ struct map_session_data { struct item_data *inventory_data[MAX_INVENTORY]; short equip_index[11]; unsigned short unbreakable_equip; + unsigned short unbreakable; // chance to prevent equipment breaking [celest] int weight,max_weight; int cart_weight,cart_max_weight,cart_num,cart_max_num; char mapname[24]; @@ -282,7 +281,6 @@ struct map_session_data { int magic_damage_return; // AppleGirl Was Here int random_attack_increase_add,random_attack_increase_per; // [Valaris] int perfect_hiding; // [Valaris] - int unbreakable; int classchange; // [Valaris] int die_counter; diff --git a/src/map/pc.c b/src/map/pc.c index 9134b40f6..af2297083 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -583,10 +583,11 @@ int pc_break_equip(struct map_session_data *sd, unsigned short where) int sc; char output[255]; - if(sd == NULL) - return -1; + nullpo_retr(-1, sd); if(sd->unbreakable_equip & where) return 0; + if(sd->unbreakable >= rand()%100) + return 0; switch (where) { case EQP_WEAPON: sc = SC_CP_WEAPON; @@ -603,88 +604,26 @@ int pc_break_equip(struct map_session_data *sd, unsigned short where) default: return 0; } - if( sd->sc_data && sd->sc_data[sc].timer != -1 ) + if(sd->sc_count && sd->sc_data[sc].timer != -1) return 0; for (i=0;i<MAX_INVENTORY;i++) { - if (sd->status.inventory[i].equip & where) { + if (sd->status.inventory[i].equip & where && + !sd->status.inventory[i].attribute == 1) { item=sd->inventory_data[i]; sd->status.inventory[i].attribute = 1; - pc_unequipitem(sd,i,0); - sprintf(output, "%s has broken.",item->jname); - clif_emotion(&sd->bl,23); - clif_displaymessage(sd->fd, output); - clif_equiplist(sd); - break; - } - } - - return 0; -} - -/*========================================== - * Weapon Breaking [Valaris] - *------------------------------------------ - */ -int pc_breakweapon(struct map_session_data *sd) -{ - struct item_data* item; - char output[255]; - int i; - - if(sd==NULL) - return -1; - if(sd->unbreakable>=rand()%100) - return 0; - if(sd->sc_count && sd->sc_data[SC_CP_WEAPON].timer != -1) - return 0; - - for(i=0;i<MAX_INVENTORY;i++){ - if(sd->status.inventory[i].equip && sd->status.inventory[i].equip & 0x0002 && !sd->status.inventory[i].attribute==1){ - item=sd->inventory_data[i]; - sd->status.inventory[i].attribute=1; pc_unequipitem(sd,i,3); sprintf(output, "%s has broken.",item->jname); clif_emotion(&sd->bl,23); clif_displaymessage(sd->fd, output); clif_equiplist(sd); - return 1; + break; } } - return 0; + return 1; } -/*========================================== - * Armor Breaking [Valaris] - *------------------------------------------ - */ -int pc_breakarmor(struct map_session_data *sd) -{ - struct item_data* item; - char output[255]; - int i; - if(sd==NULL) - return -1; - if(sd->unbreakable>=rand()%100) - return 0; - if(sd->sc_count && sd->sc_data[SC_CP_ARMOR].timer != -1) - return 0; - - for(i=0;i<MAX_INVENTORY;i++){ - if(sd->status.inventory[i].equip && sd->status.inventory[i].equip & 0x0010 && !sd->status.inventory[i].attribute==1){ - item=sd->inventory_data[i]; - sd->status.inventory[i].attribute=1; - pc_unequipitem(sd,i,3); - sprintf(output, "%s has broken.",item->jname); - clif_emotion(&sd->bl,23); - clif_displaymessage(sd->fd, output); - clif_equiplist(sd); - } - } - - return 0; -} /*========================================== * session idに問題無し * char鯖から送られてきたステ?タスを設定 diff --git a/src/map/pc.h b/src/map/pc.h index 8c28e299a..17fea9c13 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -40,8 +40,11 @@ int pc_authfail(int); int pc_isequip(struct map_session_data *sd,int n); int pc_equippoint(struct map_session_data *sd,int n); -int pc_breakweapon(struct map_session_data *sd); // weapon breaking [Valaris] -int pc_breakarmor(struct map_session_data *sd); // armor breaking [Valaris] +int pc_break_equip(struct map_session_data *, unsigned short); +#define pc_breakweapon(sd) (pc_break_equip(sd, EQP_WEAPON)) +#define pc_breakarmor(sd) (pc_break_equip(sd, EQP_ARMOR)) +#define pc_breakshield(sd) (pc_break_equip(sd, EQP_SHIELD)) +#define pc_breakhelm(sd) (pc_break_equip(sd, EQP_HELM)) int pc_checkskill(struct map_session_data *sd,int skill_id); int pc_checkallowskill(struct map_session_data *sd); |