Skip to content
Permalink
Browse files

Merge pull request #2510 from Emistry/mobdb_dmg_taken_rate

Update mob_db - DamageTakenRate field
  • Loading branch information...
MishimaHaruna committed Jul 28, 2019
2 parents 015f3ef + b372b02 commit c179d9184301e83e75a425fc09818be98b443f65
Showing with 203 additions and 153 deletions.
  1. +24 −23 db/constants.conf
  2. +1 −0 db/mob_db2.conf
  3. +1 −0 db/pre-re/mob_db.conf
  4. +1 −0 db/re/mob_db.conf
  5. +133 −130 doc/script_commands.txt
  6. +12 −0 src/map/battle.c
  7. +7 −0 src/map/mob.c
  8. +2 −0 src/map/mob.h
  9. +9 −0 src/map/script.c
  10. +1 −0 src/map/script.h
  11. +12 −0 src/map/skill.c
@@ -1508,29 +1508,30 @@ constants_db: {
}

comment__: "getmonsterinfo"
MOB_NAME: 0
MOB_LV: 1
MOB_MAXHP: 2
MOB_BASEEXP: 3
MOB_JOBEXP: 4
MOB_ATK1: 5
MOB_ATK2: 6
MOB_DEF: 7
MOB_MDEF: 8
MOB_STR: 9
MOB_AGI: 10
MOB_VIT: 11
MOB_INT: 12
MOB_DEX: 13
MOB_LUK: 14
MOB_RANGE: 15
MOB_RANGE2: 16
MOB_RANGE3: 17
MOB_SIZE: 18
MOB_RACE: 19
MOB_ELEMENT: 20
MOB_MODE: 21
MOB_MVPEXP: 22
MOB_NAME: 0
MOB_LV: 1
MOB_MAXHP: 2
MOB_BASEEXP: 3
MOB_JOBEXP: 4
MOB_ATK1: 5
MOB_ATK2: 6
MOB_DEF: 7
MOB_MDEF: 8
MOB_STR: 9
MOB_AGI: 10
MOB_VIT: 11
MOB_INT: 12
MOB_DEX: 13
MOB_LUK: 14
MOB_RANGE: 15
MOB_RANGE2: 16
MOB_RANGE3: 17
MOB_SIZE: 18
MOB_RACE: 19
MOB_ELEMENT: 20
MOB_MODE: 21
MOB_MVPEXP: 22
MOB_DMG_TAKEN_RATE: 23

comment__: "mercenary guilds"
ARCH_MERC_GUILD: 0
@@ -93,6 +93,7 @@ mob_db: (
AegisName: (chance, "Option Drop Group")
// ...
}
DamageTakenRate: damage taken rate (int, defaults to 100)
},
**************************************************************************/

@@ -93,6 +93,7 @@ mob_db: (
AegisName: (chance, "Option Drop Group")
// ...
}
DamageTakenRate: damage taken rate (int, defaults to 100)
},
**************************************************************************/

@@ -93,6 +93,7 @@ mob_db: (
AegisName: (chance, "Option Drop Group")
// ...
}
DamageTakenRate: damage taken rate (int, defaults to 100)
},
**************************************************************************/

@@ -3969,29 +3969,30 @@ It will return -1 if there is no such monster (or the type value is
invalid), or "null" if you requested the monster's name.

Valid types are listed in doc/constants.md:
MOB_NAME 0
MOB_LV 1
MOB_MAXHP 2
MOB_BASEEXP 3
MOB_JOBEXP 4
MOB_ATK1 5
MOB_ATK2 6
MOB_DEF 7
MOB_MDEF 8
MOB_STR 9
MOB_AGI 10
MOB_VIT 11
MOB_INT 12
MOB_DEX 13
MOB_LUK 14
MOB_RANGE 15
MOB_RANGE2 16
MOB_RANGE3 17
MOB_SIZE 18
MOB_RACE 19
MOB_ELEMENT 20
MOB_MODE 21
MOB_MVPEXP 22
MOB_NAME 0
MOB_LV 1
MOB_MAXHP 2
MOB_BASEEXP 3
MOB_JOBEXP 4
MOB_ATK1 5
MOB_ATK2 6
MOB_DEF 7
MOB_MDEF 8
MOB_STR 9
MOB_AGI 10
MOB_VIT 11
MOB_INT 12
MOB_DEX 13
MOB_LUK 14
MOB_RANGE 15
MOB_RANGE2 16
MOB_RANGE3 17
MOB_SIZE 18
MOB_RACE 19
MOB_ELEMENT 20
MOB_MODE 21
MOB_MVPEXP 22
MOB_DMG_TAKEN_RATE 23

