summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-20 12:07:52 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-20 12:07:52 +0000
commit257a41619254ceb14b6e0867a20449248b540d41 (patch)
tree806b0c0cfab18b6e33cb268339a3ff1a84851717 /src/map
parentacb92c94cae29a2e516b1f77101889f7d043bf85 (diff)
downloadhercules-257a41619254ceb14b6e0867a20449248b540d41.tar.gz
hercules-257a41619254ceb14b6e0867a20449248b540d41.tar.bz2
hercules-257a41619254ceb14b6e0867a20449248b540d41.tar.xz
hercules-257a41619254ceb14b6e0867a20449248b540d41.zip
* Added 4 new card effects from 3/15's patch
* Added 'enable_ip_rules' to packet_athena.conf * Updated socket debug messages to be more readable git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1257 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c12
-rw-r--r--src/map/map.h10
-rw-r--r--src/map/mob.c33
-rw-r--r--src/map/pc.c47
-rw-r--r--src/map/status.c6
5 files changed, 79 insertions, 29 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 483ddffb7..81b2c3189 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1063,7 +1063,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,s_size=0;
+ int t_mode=0,t_race=0,t_size=1,s_race=0,s_ele=0,s_size=0,s_race2=0;
struct status_change *sc_data,*t_sc_data;
short *sc_count;
short *option, *opt1, *opt2;
@@ -1085,6 +1085,7 @@ static struct Damage battle_calc_mob_weapon_attack(
option = status_get_option(src);
opt1 = status_get_opt1(src);
opt2 = status_get_opt2(src);
+ s_race2 = status_get_race2(src);
// ターゲット
if(target->type == BL_PC)
@@ -1504,6 +1505,7 @@ static struct Damage battle_calc_mob_weapon_attack(
cardfix=cardfix*(100-tsd->subele[s_ele])/100; // 属 性によるダメージ耐性
cardfix=cardfix*(100-tsd->subrace[s_race])/100; // 種族によるダメージ耐性
cardfix=cardfix*(100-tsd->subsize[s_size])/100;
+ cardfix=cardfix*(100-tsd->subrace2[s_race2])/100; // 種族によるダメージ耐性
if(mob_db[md->class_].mode & 0x20)
cardfix=cardfix*(100-tsd->subrace[10])/100;
else
@@ -2857,7 +2859,7 @@ struct Damage battle_calc_magic_attack(
int aflag;
int normalmagic_flag=1;
int matk_flag = 1;
- int ele=0,race=7,size=1,t_ele=0,t_race=7,t_mode = 0,cardfix,t_class,i;
+ int ele=0,race=7,size=1,race2=7,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;
@@ -2879,6 +2881,7 @@ struct Damage battle_calc_magic_attack(
ele = skill_get_pl(skill_num);
race = status_get_race(bl);
size = status_get_size(bl);
+ race2 = status_get_race2(bl);
t_ele = status_get_elem_type(target);
t_race = status_get_race(target);
t_mode = status_get_mode(target);
@@ -3091,6 +3094,7 @@ struct Damage battle_calc_magic_attack(
cardfix=cardfix*(100-tsd->subrace[race])/100; // 種族によるダメージ耐性
cardfix=cardfix*(100-tsd->subsize[size])/100;
cardfix=cardfix*(100-tsd->magic_subrace[race])/100;
+ cardfix=cardfix*(100-tsd->subrace2[race2])/100; // 種族によるダメージ耐性
if(status_get_mode(bl) & 0x20)
cardfix=cardfix*(100-tsd->magic_subrace[10])/100;
else
@@ -3166,7 +3170,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,size,cardfix;
+ int skill,ele,race,size,cardfix,race2;
struct map_session_data *sd=NULL,*tsd=NULL;
int damage=0,div_=1,blewcount=skill_get_blewcount(skill_num,skill_lv);
struct Damage md;
@@ -3270,6 +3274,7 @@ struct Damage battle_calc_misc_attack(
ele = skill_get_pl(skill_num);
race = status_get_race(bl);
size = status_get_size(bl);
+ race2 = status_get_race(bl);
if(damagefix){
if(damage<1 && skill_num != NPC_DARKBREATH)
@@ -3281,6 +3286,7 @@ struct Damage battle_calc_misc_attack(
cardfix=cardfix*(100-tsd->subrace[race])/100; // 種族によるダメージ耐性
cardfix=cardfix*(100-tsd->subsize[size])/100;
cardfix=cardfix*(100-tsd->misc_def_rate)/100;
+ cardfix=cardfix*(100-tsd->subrace2[race2])/100;
damage=damage*cardfix/100;
}
if (sd && skill_num > 0 && sd->skillatk[0] == skill_num)
diff --git a/src/map/map.h b/src/map/map.h
index a83f810b9..8039615f7 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -297,9 +297,14 @@ struct map_session_data {
short hp_loss_value, hp_loss_type;
int addrace2[6],addrace2_[6];
int subsize[3];
- short unequip_damage[11];
+ short unequip_losehp[11];
+ short unequip_losesp[11];
int itemid;
int itemhealrate[6];
+ //--- 03/15's new card effects
+ int expaddrace[6];
+ int subrace2[6];
+ short sp_gain_race[6];
short spiritball, spiritball_old;
int spirit_timer[MAX_SKILL_LEVEL];
@@ -647,7 +652,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, SP_HP_GAIN_VALUE, // 2021-2025
- SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP, SP_ADD_ITEM_HEAL_RATE // 2026-2028
+ SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP, SP_ADD_ITEM_HEAL_RATE, SP_LOSESP_WHEN_UNEQUIP, SP_EXP_ADDRACE, // 2026-2030
+ SP_SP_GAIN_RACE, SP_SUBRACE2,
};
enum {
diff --git a/src/map/mob.c b/src/map/mob.c
index 584d9de2e..3cfb4e6d5 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2198,10 +2198,12 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
struct item item;
int ret;
int drop_rate;
+ int race;
nullpo_retr(0, md); //srcはNULLで呼ばれる場合もあるので、他でチェック
max_hp = status_get_max_hp(&md->bl);
+ race = status_get_race(&md->bl);
if(src && src->type == BL_PC) {
sd = (struct map_session_data *)src;
@@ -2425,6 +2427,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
sp += (status_get_lv(&md->bl))*(65+15*i)/100;
}
sp += sd->sp_gain_value;
+ sp += sd->sp_gain_race[race];
hp += sd->hp_gain_value;
if (sp > 0) {
if(sd->status.sp + sp > sd->status.max_sp)
@@ -2512,21 +2515,24 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if(job_exp < 1) job_exp = 1;
}
- if(sd && battle_config.pk_mode && (mob_db[md->class_].lv - sd->status.base_level >= 20)) {
- base_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris]
- }
- if(sd && battle_config.pk_mode && (mob_db[md->class_].lv - sd->status.base_level >= 20)) {
- job_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris]
+ if(sd) {
+ int rate;
+ if ((rate = sd->expaddrace[race]) > 0) {
+ base_exp = (100+rate)*base_exp/100;
+ job_exp = (100+rate)*job_exp/100;
+ }
+ if (battle_config.pk_mode && (mob_db[md->class_].lv - sd->status.base_level >= 20)) {
+ base_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris]
+ job_exp*=1.15;
+ }
}
if(md->master_id) {
- master = map_id2bl(md->master_id);
- }
- if((master && status_get_mode(master)&0x20) || // check if its master is a boss (MVP's and minibosses)
- (md->state.special_mob_ai >= 1 && battle_config.alchemist_summon_reward != 1)) { // for summoned creatures [Valaris]
- base_exp = 0;
- job_exp = 0;
- }
- else {
+ if(((master = map_id2bl(md->master_id)) && status_get_mode(master)&0x20) || // check if its master is a boss (MVP's and minibosses)
+ (md->state.special_mob_ai >= 1 && battle_config.alchemist_summon_reward != 1)) { // for summoned creatures [Valaris]
+ base_exp = 0;
+ job_exp = 0;
+ }
+ } else {
if(battle_config.zeny_from_mobs) {
if(md->level > 0) zeny=(md->level+rand()%md->level)*per/256; // zeny calculation moblv + random moblv [Valaris]
if(mob_db[md->class_].mexp > 0)
@@ -2639,7 +2645,6 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if(sd && sd->state.attack_type == BF_WEAPON) {
for(i=0;i<sd->monster_drop_item_count;i++) {
struct delay_item_drop *ditem;
- int race = status_get_race(&md->bl);
if(sd->monster_drop_itemid[i] <= 0)
continue;
if(sd->monster_drop_race[i] & (1<<race) ||
diff --git a/src/map/pc.c b/src/map/pc.c
index 920784da3..c681f8ec5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1588,7 +1588,18 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
int i;
for (i=0; i<11; i++) {
if (sd->inventory_data[current_equip_item_index]->equip & equip_pos[i]) {
- sd->unequip_damage[i] += val;
+ sd->unequip_losehp[i] += val;
+ break;
+ }
+ }
+ }
+ break;
+ case SP_LOSESP_WHEN_UNEQUIP:
+ if(!sd->state.lr_flag) {
+ int i;
+ for (i=0; i<11; i++) {
+ if (sd->inventory_data[current_equip_item_index]->equip & equip_pos[i]) {
+ sd->unequip_losesp[i] += val;
break;
}
}
@@ -1861,10 +1872,22 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag != 2)
sd->subsize[type2]+=val;
break;
+ case SP_SUBRACE2:
+ if(sd->state.lr_flag != 2)
+ sd->subrace2[type2]+=val;
+ break;
case SP_ADD_ITEM_HEAL_RATE:
if(sd->state.lr_flag != 2)
sd->itemhealrate[type2 - 1] += val;
break;
+ case SP_EXP_ADDRACE:
+ if(sd->state.lr_flag != 2)
+ sd->expaddrace[type2]+=val;
+ break;
+ case SP_SP_GAIN_RACE:
+ if(sd->state.lr_flag != 2)
+ sd->sp_gain_race[type2]+=val;
+ break;
default:
if(battle_config.error_log)
@@ -6076,7 +6099,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos)
*/
int pc_unequipitem(struct map_session_data *sd,int n,int flag)
{
- short dmg = 0;
+ short hp = 0, sp = 0;
nullpo_retr(0, sd);
// -- moonsoul (if player is berserk then cannot unequip)
@@ -6093,9 +6116,13 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
for(i=0;i<11;i++) {
if(sd->status.inventory[n].equip & equip_pos[i]) {
sd->equip_index[i] = -1;
- if(sd->unequip_damage[i] > 0) {
- dmg += sd->unequip_damage[i];
- sd->unequip_damage[i] = 0;
+ if(sd->unequip_losehp[i] > 0) {
+ hp += sd->unequip_losehp[i];
+ sd->unequip_losehp[i] = 0;
+ }
+ if(sd->unequip_losesp[i] > 0) {
+ sp += sd->unequip_losesp[i];
+ sd->unequip_losesp[i] = 0;
}
}
}
@@ -6150,10 +6177,12 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1);
}
- if (dmg > 0) {
- if (dmg > sd->status.hp)
- dmg = sd->status.hp;
- pc_heal(sd,-dmg,0);
+ if (hp > 0 || sp > 0) {
+ if (hp > sd->status.hp)
+ hp = sd->status.hp;
+ if (sp > sd->status.sp)
+ sp = sd->status.sp;
+ pc_heal(sd,-hp,-sp);
}
return 0;
diff --git a/src/map/status.c b/src/map/status.c
index b0c90d520..e05d33909 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -521,7 +521,11 @@ int status_calc_pc(struct map_session_data* sd,int first)
memset(sd->addrace2_,0,sizeof(sd->addrace2_));
sd->hp_gain_value = sd->sp_drain_type = 0;
memset(sd->subsize,0,sizeof(sd->subsize));
- memset(sd->unequip_damage,0,sizeof(sd->unequip_damage));
+ memset(sd->unequip_losehp,0,sizeof(sd->unequip_losehp));
+ memset(sd->unequip_losesp,0,sizeof(sd->unequip_losesp));
+ memset(sd->subrace2,0,sizeof(sd->subrace2));
+ memset(sd->expaddrace,0,sizeof(sd->expaddrace));
+ memset(sd->sp_gain_race,0,sizeof(sd->sp_gain_race));
if(!sd->disguiseflag && sd->disguise) {
sd->disguise=0;