瀏覽代碼

* Added bSubSize, bHPGainValue, and bDamageWhenUnequip
* Updated bSPDrainValue/Rate
* Set baby class players' size to 0(small)
* Fixed item_db2.txt reading printing wrong number of entries read
* Fixed @allskill not giving the newer stalker, whitesmith and creator skills

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

celest 20 年之前
父節點
當前提交
a32145fde2
共有 12 個文件被更改,包括 121 次插入16 次删除
  1. 8 0
      Changelog-SVN.txt
  2. 2 1
      conf-tmpl/battle_athena.conf
  3. 3 0
      db/const.txt
  4. 15 1
      doc/item_bonus.txt
  5. 14 4
      src/map/battle.c
  6. 1 0
      src/map/itemdb.c
  7. 6 2
      src/map/map.h
  8. 8 1
      src/map/mob.c
  9. 47 2
      src/map/pc.c
  10. 4 1
      src/map/skill.c
  11. 2 1
      src/map/skill.h
  12. 11 3
      src/map/status.c

+ 8 - 0
Changelog-SVN.txt

@@ -1,5 +1,13 @@
 Date	Added
 
+02/19
+        * Added bSubSize, bHPGainValue, and bDamageWhenUnequip [celest]
+        * Updated bSPDrainValue/Rate to accept a 'type' [celest]
+        * Set baby class players' size to 0(small) [celest]
+        * Fixed item_db2.txt reading printing wrong number of entries read [celest]
+        * Fixed @allskill not giving the newer stalker, whitesmith and creator skills
+          [celest]
+
 02/18
         * Fixed a bug with statpoint.txt reading and giving too much stat points,
           thanks to Benz / eAthenaC [celest]

+ 2 - 1
conf-tmpl/battle_athena.conf

@@ -258,7 +258,8 @@ gm_skill_unconditional: no
 // Can a normal player by-pass the skill tree? (Note 1)
 player_skillfree: no
 
-// When doing a skill reset, whether the skill's restriction is to be ignored or not. (Note 1)
+// When set to yes, forces skill points gained from 1st class to be put into 1st class
+// sklls, and forces novice skill points to be put into the basic skill. (Note 1)
 player_skillup_limit: no
 
 // Forging success rate. (Note 2)

+ 3 - 0
db/const.txt

@@ -246,6 +246,9 @@ bSPGainValue	2021
 bIgnoreDefMob	2022
 bHPLossRate	2023
 bAddRace2	2024
+bHPGainValue	2025
+bSubSize	2026
+bDamageWhenUnequip	2027
 
 
 Eff_Stone	0

+ 15 - 1
doc/item_bonus.txt

@@ -1,4 +1,4 @@
-//eAthena Items Scripting Manual
+//eAthena Items Scripting Manual
 
 skill n,x;	skill n of level x
 
@@ -150,9 +150,12 @@ bonus bNoRegen,n;			Stops regeneration for n.
 bonus bUnstripable,n;			Armor cannot be taken off via Strip skills
 bonus bSPGainValue,n;			When killing a monster by physical attack
                                         gain n amount of sp
+bonus bHPGainValue,n;			When killing a monster by physical attack
+                                        gain n amount of hp
 bonus bIgnoreDefMob,n;			Ignore monster's DEF when attacking.
                                         n:0=All normal monsters, except Bosses
                                           1=All monsters
+bonus bDamageWhenUnequip,n;		Lose n HP when the item is unequipped
 
 bonus2 bCriticalAddRace,n,x;		Increase critical + n vs. enemies of type x
 bonus2 bHPLossRate,n,x;			Lose n amount of hp every x amount of time
@@ -163,11 +166,22 @@ bonus2 bAddDamageByClass,n,x;		When being hit by monster of class n increase
                                         damage taken by x%
 bonus2 bAddRace2,n,x;			Increase damage by x% vs. enemies of race n
                                         (Check db/mob_race2_db.txt)