Check sample in doc/sample/getmonsterinfo.txt

@@ -10240,60 +10241,61 @@ Sets or alters the data in real-time for game objects of the following types -
NPCs, Pets, Monsters, Homunuculus', Mercenaries, Elementals.

Applicable Data Types (available as constants) -
Data Types Description (parameter type)
UDT_SIZE: Unit Size
UDT_LEVEL: Level
UDT_HP: Current HP
UDT_MAXHP: Max HP
UDT_SP: SP
UDT_MAXSP: MAX SP
UDT_MASTERAID: Master Account ID (for Summons)
UDT_MASTERCID: Master Char ID (for Summons)
UDT_SPEED: Unit Speed.
UDT_MODE: Mode (Mobs only)
UDT_AI: Unit AI Type (see doc/constants.md for Unit AI Types)
UDT_SCOPTION: Status Options. (see doc/constants.md for Unit Option Types)
UDT_SEX: Gender of the unit. (see doc/constants.md for Genders)
UDT_CLASS: Class of the unit. (Monster ID)
UDT_HAIRSTYLE: Hair Style ID.
UDT_HAIRCOLOR: Hair Color ID.
UDT_HEADBOTTOM: Headgear Bottom Sprite ID.
UDT_HEADMIDDLE: Headgear Middle Sprite ID.
UDT_HEADTOP: Headgear Top Sprite ID.
UDT_CLOTHCOLOR: Cloth Color ID.
UDT_SHIELD: Shield Sprite ID.
UDT_WEAPON: Weapon Sprite ID.
UDT_LOOKDIR: Face direction.
UDT_CANMOVETICK: Stop a unit from move for n seconds.
UDT_STR: Unit STR.
UDT_AGI: Unit AGI.
UDT_VIT: Unit VIT.
UDT_INT: Unit INT.
UDT_DEX: Unit DEX.
UDT_LUK: Unit LUK.
UDT_ATKRANGE: Attack range of a unit.
UDT_ATKMIN: Min Atk of a unit.
UDT_ATKMAX: Max Atk of a unit.
UDT_MATKMIN: Min MATK of a unit.
UDT_MATKMAX: Max MATK of a unit.
UDT_DEF: DEF.
UDT_MDEF: MDEF.
UDT_HIT: HIT.
UDT_FLEE: FLEE.
UDT_PDODGE: Perfect Dodge.
UDT_CRIT: Critical Rate.
UDT_RACE: Race. (Eg. constants RC_DemiHuman or Integer 7).
UDT_ELETYPE: Element. (Eg. constants Ele_Neutral or Integer 0).
UDT_ELELEVEL: Element Level.
UDT_AMOTION: AMotion Rate.
UDT_ADELAY: ADelay Rate.
UDT_DMOTION: DMotion Rate.
UDT_HUNGER: Hunger Rate - for summons.
UDT_INTIMACY: Intimacy Rate - for summons.
UDT_LIFETIME: LifeTime - for summons.
UDT_MERC_KILLCOUNT: Kill count for mercenaries
UDT_STATADD: Status Points - for NPCs.
UDT_GROUP: group id
Data Types Description (parameter type)
UDT_SIZE: Unit Size
UDT_LEVEL: Level
UDT_HP: Current HP
UDT_MAXHP: Max HP
UDT_SP: SP
UDT_MAXSP: MAX SP
UDT_MASTERAID: Master Account ID (for Summons)
UDT_MASTERCID: Master Char ID (for Summons)
UDT_SPEED: Unit Speed.
UDT_MODE: Mode (Mobs only)
UDT_AI: Unit AI Type (see doc/constants.md for Unit AI Types)
UDT_SCOPTION: Status Options. (see doc/constants.md for Unit Option Types)
UDT_SEX: Gender of the unit. (see doc/constants.md for Genders)
UDT_CLASS: Class of the unit. (Monster ID)
UDT_HAIRSTYLE: Hair Style ID.
UDT_HAIRCOLOR: Hair Color ID.
UDT_HEADBOTTOM: Headgear Bottom Sprite ID.
UDT_HEADMIDDLE: Headgear Middle Sprite ID.
UDT_HEADTOP: Headgear Top Sprite ID.
UDT_CLOTHCOLOR: Cloth Color ID.
UDT_SHIELD: Shield Sprite ID.
UDT_WEAPON: Weapon Sprite ID.
UDT_LOOKDIR: Face direction.
UDT_CANMOVETICK: Stop a unit from move for n seconds.
UDT_STR: Unit STR.
UDT_AGI: Unit AGI.
UDT_VIT: Unit VIT.
UDT_INT: Unit INT.
UDT_DEX: Unit DEX.
UDT_LUK: Unit LUK.
UDT_ATKRANGE: Attack range of a unit.
UDT_ATKMIN: Min Atk of a unit.
UDT_ATKMAX: Max Atk of a unit.
UDT_MATKMIN: Min MATK of a unit.
UDT_MATKMAX: Max MATK of a unit.
UDT_DEF: DEF.
UDT_MDEF: MDEF.
UDT_HIT: HIT.
UDT_FLEE: FLEE.
UDT_PDODGE: Perfect Dodge.
UDT_CRIT: Critical Rate.
UDT_RACE: Race. (Eg. constants RC_DemiHuman or Integer 7).
UDT_ELETYPE: Element. (Eg. constants Ele_Neutral or Integer 0).
UDT_ELELEVEL: Element Level.
UDT_AMOTION: AMotion Rate.
UDT_ADELAY: ADelay Rate.
UDT_DMOTION: DMotion Rate.
UDT_HUNGER: Hunger Rate - for summons.
UDT_INTIMACY: Intimacy Rate - for summons.
UDT_LIFETIME: LifeTime - for summons.
UDT_MERC_KILLCOUNT: Kill count for mercenaries
UDT_STATADD: Status Points - for NPCs.
UDT_GROUP: group id
UDT_DAMAGE_TAKEN_RATE: damage taken rate of a unit.

