瀏覽代碼

Hercules merges.
- If a player has both a Cart and Magic Gear, removing them will now first remove the Magic Gear first (instead of both simultaneously). (2f9a514)
- Added overflow check to 'itemheal'; documentation updated. (1849d35)

Signed-off-by: Euphy <euphy.raliel@rathena.org>

Euphy 11 年之前
父節點
當前提交
8c133f139b
共有 3 個文件被更改,包括 25 次插入19 次删除
  1. 10 8
      doc/script_commands.txt
  2. 6 6
      src/map/clif.c
  3. 9 5
      src/map/pc.c

+ 10 - 8
doc/script_commands.txt

@@ -3841,16 +3841,18 @@ character and produces no other output whatsoever.
 
 *itemheal <hp>,<sp>;
 
-This command heals given absolute amounts of HP and/or SP on the invoking
-character. Unlike heal, this command is intended for use in item scripts. It
-applies potion-related bonuses, such as alchemist ranking, cards and status
-changes. When used inside an NPC script, certain bonuses are omitted.
+This command heals relative amounts of HP and/or SP on the invoking character.
+Unlike heal, this command is intended for use in item scripts. It applies
+potion-related bonuses, such as alchemist ranking, cards, and status changes.
+When used inside an NPC script, certain bonuses are omitted.
 
-There is also a nice example on using this with the 'rand' function, to give you 
-a random amount of healing.
+The command also applies a SP/VIT-related bonus:
+    heal = heal * [(100 + STATUS*2) / 100]
 
-    // This will heal anything thing from 100 to 150 HP and no SP
-    itemheal rand(100,150),0;
+Example:
+    // If the player has 50 vit and no bonuses, this will heal
+    // anything from 200 to 300 HP and 5 SP
+    itemheal rand(100,150),5;
 
 ---------------------------------------
 

+ 6 - 6
src/map/clif.c

@@ -11024,16 +11024,16 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd)
 /// 012a
 void clif_parse_RemoveOption(int fd,struct map_session_data *sd)
 {
-	/**
-	 * Attempts to remove these options when this function is called (will remove all available)
-	 **/
+	if( !(sd->sc.option&(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR))
 #ifdef NEW_CARTS
-	pc_setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
-	if( sd->sc.data[SC_PUSH_CART] )
+	    && sd->sc.data[SC_PUSH_CART] ){
 		pc_setcart(sd,0);
 #else
-	pc_setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
+	    ){
+		pc_setoption(sd,sd->sc.option&~OPTION_CART);
 #endif
+	} else  // priority to remove this option before we can clear cart
+		pc_setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
 }
 
 

+ 9 - 5
src/map/pc.c

@@ -7540,7 +7540,7 @@ void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int ty
  *------------------------------------------*/
 int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
 {
-	int bonus;
+	int bonus, tmp;
 
 	if(hp) {
 		int i;
@@ -7562,8 +7562,10 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
 				break;
 			}
 		}
-		if(bonus!=100)
-			hp = hp * bonus / 100;
+
+		tmp = hp * bonus / 100;  // overflow check
+		if(bonus != 100 && tmp > hp)
+			hp = tmp;
 
 		// Recovery Potion
 		if( sd->sc.data[SC_INCHEALRATE] )
@@ -7575,8 +7577,10 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
 			+ pc_checkskill(sd,AM_LEARNINGPOTION)*5;
 		if (potion_flag > 1)
 			bonus += bonus*(potion_flag-1)*50/100;
-		if(bonus != 100)
-			sp = sp * bonus / 100;
+
+		tmp = sp * bonus / 100;
+		if(bonus != 100 && tmp > sp)
+			sp = tmp;
 	}
 	if( sd->sc.count ) {
 		if ( sd->sc.data[SC_CRITICALWOUND] ) {