+bonus2 bSubSize,n,x;			Damage x% reduction from n size
+                                        n:0=Small  1=Medium  2=Large
 
 bonus3 bHPLossRate,n,x,y;		Lose n amount of hp every x amount of time
                                         y:0=Don't show damage 1=Show damage
 bonus3 bAutoSpellWhenHit,x,y,n;		n% chance to cast skill x of level y when
                                         being hit by physical close range damage
+bonus3 bSPDrainRate,n,x,y;		When attacking there is a n% chance to either
+                                        gain SP equivalent to x% of damage dealt, OR
+                                        drain the amount of sp from the enemy.
+                                        y:0=gain sp  1:drain enemy sp
+bonus3 bSPDrainValue,n,x,y;		When attacking there is a n% chance to either
+                                        gain x SP, OR drain the amount of sp from the
+                                        enemy. y:0=gain sp  1:drain enemy sp
+                                        (Note: setting x to -1 or below will reduce
+                                        YOUR sp)
 
 bonus4 bAutoSpellWhenHit,x,y,n,i;	n% chance to cast skill x of level y when
                                         being hit by physical close range damage

+ 14 - 4
src/map/battle.c

@@ -1058,7 +1058,7 @@ static struct Damage battle_calc_mob_weapon_attack(
 	struct Damage wd;
 	int damage,damage2=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv);
 	int flag,skill,ac_flag = 0,dmg_lv = 0;
-	int t_mode=0,t_race=0,t_size=1,s_race=0,s_ele=0;
+	int t_mode=0,t_race=0,t_size=1,s_race=0,s_ele=0,s_size=0;
 	struct status_change *sc_data,*t_sc_data;
 	short *sc_count;
 	short *option, *opt1, *opt2;
