Prechádzať zdrojové kódy

- pc_resetskill flag can now be &2, it only returns the total amount of skill points spent, it doesn't does a reset.
- added script command skillpointcount. Returns total amount of skill points a char has (the value returned is the same that SkillPoint would have after invoking a skill reset)
- Modified Defender. Speed reduction is 35-5*lv%, damage reduction on devoted chars is 5+5*lv%. These values are custom, but should be closer to "reality" than what we have.
- When you have the wrong ammo type equipped, the equip arrows first message will be sent, as suggested by Haplo


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6384 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 rokov pred
rodič
commit
f0fc466d8b
5 zmenil súbory, kde vykonal 44 pridanie a 17 odobranie
  1. 8 0
      Changelog-Trunk.txt
  2. 18 14
      src/map/pc.c
  3. 14 0
      src/map/script.c
  4. 2 1
      src/map/skill.c
  5. 2 2
      src/map/status.c

+ 8 - 0
Changelog-Trunk.txt

@@ -4,6 +4,14 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/04/29
+	* added script command skillpointcount. Returns total amount of skill
+	  points a char has (the value returned is the same that SkillPoint would
+	  have after invoking a skill reset) [Skotlex]
+	* Modified Defender. Speed reduction is 35-5*lv%, damage reduction on
+	  devoted chars is 5+5*lv%. These values are custom, but should be closer to
+	  "reality" than what we had. [Skotlex]
+	* When you have the wrong ammo type equipped, the equip arrows first
+	  message will be sent, as suggested by Haplo [Skotlex]
 	* Changed checks of item's identify field from 0/1 to 0/non-zero [Skotlex]
 	* Corrected TK_JUMPKICK to place the caster on the tile next to the target
 	  rather than on top of it. [Skotlex]

+ 18 - 14
src/map/pc.c

@@ -4370,7 +4370,8 @@ int pc_resetstate(struct map_session_data* sd)
 
 /*==========================================
  * /resetskill
- * if flag is 1, perform block resync and status_calc call.
+ * if flag&1, perform block resync and status_calc call.
+ * if flag&2, just count total amount of skill points used by player, do not really reset.
  *------------------------------------------
  */
 int pc_resetskill(struct map_session_data* sd, int flag)
@@ -4391,10 +4392,12 @@ int pc_resetskill(struct map_session_data* sd, int flag)
 						skill_point += skill;
 					else if (sd->status.skill[i].flag > 2 && sd->status.skill[i].flag != 13)
 						skill_point += (sd->status.skill[i].flag - 2);
-					sd->status.skill[i].lv = 0;
-					sd->status.skill[i].flag = 0;
+					if (!(flag&2)) {
+						sd->status.skill[i].lv = 0;
+						sd->status.skill[i].flag = 0;
+					}
 			}
-			else if (battle_config.quest_skill_reset && (inf2&INF2_QUEST_SKILL))
+			else if (battle_config.quest_skill_reset && (inf2&INF2_QUEST_SKILL) && !(flag&2))
 			{
 				sd->status.skill[i].lv = 0;
 				sd->status.skill[i].flag = 0;
@@ -4404,18 +4407,19 @@ int pc_resetskill(struct map_session_data* sd, int flag)
 		}
 	}
 	
-	if (sd->status.skill_point > USHRT_MAX - skill_point)
-		sd->status.skill_point = USHRT_MAX;
-	else
-		sd->status.skill_point += skill_point;
+	if (!(flag&2)) {
+		if (sd->status.skill_point > USHRT_MAX - skill_point)
+			sd->status.skill_point = USHRT_MAX;
+		else
+			sd->status.skill_point += skill_point;
 	
-	if (flag) {
-		clif_updatestatus(sd,SP_SKILLPOINT);
-		clif_skillinfoblock(sd);
-		status_calc_pc(sd,0);
+		if (flag&1) {
+			clif_updatestatus(sd,SP_SKILLPOINT);
+			clif_skillinfoblock(sd);
+			status_calc_pc(sd,0);
+		}
 	}
-
-	return 0;
+	return skill_point;
 }
 
 /*==========================================

+ 14 - 0
src/map/script.c

@@ -271,6 +271,7 @@ int buildin_birthpet(struct script_state *st);
 int buildin_resetlvl(struct script_state *st);
 int buildin_resetstatus(struct script_state *st);
 int buildin_resetskill(struct script_state *st);
+int buildin_skillpointcount(struct script_state *st);
 int buildin_changebase(struct script_state *st);
 int buildin_changesex(struct script_state *st);
 int buildin_waitingroom(struct script_state *st);
@@ -594,6 +595,7 @@ struct {
 	{buildin_resetlvl,"resetlvl","i"},
 	{buildin_resetstatus,"resetstatus",""},
 	{buildin_resetskill,"resetskill",""},
+	{buildin_skillpointcount,"skillpointcount",""},
 	{buildin_changebase,"changebase","i"},
 	{buildin_changesex,"changesex",""},
 	{buildin_waitingroom,"waitingroom","si*"},
@@ -6321,6 +6323,18 @@ int buildin_resetskill(struct script_state *st)
 	return 0;
 }
 
+/*==========================================
+ * Counts total amount of skill points.
+ *------------------------------------------
+ */
+int buildin_skillpointcount(struct script_state *st)
+{
+	struct map_session_data *sd;
+	sd=script_rid2sd(st);
+	push_val(st->stack,C_INT,sd->status.skill_point + pc_resetskill(sd,2));
+	return 0;
+}
+
 /*==========================================
  *
  *------------------------------------------

+ 2 - 1
src/map/skill.c

@@ -8096,7 +8096,8 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
 			if (!(ammo&1<<sd->inventory_data[i]->look))
 			{	//Ammo type check. Send the "wrong weapon type" message
 				//which is the closest we have to wrong ammo type. [Skotlex]
-				clif_skill_fail(sd,skill,6,0);
+				clif_arrow_fail(sd,0); //Haplo suggested we just send the equip-arrows message instead. [Skotlex]
+				//clif_skill_fail(sd,skill,6,0);
 				return 0;
 			}
 		}

+ 2 - 2
src/map/status.c

@@ -2160,7 +2160,7 @@ int status_calc_speed(struct block_list *bl, int speed)
 		if(sc->data[SC_DONTFORGETME].timer!=-1)
 			speed += speed * sc->data[SC_DONTFORGETME].val3/100;
 		if(sc->data[SC_DEFENDER].timer!=-1)
-			speed += speed * (55-5*sc->data[SC_DEFENDER].val1)/100;
+			speed += speed * (35-5*sc->data[SC_DEFENDER].val1)/100;
 		if(sc->data[SC_GOSPEL].timer!=-1 && sc->data[SC_GOSPEL].val4 == BCT_ENEMY)
 			speed += speed * 25/100;
 		if(sc->data[SC_JOINTBEAT].timer!=-1) {
@@ -4229,7 +4229,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,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,SC_DEFENDER,10000,val1,val2,0,0,tick,1);
+							status_change_start(&tsd->bl,SC_DEFENDER,10000,val1,5+val1*5,0,0,tick,1);
 					}
 			}
 			break;