returns 0 if value could not be set, 1 if successful.

@@ -10304,59 +10306,60 @@ returns 0 if value could not be set, 1 if successful.
Retrieves real-time data of a game object.

Applicable Data types (available as constants) -
Data Types Description (return type)
UDT_SIZE: Unit Size
UDT_LEVEL: Level
UDT_HP: Current HP
UDT_MAXHP: Max HP
UDT_SP: SP
UDT_MAXSP: MAX SP
UDT_MASTERAID: Master Account ID (for Summons)
UDT_MASTERCID: Master Char ID (for Summons)
UDT_SPEED: Unit Speed.
UDT_MODE: Mode (Mobs only)
UDT_AI: Unit AI Type (see doc/constants.md for Unit AI Types)
UDT_SCOPTION: Status Options. (see doc/constants.md for Unit Option Types)
UDT_SEX: Gender of the unit. (see doc/constants.md for Genders)
UDT_CLASS: Class of the unit. (Monster ID)
UDT_HAIRSTYLE: Hair Style ID.
UDT_HAIRCOLOR: Hair Color ID.
UDT_HEADBOTTOM: Headgear Bottom Sprite ID.
UDT_HEADMIDDLE: Headgear Middle Sprite ID.
UDT_HEADTOP: Headgear Top Sprite ID.
UDT_CLOTHCOLOR: Cloth Color ID.
UDT_SHIELD: Shield Sprite ID.
UDT_WEAPON: Weapon Sprite ID.
UDT_LOOKDIR: Face direction.
UDT_CANMOVETICK: Stop a unit from move for n seconds.
UDT_STR: Unit STR.
UDT_AGI: Unit AGI.
UDT_VIT: Unit VIT.
UDT_INT: Unit INT.
UDT_DEX: Unit DEX.
UDT_LUK: Unit LUK.
UDT_ATKRANGE: Attack range of a unit.
UDT_ATKMIN: Min Atk of a unit.
UDT_ATKMAX: Max Atk of a unit.
UDT_MATKMIN: Min MATK of a unit.
UDT_MATKMAX: Max MATK of a unit.
UDT_DEF: DEF.
UDT_MDEF: MDEF.
UDT_HIT: HIT.
UDT_FLEE: FLEE.
UDT_PDODGE: Perfect Dodge.
UDT_CRIT: Critical Rate.
UDT_RACE: Race. (Eg. constants RC_DemiHuman or Integer 7).
UDT_ELETYPE: Element. (Eg. constants Ele_Neutral or Integer 0).
UDT_ELELEVEL: Element Level.
UDT_AMOTION: AMotion Rate.
UDT_ADELAY: ADelay Rate.
UDT_DMOTION: DMotion Rate.
UDT_HUNGER: Hunger Rate - for summons.
UDT_INTIMACY: Intimacy Rate - for summons.
UDT_LIFETIME: LifeTime - for summons.
UDT_MERC_KILLCOUNT: Kill count for mercenaries.
UDT_GROUP: group id
Data Types Description (return type)
UDT_SIZE: Unit Size
UDT_LEVEL: Level
UDT_HP: Current HP
UDT_MAXHP: Max HP
UDT_SP: SP
UDT_MAXSP: MAX SP
UDT_MASTERAID: Master Account ID (for Summons)
UDT_MASTERCID: Master Char ID (for Summons)
UDT_SPEED: Unit Speed.
UDT_MODE: Mode (Mobs only)
UDT_AI: Unit AI Type (see doc/constants.md for Unit AI Types)
UDT_SCOPTION: Status Options. (see doc/constants.md for Unit Option Types)
UDT_SEX: Gender of the unit. (see doc/constants.md for Genders)
UDT_CLASS: Class of the unit. (Monster ID)
UDT_HAIRSTYLE: Hair Style ID.
UDT_HAIRCOLOR: Hair Color ID.
UDT_HEADBOTTOM: Headgear Bottom Sprite ID.
UDT_HEADMIDDLE: Headgear Middle Sprite ID.
UDT_HEADTOP: Headgear Top Sprite ID.
UDT_CLOTHCOLOR: Cloth Color ID.
UDT_SHIELD: Shield Sprite ID.
UDT_WEAPON: Weapon Sprite ID.
UDT_LOOKDIR: Face direction.
UDT_CANMOVETICK: Stop a unit from move for n seconds.
UDT_STR: Unit STR.
UDT_AGI: Unit AGI.
UDT_VIT: Unit VIT.
UDT_INT: Unit INT.
UDT_DEX: Unit DEX.
UDT_LUK: Unit LUK.
UDT_ATKRANGE: Attack range of a unit.
UDT_ATKMIN: Min Atk of a unit.
UDT_ATKMAX: Max Atk of a unit.
UDT_MATKMIN: Min MATK of a unit.
UDT_MATKMAX: Max MATK of a unit.
UDT_DEF: DEF.
UDT_MDEF: MDEF.
UDT_HIT: HIT.
UDT_FLEE: FLEE.
UDT_PDODGE: Perfect Dodge.
UDT_CRIT: Critical Rate.
UDT_RACE: Race. (Eg. constants RC_DemiHuman or Integer 7).
UDT_ELETYPE: Element. (Eg. constants Ele_Neutral or Integer 0).
UDT_ELELEVEL: Element Level.
UDT_AMOTION: AMotion Rate.
UDT_ADELAY: ADelay Rate.
UDT_DMOTION: DMotion Rate.
UDT_HUNGER: Hunger Rate - for summons.
UDT_INTIMACY: Intimacy Rate - for summons.
UDT_LIFETIME: LifeTime - for summons.
UDT_MERC_KILLCOUNT: Kill count for mercenaries.
UDT_GROUP: group id
UDT_DAMAGE_TAKEN_RATE: damage taken rate of a unit.

returns -1 if value could not be retrieved.

@@ -6321,6 +6321,18 @@ static enum damage_lv battle_weapon_attack(struct block_list *src, struct block_
if (sd && sd->state.arrow_atk) //Consume arrow.
battle->consume_ammo(sd, 0, 0);

if (target->type == BL_MOB) {
struct mob_data *md = BL_CAST(BL_MOB, target);
if (md != NULL) {
if (md->db->dmg_taken_rate != 100) {
if (wd.damage > 0)
wd.damage = apply_percentrate64(wd.damage, md->db->dmg_taken_rate, 100);
if (wd.damage2 > 0)
wd.damage2 = apply_percentrate64(wd.damage2, md->db->dmg_taken_rate, 100);
}
}
}

damage = wd.damage + wd.damage2;
if( damage > 0 && src != target ) {
if( sc && sc->data[SC_DUPLELIGHT] && (wd.flag&BF_SHORT) && rnd()%100 <= 10+2*sc->data[SC_DUPLELIGHT]->val1 ){

0 comments on commit c179d91

Please sign in to comment.
You can’t perform that action at this time.