@@ -1074,6 +1074,7 @@ static struct Damage battle_calc_mob_weapon_attack(
 
 	s_race = status_get_race(src);
 	s_ele = status_get_attack_element(src);
+	s_size = status_get_size(src);
 	sc_data = status_get_sc_data(src);
 	sc_count = status_get_sc_count(src);
 	option = status_get_option(src);
@@ -1498,6 +1499,7 @@ static struct Damage battle_calc_mob_weapon_attack(
 		int cardfix=100,i;
 		cardfix=cardfix*(100-tsd->subele[s_ele])/100;	// 属 性によるダメージ耐性
 		cardfix=cardfix*(100-tsd->subrace[s_race])/100;	// 種族によるダメージ耐性
+		cardfix=cardfix*(100-tsd->subsize[s_size])/100;
 		if(mob_db[md->class_].mode & 0x20)
 			cardfix=cardfix*(100-tsd->subrace[10])/100;
 		else
@@ -1616,7 +1618,7 @@ static struct Damage battle_calc_pc_weapon_attack(
 	struct Damage wd;
 	int damage,damage2,damage3=0,damage4=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv);
 	int flag,skill,dmg_lv = 0;
-	int t_mode=0,t_race=0,t_size=1,s_race=7,s_ele=0;
+	int t_mode=0,t_race=0,t_size=1,s_race=7,s_ele=0,s_size=1;
 	int t_race2=0;
 	struct status_change *sc_data,*t_sc_data;
 	short *sc_count;
@@ -1640,6 +1642,7 @@ static struct Damage battle_calc_pc_weapon_attack(
 	s_race=status_get_race(src); //種族
 	s_ele=status_get_attack_element(src); //属性
 	s_ele_=status_get_attack_element2(src); //左手属性
+	s_size=status_get_size(src);
 	sc_data=status_get_sc_data(src); //ステータス異常
 	sc_count=status_get_sc_count(src); //ステータス異常の数
 	option=status_get_option(src); //鷹とかペコとかカートとか
@@ -2602,6 +2605,7 @@ static struct Damage battle_calc_pc_weapon_attack(
 		cardfix=100;
 		cardfix=cardfix*(100-tsd->subrace[s_race])/100;	// 種族によるダメージ耐性
 		cardfix=cardfix*(100-tsd->subele[s_ele])/100;	// 属性によるダメージ耐性
+		cardfix=cardfix*(100-tsd->subsize[s_size])/100;
 		if(status_get_mode(src) & 0x20)
 			cardfix=cardfix*(100-tsd->subrace[10])/100; //ボスからの攻撃はダメージ減少
 		else
@@ -2904,7 +2908,7 @@ struct Damage battle_calc_magic_attack(
 	int aflag;
 	int normalmagic_flag=1;
 	int matk_flag = 1;
-	int ele=0,race=7,t_ele=0,t_race=7,t_mode = 0,cardfix,t_class,i;
+	int ele=0,race=7,size=1,t_ele=0,t_race=7,t_mode = 0,cardfix,t_class,i;
 	struct map_session_data *sd=NULL,*tsd=NULL;
 	struct mob_data *tmd = NULL;
 
@@ -2925,6 +2929,7 @@ struct Damage battle_calc_magic_attack(
 	matk2=status_get_matk2(bl);
 	ele = skill_get_pl(skill_num);
 	race = status_get_race(bl);
+	size = status_get_size(bl);
 	t_ele = status_get_elem_type(target);
 	t_race = status_get_race(target);
 	t_mode = status_get_mode(target);
@@ -3131,6 +3136,7 @@ struct Damage battle_calc_magic_attack(
 		cardfix=100;
 		cardfix=cardfix*(100-tsd->subele[ele])/100;	// 属 性によるダメージ耐性
 		cardfix=cardfix*(100-tsd->subrace[race])/100;	// 種族によるダメージ耐性
+		cardfix=cardfix*(100-tsd->subsize[size])/100;
 		cardfix=cardfix*(100-tsd->magic_subrace[race])/100;
 		if(status_get_mode(bl) & 0x20)
 			cardfix=cardfix*(100-tsd->magic_subrace[10])/100;
@@ -3207,7 +3213,7 @@ struct Damage  battle_calc_misc_attack(
 	int int_=status_get_int(bl);
 //	int luk=status_get_luk(bl);
 	int dex=status_get_dex(bl);
-	int skill,ele,race,cardfix;
+	int skill,ele,race,size,cardfix;
 	struct map_session_data *sd=NULL,*tsd=NULL;
 	int damage=0,div_=1,blewcount=skill_get_blewcount(skill_num,skill_lv);
 	struct Damage md;
@@ -3311,6 +3317,7 @@ struct Damage  battle_calc_misc_attack(
 
 	ele = skill_get_pl(skill_num);
 	race = status_get_race(bl);
+	size = status_get_size(bl);
 
 	if(damagefix){
 		if(damage<1 && skill_num != NPC_DARKBREATH)
@@ -3320,6 +3327,7 @@ struct Damage  battle_calc_misc_attack(
 			cardfix=100;
 			cardfix=cardfix*(100-tsd->subele[ele])/100;	// 属性によるダメージ耐性
 			cardfix=cardfix*(100-tsd->subrace[race])/100;	// 種族によるダメージ耐性
+			cardfix=cardfix*(100-tsd->subsize[size])/100;
 			cardfix=cardfix*(100-tsd->misc_def_rate)/100;
 			damage=damage*cardfix/100;
 		}
@@ -3605,6 +3613,8 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
 				}
 
 				if (hp || sp) pc_heal(sd, hp, sp);
+				if (sd->sp_drain_type && target->type == BL_PC)
+					battle_heal(NULL,target,0,-sp,0);
 			}
 		}
 		if (target->type == BL_PC) {

+ 1 - 0
src/map/itemdb.c

@@ -381,6 +381,7 @@ static int itemdb_readdb(void)
 		fclose(fp);
 		sprintf(tmp_output,"Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",ln,filename[i]);
 		ShowStatus(tmp_output);
+		ln=0;	// reset to 0
 	}
 	return 0;
 }

+ 6 - 2
src/map/map.h

@@ -285,11 +285,14 @@ struct map_session_data {
 	unsigned short unstripable_equip;
 	short add_damage_classid2[10],add_damage_class_count2;
 	int add_damage_classrate2[10];
-	short sp_gain_value;
+	short sp_gain_value, hp_gain_value;
+	short sp_drain_type;
 	short ignore_def_mob, ignore_def_mob_;
 	int hp_loss_tick, hp_loss_rate;
 	short hp_loss_value, hp_loss_type;
 	int addrace2[6],addrace2_[6];
+	int subsize[3];
+	short unequip_damage;
 
 	short spiritball, spiritball_old;
 	int spirit_timer[MAX_SKILL_LEVEL];
@@ -631,7 +634,8 @@ enum {
 
 	SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017
 	SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020
-	SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2 // 2021-2023
+	SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025
+	SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP	// 2026
 };
 
 enum {

+ 8 - 1
src/map/mob.c

@@ -2384,18 +2384,25 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 
 	
 	if(sd) {
-		int sp = 0;
+		int sp = 0, hp = 0;
 		if (sd->state.attack_type == BF_MAGIC && (i=pc_checkskill(sd,HW_SOULDRAIN))>0){	/* ソウルドレイン */
 			clif_skill_nodamage(src,&md->bl,HW_SOULDRAIN,i,1);
 			sp += (status_get_lv(&md->bl))*(65+15*i)/100;
 		}
 		sp += sd->sp_gain_value;
+		hp += sd->hp_gain_value;
 		if (sp > 0) {
 			if(sd->status.sp + sp > sd->status.max_sp)
 				sp = sd->status.max_sp - sd->status.sp;
 			sd->status.sp += sp;
 			clif_heal(sd->fd,SP_SP,sp);
 		}
+		if (hp > 0) {
+			if(sd->status.hp + hp > sd->status.max_hp)
+				hp = sd->status.max_hp - sd->status.hp;
+			sd->status.hp += hp;
+			clif_heal(sd->fd,SP_HP,hp);
+		}
 	}
 
 	// map外に消えた人は計算から除くので

+ 47 - 2
src/map/pc.c

@@ -980,6 +980,8 @@ int pc_calc_skilltree(struct map_session_data *sd)
 		if(battle_config.enable_upper_class){ //confで無?でなければ?み?む
 			for(i=355;i<411;i++)
 				sd->status.skill[i].id=i;
+			for(i=475;i<480;i++)
+				sd->status.skill[i].id=i;
 		}
 	}else{
             do {
@@ -1585,6 +1587,14 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
 		else if(sd->state.lr_flag == 1)
 			sd->ignore_def_mob_ |= 1<<val;
 		break;
+	case SP_HP_GAIN_VALUE:
+		if(!sd->state.lr_flag)
+			sd->hp_gain_value += val;
+		break;
+	case SP_DAMAGE_WHEN_UNEQUIP:
+		if(!sd->state.lr_flag)
+			sd->unequip_damage += val;
+		break;
 	default:
 		if(battle_config.error_log)
 			printf("pc_bonus: unknown type %d %d !\n",type,val);
@@ -1764,8 +1774,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
 		}
 		else if(sd->state.lr_flag == 1) {
 			sd->sp_drain_rate_ += type2;
-			sd->sp_drain_per_ += val;
+			sd->sp_drain_per_ += val;			
 		}
+		sd->sp_drain_type = 0;
 		break;
 	case SP_SP_DRAIN_VALUE:
 		if(!sd->state.lr_flag) {
@@ -1776,7 +1787,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
 			sd->sp_drain_rate_ += type2;
 			sd->sp_drain_value_ += val;
 		}
-
+		sd->sp_drain_type = 0;
 		break;
 	case SP_WEAPON_COMA_ELE:
 		if(sd->state.lr_flag != 2)
@@ -1847,6 +1858,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
 		else
 			sd->addrace2_[type2] += val;
 		break;
+	case SP_SUBSIZE:
+		if(sd->state.lr_flag != 2)
+			sd->subsize[type2]+=val;
+		break;
 
 	default:
 		if(battle_config.error_log)
@@ -1900,6 +1915,27 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
 			sd->hp_loss_type = val;
 		}
 		break;
+	case SP_SP_DRAIN_RATE:
+		if(!sd->state.lr_flag) {
+			sd->sp_drain_rate += type2;
+			sd->sp_drain_per += type3;			
+		}
+		else if(sd->state.lr_flag == 1) {
+			sd->sp_drain_rate_ += type2;
+			sd->sp_drain_per_ += type3;
+		}
+		sd->sp_drain_type = val;
+		break;
+	case SP_SP_DRAIN_VALUE:
+		if(!sd->state.lr_flag) {
+			sd->sp_drain_rate += type2;
+			sd->sp_drain_value += type3;
+		}
+		else if(sd->state.lr_flag == 1) {
+			sd->sp_drain_rate_ += type2;
+			sd->sp_drain_value_ += type3;
+		}
+		sd->sp_drain_type = val;
 	default:
 		if(battle_config.error_log)
 			printf("pc_bonus3: unknown type %d %d %d %d!\n",type,type2,type3,val);
@@ -4306,6 +4342,8 @@ int pc_allskillup(struct map_session_data *sd)
 		if(battle_config.enable_upper_class){ //confで無?でなければ?み?む
 			for(i=355;i<411;i++)
 				sd->status.skill[i].id=i;
+			for(i=475;i<480;i++)
+				sd->status.skill[i].id=i;
 		}
 	}
 	else {
@@ -6067,6 +6105,13 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
 	} else {
 		clif_unequipitemack(sd,n,0,0);
 	}
+	if (sd->unequip_damage > 0) {
+		short dmg = sd->unequip_damage;
+		if (dmg > sd->status.hp)
+			dmg = sd->status.hp;
+		pc_heal(sd,-dmg,0);
+	}
+
 	if(flag&1) {
 		status_calc_pc(sd,0);
 		if(sd->sc_count && sd->sc_data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele))

+ 4 - 1
src/map/skill.c

@@ -1588,7 +1588,10 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
 			if(sd->sp_drain_rate_ > 0 && sp < 1) sp = 1;
 			else if(sd->sp_drain_rate_ < 0 && sp > -1) sp = -1;
 		}
-		if(hp || sp) pc_heal(sd,hp,sp);
+		if(hp || sp)
+			pc_heal(sd,hp,sp);
+		if (sd->sp_drain_type && bl->type == BL_PC)
+			battle_heal(NULL,bl,0,-sp,0);
 	}
 
 	if((skillid || flag) && rdamage > 0)

+ 2 - 1
src/map/skill.h

@@ -611,7 +611,8 @@ enum {
 	WE_BABY,
 	WE_CALLPARENT,
 	WE_CALLBABY,
-	TK_RUN,
+
+	TK_RUN = 411,
 	TK_READYSTORM,
 	TK_STORMKICK,
 	TK_READYDOWN,

+ 11 - 3
src/map/status.c

@@ -512,6 +512,9 @@ int status_calc_pc(struct map_session_data* sd,int first)
 	sd->hp_loss_rate = sd->hp_loss_value = sd->hp_loss_type = 0;
 	memset(sd->addrace2,0,sizeof(sd->addrace2));
 	memset(sd->addrace2_,0,sizeof(sd->addrace2_));
+	sd->hp_gain_value = sd->sp_drain_type = 0;
+	memset(sd->subsize,0,sizeof(sd->subsize));
+	sd->unequip_damage = 0;
 
 	if(!sd->disguiseflag && sd->disguise) {
 		sd->disguise=0;
@@ -2786,11 +2789,16 @@ int status_get_size(struct block_list *bl)
 	nullpo_retr(1, bl);
 	if(bl->type==BL_MOB && (struct mob_data *)bl)
 		return mob_db[((struct mob_data *)bl)->class_].size;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return 1;
 	else if(bl->type==BL_PET && (struct pet_data *)bl)
 		return mob_db[((struct pet_data *)bl)->class_].size;
-	else
+	else if(bl->type==BL_PC) {
+		struct map_session_data *sd = (struct map_session_data *)bl;
+		//if (pc_isriding(sd))	// fact or rumour?
+		//	return 2;
+		if (pc_calc_upper(sd->status.class_) == 2)
+			return 0;
+		return 1;
+	} else
 		return 1;
 }
 int status_get_mode(struct block_list *bl)